Module: StringX [C++ CString Solutions For AmxModX]

Adding Modules to help with scripting/coding plugins.
User avatar
Archive-Poster
Posts: 1189
Gender:
United States of America

Module: StringX [C++ CString Solutions For AmxModX]

Post by Archive-Poster »

StringX1.1

DESCRIPTION: Well, with this native you can do many thing with String. Example, Return Strings in a Forward. An more think. I try to port the best I can. CString to AmxModx. Yo don't need to be worried about the String Size.

NATIVES:

Code: Select all

/**
 * Create a new StringX Member.
 * An example would be: StringX_Create("Here Are Some Dinamic Private Text");
 *
 * @param text        If you want to set data in Constructor.
 * @param private    Other Plugin's Can to Read & Write the StringX?.
 * @return         Returns a handle of the StringX new Member.
 */
native StringX:StringX_Create( const text[] = "", private = true );

/**
 * Destroy A Specific StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: true.
 */
native StringX_Destroy( StringX:Handle );



/**
 * Compare two Specifics StringX Members.
 *
 * @param Handle1    Pointer of the StringX Member.
 * @param Handle1    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            * Handle1 <  Handle2 = -1
            * Handle1 == Handle2 =  0
            * Handle1 >  Hanble2 =  1
 */
native StringX_Compare( StringX:Handle1, StringX:Handle2 );

/**
 * Compare a Specific StringX Member with a Text.
 *
 * @param Handle1    Pointer of the StringX Member.
 * @param text        Text to be Compared.
 * @return         *Error: STRINGX_ERROR.
            * Handle1 <  Handle2 = -1
            * Handle1 == Handle2 =  0
            * Handle1 >  Hanble2 =  1
 */
native StringX_szCompare( StringX:Handle, const text[] = "" );



/**
 * Copy Handle2 to Handle1 ( Handle1 = Handle2 ).
 *
 * @param Handle1    Pointer of the StringX Member.
 * @param Handle2    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_Assign( StringX:Handle1, StringX:Handle2 );

/**
 * Copy Text to The Specific StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @param text        Text to Copy.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_szAssign( StringX:Handle, const text[] = "" );



/**
 * Add Handle2 to Handle1 ( Handle1 += Handle2 ).
 *
 * @param Handle1    Pointer of the StringX Member.
 * @param Handle2    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_Append( StringX:Handle1, StringX:Handle2 );

/**
 * Add Text to The Specific StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @param text        Text to Add.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_szAppend( StringX:Handle, const text[] = "" );



/**
 * String between (start) and (start + npos).
 *
 * @param Handle    Pointer of the StringX Member.
 * @param HandleOut    Pointer of the StringX Member.
 * @param start        Start Position.
 * @param npos        (I Don't know how to Explain).
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the new StringX.
 */
native StringX_SubStr( StringX:Handle, StringX:HandleOut, start, npos = -1 );

/**
 * String between (start) and (start + npos).
 *
 * @param Handle    Pointer of the StringX Member.
 * @param output    Array to Insert Data.
 * @param output_len    Len of the Array to Insert Data.
 * @param start        Start Position.
 * @param npos        (I Don't know how to Explain).
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the new StringX.
 */
native StringX_szSubStr( StringX:Handle, output[], output_len, index, npos = -1 );



/**
 * Clean StringX Member ( StringX = "" ).
 *
 * @param Handle1    Pointer of the StringX Member.
 * @param Handle2    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: 0.
 */
native StringX_Clean( StringX:Handle );

/**
 * Clean StringX Member ( StringX = "" ).
 *
 * @param Handle1    Pointer of the StringX Member.
 * @param Handle2    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *StringX != "": false.
            *StringX == "": true.
 */
native StringX_IsEmpty( StringX:Handle );

/**
 * Size of StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_Size( StringX:Handle );

/**
 * Trim Space of StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_Trim( StringX:Handle );

/**
 * Erase from (start) to (start + npos) of StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @param start        Start Position.
 * @param npos        (I Don't know how to Explain).
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_Erase( StringX:Handle, start, npos = -1 );

/**
 * Convert All Chars to Lower of StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_ToLower( StringX:Handle );



/**
 * Change the Access to the StringX Member.
 *
 * @param Handle    Pointer of the StringX Member.
 * @param plugin_id    The Id of the plugin, If set 0, All can Access.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_SetPlugin( StringX:Handle, plugin_id );

/**
 * Export a StringX Member to an Array.
 *
 * @param Handle    Pointer of the StringX Member.
 * @param output    Array to Insert Data.
 * @param output_len    Len of the Array to Insert Data.
 * @return         *Error: STRINGX_ERROR.
            *Success: Size of the StringX.
 */
native StringX_Export( StringX:Handle, output[], output_len ); 
New Natives:

Code: Select all

native StringX_Find( StringX:Handle, cchar, start = 0);

native StringX_GetChar( StringX:Handle, npos );
native StringX_SetChar( StringX:Handle, npos, newchar);


Tested Only on Windows but I compiled in Linux to.
Attachments
StringX.zip
(94.88 KiB) Downloaded 3 times
StringX_amxx_i386.so.zip
(10.99 KiB) Downloaded 4 times
StringX_amxx.dll.zip
(36.69 KiB) Downloaded 3 times

Who is online

Users browsing this forum: No registered users and 0 guests