Author
|
Message
|
Veteran Member
Join Date: May 2008
Location: Brazil
|
04-16-2010
, 20:02
Module: StringX [C++ CString Solutions For AmxModX]
|
#1
|
StringX1.1
By Ramón Berrutti (me)
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:
PHP Code:
/** * 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:
PHP Code:
native StringX_Find( StringX:Handle, cchar, start = 0);
native StringX_GetChar( StringX:Handle, npos ); native StringX_SetChar( StringX:Handle, npos, newchar);
CREDITS:
Kiske: Test Module if run.
IneedHelp: Do the first test with Natives, Because I can't.
Seta00: Report TypoError: Assing --> Assign And Valid the Handle
PD: I have yo eat know so I don't post a nice describe of the module.
Tested Only on Windows but I compiled in Linux to.
__________________
Last edited by AntiBots; 04-17-2010 at 10:04.
Reason: Update to 1.1
|
|
|
|