SRS String Functions
SRS 5.1 strings handling as examples of how to pass string pointers around.
Basic rules:
- strings must be created before use. Null strings are an error
condition in all cases.
- strings are returned only if they are being created (== ajStrNew)
- strings passed by reference can be changed (new strings, new location)
- strings passed by value are constant
- pos is the position in the string (0 .. len-1)
- len is the length from pos
- The string is stored at the end of the STRv data structure, so a
single free clears all but it is not possible to change size merely
by moving the string pointer so avoid this
- The user must delete strings when they are going out of scope.
- Temporary strings - similar model to SRS ?
- Log everything with counters for use in reporting
- Add a status report to the ajExit command
- Automatic deletion and allowing null entries for some modifiers?
Function classes
Destructor
decrements count (destroys string if not referenced)
and also destroys the string pointer to prevent accidental reuse.
All Functions
- STRv : pointer to string object
- (*) : special case - see code
Returns Function Destroys Modifies Given
STRv StrNew
STRv StrCpy STRv
. StrDel STRv
. StrGrow STRv
. StrShrink STRv
. StrClear STRv
STRv StrSub STRv
STRv StrLeft STRv
STRv StrRight STRv
. StrSet STRv STRv
. StrIns STRv STRv
. StrApp STRv STRv
. StrAdd STRv STRv
. StrCut STRv STRv
. StrSubst STRv STRv
. StrDebug STRv
. StrUpper STRv
. StrLower STRv
Bool StrEmpty STRv
int StrLen STRv
Bool StrEqual STRv, STRv
int StrCmp STRv, STRv
int StrHash STRv
char* StrConst (*) STRv
char* StrVal (*) STRv
char* StrGet STRv
int StrShared STRv
STRv StrTemp (*) char*
STRv StrCpyS char*
. StrSetS STRv char*
. StrInsS STRv char*
. StrAppS STRv char*
. StrAppN STRv char*
. StrAddS STRv char*
Bool StrEqualS STRv, char*
int StrCmpS STRv, char*
int StrHashS char*
STRv StrNCpyS char*
. StrNSetS STRv char*
STRv StrBufNew
. StrBufChange STRv
STRv StrFromInt
int StrToInt STRv
. StrCutLF STRv
STRv StrPrintf STRv char*,...
STRv StrEncode STRv
. StrDecode STRv
. StrTranslate STRv char*,char*
. StrFill STRv
. StrTrim STRv
STRv StrFormat STRv
STRv StrReplace (*) STRv