Files | |
file | cstring.c |
Implementations of ctl_sconst specific code and units. | |
file | cstring.h |
Safe constant, fixed-length and variable length string templates. | |
file | cstring.temp.h |
Safe constant, fixed-length string template functions. | |
file | ctlstring.c |
A place to manufacture string templates and related functions/data. | |
file | ctlstring.h |
Safe constant, fixed-length and variable length string templates. | |
file | fstring.h |
Fixed string class. | |
file | gstring.h |
Growing string class. | |
file | mstring.c |
Implementations of ctl_mstring specific code and units. | |
file | mstring.h |
Mutable string class generator. | |
file | mstring.temp.h |
Mutable string class generator template implementation. | |
Defines | |
#define | ctl_sconst(tchar) ppConcat(ctl_sconst_,tchar) |
Get class name from base name and character type. | |
#define | ctl_sconst_(tchar, function) ppConcat3(ctl_sconst( tchar ),_,function) |
Build the function name from character type and root class. | |
#define | ctl_sconst_auto(tchar, begin, end, label) ctl_sconst( tchar ) label = { (begin), (begin), (end) } |
Make fixed string operator on stack or as a global, with begin/end pointers Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_sconst_auto_string(tchar, mstr, label) ctl_sconst( tchar ) label = { (mstr)->begin, (mstr)->begin, (mstr)->end } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_sconst_auto_buff(tchar, buff, len, label) ctl_sconst( tchar ) label = { (buff), (buff), (buff)+cstrnlen(tchar)((buff),(len)) } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_sconst_auto_sz(tchar, sz, label) ctl_sconst( tchar ) label = { (sz), (sz), (sz)+cstrlen(tchar)((sz)) } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_sconst_auto_mmap(tchar, mmap, label) ctl_sconst( tchar ) label = { (const tchar*)ctl_mmap_ptr(mmap), (const tchar*)ctl_mmap_ptr(mmap), (const tchar*)ctl_mmap_ptr(mmap)+ctl_mmap_size(mmap) } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_sconst_init(tchar, self, buff, len) |
Initialize from a pointer and length. | |
#define | ctl_sconst_init_sz(tchar, self, sz) |
Initialize from a NUL terminated string pointer. | |
#define | ctl_sconst_init_mmap(tchar, self, mmap) |
Initialize from a NUL terminated string pointer. | |
#define | ctl_sconst_printf_fmt(tchar) szconst(tchar,"%.*s") |
Printf format string for ctl_sconst_printf_arg. | |
#define | ctl_sconst_printf_arg(self) ((self)->end - (self)->begin), (self)->begin |
Printf arguments for ctl_sconst_printf_fmt. | |
#define | ctl_sconst_copy(tchar, self, from) |
Copy from another ctlmfg_ctl_sconst. | |
#define | ctl_sconst_init_pointers(tchar, self, pBegin, pEnd) |
Initialize from a pointer and length. | |
#define | ctl_sconst_from_ctlfixed(tchar, self, fixed) |
Reference a fixed C string for parsing. | |
#define | ctl_sconst_from_ctlstring(tchar, self, variable) |
Reference a fixed C string for parsing. | |
#define | ctl_sconst_remain(tchar, self) ( (self)->end - (self)->parse ) |
Tell how many characters remain to be parsed. | |
#define | ctl_sconst_consumed(tchar, self) ( (self)->parse - (self)->begin ) |
Tell how many characters have been parsed. | |
#define | ctl_sconst_size(tchar, self) ((size_t)( (self)->end - (self)->begin )) |
Tell how many characters are in the string. | |
#define | ctl_sconst_parse(tchar, self) ( (self)->parse ) |
Get current parse position. | |
#define | ctl_sconst_reset(tchar, self) ( (self)->parse = (self)->begin ) |
Reset parse point to beginning. | |
#define | ctl_sconst_begin(tchar, self) ( (self)->begin ) |
Reset parse point to beginning. | |
#define | ctl_sconst_end(tchar, self) ( (self)->end ) |
Reset parse point to beginning. | |
#define | ctl_sconst_next(tchar, self) ( (self)->parse < (self)->end ? (++(self)->parse) : (self)->end ) |
Parse to next character in const string. | |
#define | ctl_sconst_prev(tchar, self) ( (self)->parse > (self)->begin ? (--(self)->parse) : (self)->begin ) |
Parse to previous character in const string. | |
#define | ctl_sconst_isalnum(tchar, self) ( cisalnum(tchar)(*(self)->parse) ) |
C runtime clone of isalnum. | |
#define | ctl_sconst_isalpha(tchar, self) ( cisalpha(tchar)(*(self)->parse) ) |
C runtime clone of isalpha. | |
#define | ctl_sconst_iscntrl(tchar, self) ( ciscntrl(tchar)(*(self)->parse) ) |
C runtime clone of iscntrl. | |
#define | ctl_sconst_isdigit(tchar, self) ( cisdigit(tchar)(*(self)->parse) ) |
C runtime clone of isdigit. | |
#define | ctl_sconst_isgraph(tchar, self) ( cisgraph(tchar)(*(self)->parse) ) |
C runtime clone of isgraph. | |
#define | ctl_sconst_islower(tchar, self) ( cislower(tchar)(*(self)->parse) ) |
C runtime clone of islower. | |
#define | ctl_sconst_ispunct(tchar, self) ( cispunct(tchar)(*(self)->parse) ) |
C runtime clone of ispunct. | |
#define | ctl_sconst_isspace(tchar, self) ( cisspace(tchar)(*(self)->parse) ) |
C runtime clone of isspace. | |
#define | ctl_sconst_isupper(tchar, self) ( cisupper(tchar)(*(self)->parse) ) |
C runtime clone of isupper. | |
#define | ctl_sconst_isprint(tchar, self) ( cisprint(tchar)(*(self)->parse) ) |
C runtime clone of isprint. | |
#define | ctl_sconst_isxdigit(tchar, self) ( cisxdigit(tchar)(*(self)->parse) ) |
C runtime clone of isxdigit. | |
#define | ctl_sconst_left(tchar, self, cstr_left, count) |
A bit like left$ in BASIC, except it produces a const substring. | |
#define | ctl_sconst_right(tchar, self, cstr_right, count) |
A bit like right$ in BASIC, except it produces a const substring. | |
#define | ctl_sconst_mid(tchar, self, cstr_mid, offset, count) |
A bit like mid$ in BASIC, except it produces a const substring. | |
#define | ctl_sconst_strchr(tchar, self, ch) ctl_sconst_(tchar,strchr)( self, ch ) |
Look for a character in a string. | |
#define | ctl_sconst_strichr(tchar, self, ch) ctl_sconst_(tchar,strichr)( self, ch ) |
Look for a character in a string; case insensitive. | |
#define | ctl_sconst_strstr(tchar, self, sz) ctl_sconst_(tchar,strstr)( self, sz ) |
Look for a string in a string. | |
#define | ctl_sconst_stristr(tchar, self, sz) ctl_sconst_(tchar,stristr)( self, sz ) |
Look for a string in a string; case insensitive. | |
#define | ctl_sconst_dmatch(tchar, self, substring, chOpen, chClose) ctl_sconst_(tchar,dmatch)( self, substring, chOpen, chClose ) |
Search for a block of text enclosed by two symbols, such as (), {} or [] The depth of opening types is matched to the depth of closing types. | |
#define | ctl_sconst_dmatchstr(tchar, self, substring, szOpen, szClose) ctl_sconst_(tchar,dmatchstr)( self, substring, szOpen, szClose ) |
Search for a block of text enclosed by two strings, such as "<",/>" "begin","end". | |
#define | ctl_sconst_strpbrk(tchar, self, szSet) ctl_sconst_(tchar,strpbrk)( self, szSet ) |
Look for any one of the characters in szSet in this string starting at parse point. | |
#define | ctl_sconst_skipspace(tchar, self) ctl_sconst_(tchar,skipspace)( self ) |
Skip over any white space. | |
#define | ctl_sconst_nextspace(tchar, self) ctl_sconst_(tchar,nextspace)( self ) |
Skip over any NON-white space until we find a space. | |
#define | ctl_sconst_findclass(tchar, self, classname) ctl_sconst_(tchar,ppConcat(find_,classname))( self ) |
Find the next instance of a character class ala ctype.h. | |
#define | ctl_sconst_findnotclass(tchar, self, classname) ctl_sconst_(tchar,ppConcat(find_not_,classname))( self ) |
Find the next instance that is not of a character class ala ctype.h. | |
#define | ctl_sconst_scanclass(tchar, self, found, classname) ctl_sconst_(tchar,ppConcat(scan_,classname))( self, found ) |
Scan for a block of characters that are of a class type. | |
#define | ctl_sconst_scannotclass(tchar, self, found, classname) ctl_sconst_(tchar,ppConcat(scan_not_,classname))( self, found ) |
Scan for a block of characters that are NOT of a class type. | |
#define | ctl_sconst_strcmp(tchar, self, sz) ctl_sconst_(tchar,strcmp)( self, sz ) |
Do a string comparison at parse point. | |
#define | ctl_sconst_stricmp(tchar, self, sz) ctl_sconst_(tchar,stricmp)( self, sz ) |
Do a case insensitive string comparison at parse point. | |
#define | ctl_sconst_strncmp(tchar, self, sz, count) ctl_sconst_(tchar,strncmp)( self, sz, count ) |
Do a string comparison at parse point. | |
#define | ctl_sconst_strnicmp(tchar, self, sz, count) ctl_sconst_(tchar,strnicmp)( self, sz, count ) |
Do a case insensitive string comparison at parse point. | |
#define | ctl_sconst_compare(tchar, p1, p2) ctl_sconst_(tchar,compare)( (p1),(p2) ) |
Do a string comparison at parse point. | |
#define | ctl_sconst_rcompare(tchar, p1, p2) ctl_sconst_(tchar,compare)( (p2),(p1) ) |
Do a string reverse comparison at parse point. | |
#define | ctl_sconst_icompare(tchar, self, other) ctl_sconst_(tchar,icompare)( (self), (other) ) |
Do a case insensitive string comparison at parse point. | |
#define | ctl_sconst_getbool(tchar, self, pValue) ctl_sconst_(tchar,getbool)( self, pValue ) |
Decode a boolean; any decimal number, true/on, false/off will do. | |
#define | ctl_sconst_getint8(tchar, self, pValue) ctl_sconst_(tchar,getint8)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getuint8(tchar, self, pValue) ctl_sconst_(tchar,getuint8)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getint16(tchar, self, pValue) ctl_sconst_(tchar,getint16)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getuint16(tchar, self, pValue) ctl_sconst_(tchar,getuint16)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getint32(tchar, self, pValue) ctl_sconst_(tchar,getint32)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getuint32(tchar, self, pValue) ctl_sconst_(tchar,getuint32)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getint64(tchar, self, pValue) ctl_sconst_(tchar,getint64)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getuint64(tchar, self, pValue) ctl_sconst_(tchar,getuint64)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getfloat32(tchar, self, pValue) ctl_sconst_(tchar,getfloat32)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getfloat64(tchar, self, pValue) ctl_sconst_(tchar,getfloat64)( self, pValue ) |
Decode a value. | |
#define | ctl_sconst_getxbool(tchar, self, pValue) ctl_sconst_(tchar,getbool)( self, pValue ) |
Decode an 8 bit hexadecimal value, stopping at 2 digits. | |
#define | ctl_sconst_getxint8(tchar, self, pValue) ctl_sconst_(tchar, getxint8 )( self, pValue ) |
Decode an 8 bit hexadecimal value, stopping at 2 digits. | |
#define | ctl_sconst_getxuint8(tchar, self, pValue) ctl_sconst_(tchar, getxuint8 )( self, pValue ) |
Decode an 8 bit hexadecimal value, stopping at 2 digits. | |
#define | ctl_sconst_getxint16(tchar, self, pValue) ctl_sconst_(tchar, getxint16 )( self, pValue ) |
Decode a 16 bit hexadecimal value, stopping at 4 digits. | |
#define | ctl_sconst_getxuint16(tchar, self, pValue) ctl_sconst_(tchar, getxuint16 )( self, pValue ) |
Decode a 16 bit hexadecimal value, stopping at 4 digits. | |
#define | ctl_sconst_getxint32(tchar, self, pValue) ctl_sconst_(tchar, getxuint32 )( self, (uint32*)(pValue), 8 ) |
Decode a 32 bit hexadecimal value, stopping at 8 digits. | |
#define | ctl_sconst_getxuint32(tchar, self, pValue) ctl_sconst_(tchar, getxuint32 )( self, pValue, 8 ) |
Decode a 32 bit hexadecimal value, stopping at 8 digits. | |
#define | ctl_sconst_getxint64(tchar, self, pValue) ctl_sconst_(tchar, getxuint64 )( self, (uint64*)(pValue), 16 ) |
Decode a 64 bit hexadecimal value, stopping at 16 digits. | |
#define | ctl_sconst_getxuint64(tchar, self, pValue) ctl_sconst_(tchar, getxuint64 )( self, pValue, 16 ) |
Decode a 64 bit hexadecimal value, stopping at 16 digits. | |
#define | ctl_sconst_getxn(tchar, self, pValue, numDigits) ctl_sconst_(tchar, getx64 )( self, pValue, numDigits ) |
Decode a hexadecimal value up to 32 bits (8 digits), limiting to some arbitrary number of places of precision Useful for places where we simply append hexadecimal data together at fixed widths. | |
#define | ctl_sconst_getxnn(tchar, self, pValue, numDigits) ctl_sconst_(tchar, getx64 )( self, pValue, numDigits ) |
Decode a hexadecimal value up to 64 bits (16 digits), limiting to some arbitrary number of places of precision Useful for places where we simply append hexadecimal data together at fixed widths. | |
#define | ctl_sconst_getenum(tchar, self, pValue, szz) ctl_sconst_(tchar,getenum)( self, pValue, szz ) |
Decode one of a set of possible strings to an index into that set. | |
#define | ctl_sconst_getienum(tchar, self, pValue, szz) ctl_sconst_(tchar,getienum)( self, pValue, szz ) |
Decode one of a set of possible strings to an index into that set, case insensitive. | |
#define | ctldecl_ctl_sconst(tchar) |
Declare a constant string parser class of functionality. | |
#define | DEF_Supported_Class_Scans(tchar, def) |
This is the generator template list for scanning for character types ala ctype.h; add your custom handlers here to extend it, if you like. | |
#define | ctl_sconst_foreach(tchar, self, iterator) |
Iterate the characters in the string from beginning to end. | |
#define | ctl_sconst_foreach_reverse(tchar, self, iterator) |
Iterate the characters in the string from end to beginning. | |
#define | chconst(tchar, ch) ppConcat(chconst_,tchar)(ch) |
Make the "correct" kind of character constant by template tchar. | |
#define | szconst(tchar, sz) ppConcat(szconst_,tchar)(sz) |
Make the "correct" kind of string constant by template tchar. | |
#define | szconvert(tchardst, tcharsrc) (ch) ppConcat3(szconvert_,tchardst,tcharsrc) |
Convert from wchar_t<->char. | |
#define | szstrfmt(tchar) ppConcat(szstrfmt_,tchar) |
The 'standard' format is for ls when receiving wchar_t strings, and s when receiving char strings. | |
#define | ctl_chsize(tchar, length) (ppCtypeSelect(tchar,(size_t)(length),(length)*sizeof(tchar))) |
Calculate size of a string in bytes, based on character template. | |
#define | ctl_chlength(tchar, size) (ppCtypeSelect(tchar,(size_t)(size),(size)/sizeof(tchar))) |
Calculate length of a string in characters from its memory size, based on character template. | |
#define | ppCtypeSelect(tchar, xchar, xwchar_t) ppConcat(_ppCtypeSelect_,tchar)(xchar,xwchar_t) |
Make selection logic for character type handler a little more compact. | |
#define | chssize(tchar, length) (ppCtypeSelect(tchar,(size_t)(length),(length)*2)) |
Work out a string's serial size from its length. | |
#define | chslength(tchar, size) (ppCtypeSelect(tchar,(size_t)(size),(size)/2)) |
Work out a string's length from its serial size. | |
#define | cmemcpy(tchar, sDst, sSrc, count) memcpy( (sDst),(sSrc),ctl_chsize(tchar,count) ) |
Copy part of a string, ignoring NUL terminator. | |
#define | cmemmove(tchar, sDst, sSrc, count) memmove( (sDst),(sSrc),ctl_chsize(tchar,count) ) |
Copy part of a string, ignoring NUL terminator, may be overlapped. | |
#define | ctl_fstring(tchar) ctl_mstring(tchar,fixed) |
This is the mutable string that stays the same size When you hit the limit imposed at instantiation, that's all you ever get. | |
#define | ctl_fstring_destroy(tchar, self) |
Function to de-initialize fixed buffer (NOP). | |
#define | ctl_fstring_auto(tchar, size, label) |
Make string on stack or as a global, with buffer Uses non-standard ANSI extensions: non-const initializers. | |
#define | ctl_fstring_auto_buff(tchar, buff, size, label) ctl_mstring(tchar,fixed) label = {(buff),(buff),(buff)+(size)-1} |
Initialize from a NUL terminated string pointer Uses non-standard ANSI extensions: non-const initializers. | |
#define | ctl_fstring_init(tchar, self, buff, len) |
Initialize from a NUL terminated string pointer. | |
#define | ctl_fstring_init_sz(tchar, self, sz) |
Initialize from a NUL terminated string pointer. | |
#define | ctl_fstring_swap(tchar, p1, p2) |
Swap two fstrings -. | |
#define | ctl_fstring_move(tchar, p1, p2) |
Move contents of one string to another. | |
#define | ctl_fstring_remain(tchar, self) ( (self)->endBuff - (self)->end ) |
Tell how much bigger the string can get. | |
#define | ctl_fstring_size(tchar, self) ((size_t)( (self)->end - (self)->begin )) |
Tell how many characters are in the string, right now. | |
#define | ctl_fstring_maxsize(tchar, self) ((size_t)( (self)->endBuff - (self)->begin )) |
Tell how many total characters can be put in the string. | |
#define | ctl_fstring_reset(tchar, self) ( *((self)->end = (self)->begin) = 0 ) |
Reset parse point to beginning. | |
#define | ctl_fstring_begin(tchar, self) ( (self)->begin ) |
Point at start of string. | |
#define | ctl_fstring_end(tchar, self) ( (self)->end ) |
Point to the end of the string. | |
#define | ctl_fstring_fill(tchar, self, fillVal, count) ctl_mstring_(tchar,fixed, fill )((self), (fillVal), (count) ) |
Fill string at parse point with a given number of characters. | |
#define | ctl_fstring_add(tchar, self, ch) ctl_mstring_(tchar,fixed, fill )((self), (ch), 1 ) |
Fill string at parse point with a given number of characters. | |
#define | ctl_fstring_filltab(tchar, self, fillVal, tabPos) ctl_mstring_(tchar,fixed, filltab )((self), (fillVal), (tabPos) ) |
Fill to some tab position with a given number of characters. | |
#define | ctl_fstring_putbool(tchar, self, value) ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"true") : szconst(tchar,"false"), ~0u ) |
Write a boolean as "true" or "false". | |
#define | ctl_fstring_putboolyesno(tchar, self, value) ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"yes") : szconst(tchar,"no"), ~0u ) |
Write a boolean as "yes" or "no". | |
#define | ctl_fstring_putboolonoff(tchar, self, value) ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"on") : szconst(tchar,"off"), ~0u ) |
Write a boolean as "on" or "off". | |
#define | ctl_fstring_putbool10(tchar, self, value) ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"1") : szconst(tchar,"0"), ~0u ) |
Write a boolean as "1" or "0". | |
#define | ctl_fstring_putint8(tchar, self, value) ctl_mstring_(tchar,fixed, putint32 )((self),(int32)(int8)(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putuint8(tchar, self, value) ctl_mstring_(tchar,fixed, putuint32 )((self),(uint32)(uint8)(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putint16(tchar, self, value) ctl_mstring_(tchar,fixed, putint32 )((self),(int32)(int16)(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putuint16(tchar, self, value) ctl_mstring_(tchar,fixed, putuint32 )((self),(uint32)(uint16)(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putint32(tchar, self, value) ctl_mstring_(tchar,fixed, putint32 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putuint32(tchar, self, value) ctl_mstring_(tchar,fixed, putuint32 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putint64(tchar, self, value) ctl_mstring_(tchar,fixed, putint64 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putuint64(tchar, self, value) ctl_mstring_(tchar,fixed, putuint64 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_fstring_putfloat32(tchar, self, value) ctl_mstring_(tchar,fixed, putfloat64 )((self),(value) ) |
Write a floating point value as a decimal number. | |
#define | ctl_fstring_putfloat64(tchar, self, value) ctl_mstring_(tchar,fixed, putfloat64 )((self),(value) ) |
Write a floating point value as a decimal number. | |
#define | ctl_fstring_putxint8(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 2 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxint16(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 4 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxint32(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 8 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxint64(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint64 )((self),(uint32)(value), 16 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxuint8(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 2 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxuint16(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint32 )((self),(value), 4 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxuint32(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint32 )((self),(value), 8 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putxuint64(tchar, self, value) ctl_mstring_(tchar,fixed, putxuint64 )((self),(value), 16 ) |
Write a value as a hexadecimal number. | |
#define | ctl_fstring_putenum(tchar, self, value, szzList, szUndefined) ctl_mstring_(tchar,fixed, putenum )((self),(value),(szzList), countof(szzList),(szUndefined) ) |
Write an enumerated value. | |
#define | ctl_fstring_putenum_max(tchar, self, value, szzList, max, szUndefined) ctl_mstring_(tchar,grow, putenum )((self),(value),(szzList), (max), (szUndefined) ) |
Write an enumerated value. | |
#define | ctl_fstring_strcat(tchar, self, sz) ctl_mstring_(tchar,fixed, strncat )((self),(sz), ~0u ) |
Concatenate a string onto this at parse. | |
#define | ctl_fstring_strcpy(tchar, self, sz) ctl_mstring_(tchar,fixed, strncpy )((self),(sz), ~0u ) |
Copy another string on top of this, setting the parse point after sz. | |
#define | ctl_fstring_strncat(tchar, self, sz, maxLen) ctl_mstring_(tchar,fixed, strncat )((self),(sz),(maxLen) ) |
Concatenate a string onto this at parse. | |
#define | ctl_fstring_strncpy(tchar, self, sz, maxLen) ctl_mstring_(tchar,fixed, strncpy )((self),(sz),(maxLen) ) |
Copy another string on top of this, setting the parse point and end after sz. | |
#define | ctl_fstring_strinsert(tchar, self, position, sz) ctl_mstring_(tchar,fixed, strninsert )((self),(position),(sz), 0u ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string. | |
#define | ctl_fstring_strninsert(tchar, self, position, sz, maxLen) ctl_mstring_(tchar,fixed, strninsert )((self),(position),(sz),(maxLen) ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string. | |
#define | ctl_fstring_vsprintf(tchar, self, fmt, args) ctl_mstring_(tchar,fixed, vsprintf )((self),(fmt),(args) ) |
Add/overwrite text at parse ala vsprintf formatting arguments. | |
#define | ctl_fstring_sprintf(tchar, selffmtargs) ctl_mstring_(tchar,fixed, sprintf ) selffmtargs |
Add/overwrite text at parse ala sprintf formatting arguments. | |
#define | ctl_fstring_makeClabel(tchar, self) ctl_mstring_(tchar,fixed, makeClabel )( (self) ) |
Convert contents into something label-friendly for C. | |
#define | ctl_fstring_truncate(tchar, self, newsize) ctl_mstring_(tchar,fixed, truncate )( (self), (newsize) ) |
Truncate a string's trailing characters. | |
#define | ctl_fstring_foreach(tchar, self, iterator) |
Iterate the characters in the string from beginning to end. | |
#define | ctl_fstring_foreach_reverse(tchar, self, iterator) |
Iterate the characters in the string from end to beginning. | |
#define | ctl_gstring(tchar) ctl_mstring(tchar,grow) |
This is the mutable string that stays the same size When you hit the limit imposed at instantiation, that's all you ever get. | |
#define | ctl_gstring_destroy(tchar, self) |
Function to de-initialize growable buffer. | |
#define | ctl_gstring_auto(tchar, label) ctl_mstring(tchar,grow) label = {(tchar*)ctl_mstring_(tchar,grow,0),(tchar*)ctl_mstring_(tchar,grow,0),(tchar*)ctl_mstring_(tchar,grow,0)} |
Initialize from a NUL terminated string pointer Uses non-standard ANSI extension: non-const initializers. | |
#define | ctl_gstring_init(tchar, self) (self)->begin = (self)->end = (self)->endBuff = (tchar*)ctl_mstring_(tchar,grow,0)\ |
Initialize from a NUL terminated string pointer. | |
#define | ctl_gstring_init_sz(tchar, self, sz) |
Initialize from a NUL terminated string pointer. | |
#define | ctl_gstring_init_cstring(tchar, self, cstr) |
Initialize from a constant string. | |
#define | ctl_gstring_swap(tchar, p1, p2) |
Swap two fstrings -. | |
#define | ctl_gstring_move(tchar, p1, p2) |
Move contents of one string to another. | |
#define | ctl_gstring_remain(tchar, self) ( (self)->endBuff - (self)->end ) |
Tell how much bigger the string can get before it reallocates. | |
#define | ctl_gstring_size(tchar, self) ((size_t)( (self)->end - (self)->begin )) |
Tell how many characters are in the string, right now. | |
#define | ctl_gstring_reset(tchar, self) { if( (self)->begin != ctl_mstring_(tchar,grow,0) ) { (self)->end = (self)->begin; *(self)->begin = 0; } } |
Reset parse point to beginning. | |
#define | ctl_gstring_begin(tchar, self) ( (self)->begin ) |
Point at start of string. | |
#define | ctl_gstring_end(tchar, self) ( (self)->end ) |
Point to the end of the string. | |
#define | ctl_gstring_resize(tchar, self, count) { ctl_mstring_(tchar,grow, grow )( (self), (count) - ((self)->end-(self)->begin) ); *((self)->end = (self)->begin+(count)) = 0; } |
Grow or shrink a string, in preparation for some external copy/operation. | |
#define | ctl_gstring_fill(tchar, self, fillVal, count) ctl_mstring_(tchar,grow, fill )((self), (fillVal), (count) ) |
Fill string at parse point with a given number of characters. | |
#define | ctl_gstring_add(tchar, self, ch) ctl_mstring_(tchar,grow, fill )((self), (ch), 1 ) |
Fill string at parse point with a given number of characters. | |
#define | ctl_gstring_filltab(tchar, self, fillVal, tabPos) ctl_mstring_(tchar,grow, filltab )((self), (fillVal), (tabPos) ) |
Fill to some tab position with a given number of characters. | |
#define | ctl_gstring_putbool(tchar, self, value) ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"true") : szconst(tchar,"false"), ~0u ) |
Write a boolean as "true" or "false". | |
#define | ctl_gstring_putboolyesno(tchar, self, value) ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"yes") : szconst(tchar,"no"), ~0u ) |
Write a boolean as "yes" or "no". | |
#define | ctl_gstring_putboolonoff(tchar, self, value) ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"on") : szconst(tchar,"off"), ~0u ) |
Write a boolean as "on" or "off". | |
#define | ctl_gstring_putbool10(tchar, self, value) ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"1") : szconst(tchar,"0"), ~0u ) |
Write a boolean as "1" or "0". | |
#define | ctl_gstring_putint8(tchar, self, value) ctl_mstring_(tchar,grow, putint32 )((self),(int32)(int8)(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putuint8(tchar, self, value) ctl_mstring_(tchar,grow, putuint32 )((self),(uint32)(uint8)(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putint16(tchar, self, value) ctl_mstring_(tchar,grow, putint32 )((self),(int32)(int16)(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putuint16(tchar, self, value) ctl_mstring_(tchar,grow, putuint32 )((self),(uint32)(uint16)(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putint32(tchar, self, value) ctl_mstring_(tchar,grow, putint32 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putuint32(tchar, self, value) ctl_mstring_(tchar,grow, putuint32 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putint64(tchar, self, value) ctl_mstring_(tchar,grow, putint64 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putuint64(tchar, self, value) ctl_mstring_(tchar,grow, putuint64 )((self),(value) ) |
Write a value as a decimal number. | |
#define | ctl_gstring_putfloat32(tchar, self, value) ctl_mstring_(tchar,grow, putfloat64 )((self),(value) ) |
Write a floating point value as a decimal number. | |
#define | ctl_gstring_putfloat64(tchar, self, value) ctl_mstring_(tchar,grow, putfloat64 )((self),(value) ) |
Write a floating point value as a decimal number. | |
#define | ctl_gstring_putxint8(tchar, self, value) ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 2 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxint16(tchar, self, value) ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 4 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxint32(tchar, self, value) ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 8 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxint64(tchar, self, value) ctl_mstring_(tchar,grow, putxuint64 )((self),(uint32)(value), 16 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxuint8(tchar, self, value) ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 2 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxuint16(tchar, self, value) ctl_mstring_(tchar,grow, putxuint32 )((self),(value), 4 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxuint32(tchar, self, value) ctl_mstring_(tchar,grow, putxuint32 )((self),(value), 8 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putxuint64(tchar, self, value) ctl_mstring_(tchar,grow, putxuint64 )((self),(value), 16 ) |
Write a value as a hexadecimal number. | |
#define | ctl_gstring_putenum(tchar, self, value, szzList, szUndefined) ctl_mstring_(tchar,grow, putenum )((self),(value),(szzList), countof(szzList),(szUndefined) ) |
Write an enumerated value. | |
#define | ctl_gstring_putenum_max(tchar, self, value, szzList, max, szUndefined) ctl_mstring_(tchar,grow, putenum )((self),(value),(szzList), (max), (szUndefined) ) |
Write an enumerated value. | |
#define | ctl_gstring_strcat(tchar, self, sz) ctl_mstring_(tchar,grow, strncat )((self),(sz), ~0u ) |
Concatenate a string onto this at parse. | |
#define | ctl_gstring_strcpy(tchar, self, sz) ctl_mstring_(tchar,grow, strncpy )((self),(sz), ~0u ) |
Copy another string on top of this, setting the parse point after sz. | |
#define | ctl_gstring_strncat(tchar, self, sz, maxLen) ctl_mstring_(tchar,grow, strncat )((self),(sz),(maxLen) ) |
Concatenate a string onto this at parse. | |
#define | ctl_gstring_strncpy(tchar, self, sz, maxLen) ctl_mstring_(tchar,grow, strncpy )((self),(sz),(maxLen) ) |
Copy another string on top of this, setting the parse point and end after sz. | |
#define | ctl_gstring_strinsert(tchar, self, position, sz) ctl_mstring_(tchar,grow, strninsert )((self),(position),(sz), 0u ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string. | |
#define | ctl_gstring_strninsert(tchar, self, position, sz, maxLen) ctl_mstring_(tchar,grow, strninsert )((self),(position),(sz),(maxLen) ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string. | |
#define | ctl_gstring_vsprintf(tchar, self, fmt, args) ctl_mstring_(tchar,grow, vsprintf )((self),(fmt),(args) ) |
Add/overwrite text at parse ala vsprintf formatting arguments. | |
#define | ctl_gstring_sprintf(tchar, selffmtargs) ctl_mstring_(tchar,grow, sprintf ) selffmtargs |
Add/overwrite text at parse ala sprintf formatting arguments. | |
#define | ctl_gstring_makeClabel(tchar, self) ctl_mstring_(tchar,grow, makeClabel )( (self) ) |
Convert contents into something label-friendly for C. | |
#define | ctl_gstring_truncate(tchar, self, newsize) ctl_mstring_(tchar,grow, truncate )( (self), (newsize) ) |
Truncate a string's trailing characters. | |
#define | ctl_gstring_compare(tchar, p1, p2) ctl_mstring_(tchar,grow, compare )( p1, p2 ) |
Compare two strings for qsort. | |
#define | ctl_gstring_rcompare(tchar, p1, p2) ctl_mstring_(tchar,grow, rcompare )( p1, p2 ) |
Compare two strings for qsort. | |
#define | ctl_gstring_foreach(tchar, self, iterator) |
Iterate the characters in the string from beginning to end. | |
#define | ctl_gstring_foreach_reverse(tchar, self, iterator) |
Iterate the characters in the string from end to beginning. | |
#define | ctl_mstring(tchar, handler) ppConcat4(ctl_mstring_,tchar,_,handler) |
Get class name from base name and character type. | |
#define | ctl_mstring_(tchar, handler, function) ppConcat3(ctl_mstring(tchar,handler),_,function) |
Build the function name from character type and root class. | |
#define | ctldecl_ctl_mstring(tchar, handler) |
Base class for ctl_fstring and ctl_string. | |
Functions | |
struct | ppConcat (ctl_sconst_, char) |
Constant substring parser class\. | |
struct | ppConcat (ctl_sconst_, wchar_t) |
Constant substring parser class\. | |
bool | ctl_sconst_ (tchar, strchr)(ctl_sconst(tchar)*self |
Look for a character in a string tchar Template: type of string we're working with self Instance of string we're operating on (like 'this' in C++) ch What character we're seeking. | |
struct | ppConcat4 (ctl_mstring_, char, _, grow) |
Mutable string class. | |
struct | ppConcat4 (ctl_mstring_, wchar_t, _, grow) |
Mutable string class. | |
struct | ppConcat4 (ctl_mstring_, char, _, fixed) |
Mutable string class. | |
struct | ppConcat4 (ctl_mstring_, wchar_t, _, fixed) |
Mutable string class. | |
ctl_mstring_xgrow (tchar, handler, const tchar ctl_mstring_(tchar, handler, 0)[1]=szconst(tchar,"");) void ctl_mstring_(tchar | |
See if the string needs to grow, grow it according to templats (tchar,handler) Template: type of string we're working with self Instance of string we're operating on (like 'this' in C++) addLen How much to grow by . | |
_growcode (tchar, self, addLen) void ctl_mstring_(tchar | |
Fill string at parse point with a given number of characters (tchar,handler) Template: type of string we're working with self Instance of string we're operating on (like 'this' in C++) fillVal Fill character value to repeat count How many times to repeat. | |
void | ctl_mstring_ (tchar, handler, filltab)(ctl_mstring(tchar |
Fill to some tab position with a given number of characters (tchar,handler) Template: type of string we're working with self Instance of string we're operating on (like 'this' in C++) fillVal Fill character tabPos If this is 10, and parse is <10 chars from begin, this will fill up to 10. |
#define chconst | ( | tchar, | |||
ch | ) | ppConcat(chconst_,tchar)(ch) |
Make the "correct" kind of character constant by template tchar.
tchar | Type of character | |
ch | Character |
Definition at line 29 of file ctlstring.h.
Referenced by ctl_xmlread_getname(), ctl_xmlread_gettextbefore(), ctl_xmlread_init(), ctl_xmlread_is(), ctl_xmlread_next(), ctl_xmlread_rawattribute(), ctl_xmlread_rawname(), ctl_xmlread_rawtextbefore(), ctl_xmlread_translate_char(), ctl_xmlread_translate_wchar_t(), ctl_xmlwrite_string_char(), and ctl_xmlwrite_string_wchar_t().
#define chslength | ( | tchar, | |||
size | ) | (ppCtypeSelect(tchar,(size_t)(size),(size)/2)) |
Work out a string's length from its serial size.
tchar | Type of character string | |
size | Size of string |
Definition at line 164 of file ctlstring.h.
Referenced by char_record_read_gstring(), char_serial_read_fstring(), char_serial_read_gstring(), wchar_t_record_read_gstring(), wchar_t_serial_read_fstring(), and wchar_t_serial_read_gstring().
#define chssize | ( | tchar, | |||
length | ) | (ppCtypeSelect(tchar,(size_t)(length),(length)*2)) |
Work out a string's serial size from its length.
tchar | Type of character string | |
length | Length of string |
Definition at line 156 of file ctlstring.h.
Referenced by char_record_size_gstring(), char_record_size_string(), wchar_t_record_size_gstring(), wchar_t_record_size_string(), and wchar_t_record_write_string().
#define cmemcpy | ( | tchar, | |||
sDst, | |||||
sSrc, | |||||
count | ) | memcpy( (sDst),(sSrc),ctl_chsize(tchar,count) ) |
Copy part of a string, ignoring NUL terminator.
tchar | Kind of char we are operating on (multiplies count by wchar_t as applicable) | |
sDst | Where to copy to | |
sSrc | Where to copy from | |
count | How many characters to copy |
Definition at line 263 of file ctlstring.h.
Referenced by char_xml_read_string().
#define cmemmove | ( | tchar, | |||
sDst, | |||||
sSrc, | |||||
count | ) | memmove( (sDst),(sSrc),ctl_chsize(tchar,count) ) |
Copy part of a string, ignoring NUL terminator, may be overlapped.
tchar | Kind of char we are operating on (multiplies count by wchar_t as applicable) | |
sDst | Where to copy to | |
sSrc | Where to copy from | |
count | How many characters to copy |
Definition at line 273 of file ctlstring.h.
#define ctl_chlength | ( | tchar, | |||
size | ) | (ppCtypeSelect(tchar,(size_t)(size),(size)/sizeof(tchar))) |
Calculate length of a string in characters from its memory size, based on character template.
tchar | Template: type of string we're working with | |
size | A size to convert to length |
Definition at line 82 of file ctlstring.h.
Referenced by char_record_read_gstring().
#define ctl_chsize | ( | tchar, | |||
length | ) | (ppCtypeSelect(tchar,(size_t)(length),(length)*sizeof(tchar))) |
Calculate size of a string in bytes, based on character template.
tchar | Template: type of string we're working with | |
length | A length to convert to size |
Definition at line 73 of file ctlstring.h.
Referenced by char_xml_read_gstring().
#define ctl_fstring | ( | tchar | ) | ctl_mstring(tchar,fixed) |
#define ctl_fstring_add | ( | tchar, | |||
self, | |||||
ch | ) | ctl_mstring_(tchar,fixed, fill )((self), (ch), 1 ) |
#define ctl_fstring_auto | ( | tchar, | |||
size, | |||||
label | ) |
Value:
tchar ppConcat(buff_,label)[size] = szconst(tchar,"");\ ctl_fstring_auto_buff(tchar, ppConcat(buff_,label), size, label )
tchar | Template: type of string we're working with | |
size | size_t length of buff | |
label | What to call this instance |
#define ctl_fstring_auto_buff | ( | tchar, | |||
buff, | |||||
size, | |||||
label | ) | ctl_mstring(tchar,fixed) label = {(buff),(buff),(buff)+(size)-1} |
Initialize from a NUL terminated string pointer Uses non-standard ANSI extensions: non-const initializers.
tchar | Template: type of string we're working with | |
buff | Externally declared buffer to parse into | |
size | Length of that buffer in characters | |
label | What to call this instance |
#define ctl_fstring_begin | ( | tchar, | |||
self | ) | ( (self)->begin ) |
#define ctl_fstring_destroy | ( | tchar, | |||
self | ) |
#define ctl_fstring_end | ( | tchar, | |||
self | ) | ( (self)->end ) |
#define ctl_fstring_fill | ( | tchar, | |||
self, | |||||
fillVal, | |||||
count | ) | ctl_mstring_(tchar,fixed, fill )((self), (fillVal), (count) ) |
#define ctl_fstring_filltab | ( | tchar, | |||
self, | |||||
fillVal, | |||||
tabPos | ) | ctl_mstring_(tchar,fixed, filltab )((self), (fillVal), (tabPos) ) |
Fill to some tab position with a given number of characters.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
fillVal | Fill character value to repeat | |
tabPos | If this is 10, and parse is <10 chars from begin, this will fill up to 10 |
#define ctl_fstring_foreach | ( | tchar, | |||
self, | |||||
iterator | ) |
Value:
tchar* iterator = (self)->begin;\ tchar* ppConcat(end_,iterator) = (self)->end;\ for( ; iterator < ppConcat(end_,iterator); ++iterator )
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
iterator | What to call the iterator |
#define ctl_fstring_foreach_reverse | ( | tchar, | |||
self, | |||||
iterator | ) |
Value:
tchar* iterator = (self)->end;\ tchar* ppConcat(end_,iterator) = (self)->begin;\ while( iterator-- < ppConcat(end_,iterator) )
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
iterator | What to call the iterator |
#define ctl_fstring_init | ( | tchar, | |||
self, | |||||
buff, | |||||
len | ) |
Value:
{\ (self)->begin = (self)->end = (buff);\ (self)->endBuff = (self)->begin + (len)-1;\ *(self)->begin = *(self)->endBuff = 0;\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
buff | Externally declared buffer to parse into | |
len | Length of that buffer |
#define ctl_fstring_init_sz | ( | tchar, | |||
self, | |||||
sz | ) |
Value:
{\ (self)->begin = (self)->end = (buff);\ (self)->endBuff = (self)->begin + (len);\ ctl_fstring_strcpy(tchar, (self), (sz) );\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
sz | Pointer to a string |
#define ctl_fstring_makeClabel | ( | tchar, | |||
self | ) | ctl_mstring_(tchar,fixed, makeClabel )( (self) ) |
#define ctl_fstring_maxsize | ( | tchar, | |||
self | ) | ((size_t)( (self)->endBuff - (self)->begin )) |
Tell how many total characters can be put in the string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
Definition at line 140 of file fstring.h.
Referenced by char_serial_read_fstring(), and wchar_t_serial_read_fstring().
#define ctl_fstring_move | ( | tchar, | |||
p1, | |||||
p2 | ) |
Value:
{\ (p1)->begin = (p2)->begin;\ (p1)->end = (p2)->end;\ (p1)->endBuff = (p2)->endBuff;\ (p2)->begin = (p2)->end = (p2)->endBuff = NULL;\ }
tchar | Template: type of string we're working with | |
p1 | String to end up with contents of p2 | |
p2 | String to end up with contents of p1 |
#define ctl_fstring_putbool | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"true") : szconst(tchar,"false"), ~0u ) |
#define ctl_fstring_putbool10 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"1") : szconst(tchar,"0"), ~0u ) |
#define ctl_fstring_putboolonoff | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"on") : szconst(tchar,"off"), ~0u ) |
#define ctl_fstring_putboolyesno | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, strncat )((self),(value) ? szconst(tchar,"yes") : szconst(tchar,"no"), ~0u ) |
#define ctl_fstring_putenum | ( | tchar, | |||
self, | |||||
value, | |||||
szzList, | |||||
szUndefined | ) | ctl_mstring_(tchar,fixed, putenum )((self),(value),(szzList), countof(szzList),(szUndefined) ) |
Write an enumerated value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
value | Value to write | |
szzList | A NULL terminated list of strings to apply | |
szUndefined | A(default) value to write when the passed value is out of range |
#define ctl_fstring_putenum_max | ( | tchar, | |||
self, | |||||
value, | |||||
szzList, | |||||
max, | |||||
szUndefined | ) | ctl_mstring_(tchar,grow, putenum )((self),(value),(szzList), (max), (szUndefined) ) |
Write an enumerated value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
value | Value to write | |
szzList | A NULL terminated list of strings to apply | |
max | A known maximum for the length of szzList, so we don't have to count. | |
szUndefined | A (default) value to write when the passed value is out of range |
#define ctl_fstring_putfloat32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putfloat64 )((self),(value) ) |
#define ctl_fstring_putfloat64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putfloat64 )((self),(value) ) |
#define ctl_fstring_putint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putint32 )((self),(int32)(int16)(value) ) |
#define ctl_fstring_putint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putint32 )((self),(value) ) |
#define ctl_fstring_putint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putint64 )((self),(value) ) |
#define ctl_fstring_putint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putint32 )((self),(int32)(int8)(value) ) |
#define ctl_fstring_putuint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putuint32 )((self),(uint32)(uint16)(value) ) |
#define ctl_fstring_putuint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putuint32 )((self),(value) ) |
#define ctl_fstring_putuint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putuint64 )((self),(value) ) |
#define ctl_fstring_putuint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putuint32 )((self),(uint32)(uint8)(value) ) |
#define ctl_fstring_putxint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 4 ) |
#define ctl_fstring_putxint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 8 ) |
#define ctl_fstring_putxint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint64 )((self),(uint32)(value), 16 ) |
#define ctl_fstring_putxint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 2 ) |
#define ctl_fstring_putxuint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint32 )((self),(value), 4 ) |
#define ctl_fstring_putxuint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint32 )((self),(value), 8 ) |
#define ctl_fstring_putxuint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint64 )((self),(value), 16 ) |
#define ctl_fstring_putxuint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,fixed, putxuint32 )((self),(uint32)(value), 2 ) |
#define ctl_fstring_remain | ( | tchar, | |||
self | ) | ( (self)->endBuff - (self)->end ) |
#define ctl_fstring_reset | ( | tchar, | |||
self | ) | ( *((self)->end = (self)->begin) = 0 ) |
#define ctl_fstring_size | ( | tchar, | |||
self | ) | ((size_t)( (self)->end - (self)->begin )) |
#define ctl_fstring_sprintf | ( | tchar, | |||
selffmtargs | ) | ctl_mstring_(tchar,fixed, sprintf ) selffmtargs |
Add/overwrite text at parse ala sprintf formatting arguments.
tchar | Template: type of string we're working with | |
selffmtargs | Wrap selffmtargs in their own parentheses to group them, then pass them in, like certain macro implementations of trace |
#define ctl_fstring_strcat | ( | tchar, | |||
self, | |||||
sz | ) | ctl_mstring_(tchar,fixed, strncat )((self),(sz), ~0u ) |
#define ctl_fstring_strcpy | ( | tchar, | |||
self, | |||||
sz | ) | ctl_mstring_(tchar,fixed, strncpy )((self),(sz), ~0u ) |
#define ctl_fstring_strinsert | ( | tchar, | |||
self, | |||||
position, | |||||
sz | ) | ctl_mstring_(tchar,fixed, strninsert )((self),(position),(sz), 0u ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
position | Where to insert | |
sz | String to replace this with |
#define ctl_fstring_strncat | ( | tchar, | |||
self, | |||||
sz, | |||||
maxLen | ) | ctl_mstring_(tchar,fixed, strncat )((self),(sz),(maxLen) ) |
#define ctl_fstring_strncpy | ( | tchar, | |||
self, | |||||
sz, | |||||
maxLen | ) | ctl_mstring_(tchar,fixed, strncpy )((self),(sz),(maxLen) ) |
Copy another string on top of this, setting the parse point and end after sz.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
sz | String to replace this with | |
maxLen | Maximum count of characters to take from sz |
#define ctl_fstring_strninsert | ( | tchar, | |||
self, | |||||
position, | |||||
sz, | |||||
maxLen | ) | ctl_mstring_(tchar,fixed, strninsert )((self),(position),(sz),(maxLen) ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
position | Where to insert | |
sz | String to replace this with | |
maxLen | Maximum count of characters to take from sz |
#define ctl_fstring_swap | ( | tchar, | |||
p1, | |||||
p2 | ) |
Value:
{\ ctl_fstring(tchar) tmp = *(p1);\ *(p1) = *(p2);\ *(p2) = tmp;\ }
tchar | Template: type of string we're working with | |
p1 | String to end up with contents of p2 | |
p2 | String to end up with contents of p1 |
#define ctl_fstring_truncate | ( | tchar, | |||
self, | |||||
newsize | ) | ctl_mstring_(tchar,fixed, truncate )( (self), (newsize) ) |
#define ctl_fstring_vsprintf | ( | tchar, | |||
self, | |||||
fmt, | |||||
args | ) | ctl_mstring_(tchar,fixed, vsprintf )((self),(fmt),(args) ) |
Add/overwrite text at parse ala vsprintf formatting arguments.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
fmt | Printf string format argument | |
args | Arguments to the printf, ala stdarg.h/vsprintf |
#define ctl_gstring | ( | tchar | ) | ctl_mstring(tchar,grow) |
This is the mutable string that stays the same size When you hit the limit imposed at instantiation, that's all you ever get.
tchar | Template: type of string we're working with |
Definition at line 24 of file gstring.h.
Referenced by ctl_xmlwrite_string_char(), ctl_xmlwrite_string_wchar_t(), and wchar_t_xml_read_string().
#define ctl_gstring_add | ( | tchar, | |||
self, | |||||
ch | ) | ctl_mstring_(tchar,grow, fill )((self), (ch), 1 ) |
Fill string at parse point with a given number of characters.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
ch | Character to append |
Definition at line 187 of file gstring.h.
Referenced by ctl_xmlread_getname(), ctl_xmlwrite_string_char(), ctl_xmlwrite_string_wchar_t(), wchar_t_xml_read_gstring(), and wchar_t_xml_read_string().
#define ctl_gstring_auto | ( | tchar, | |||
label | ) | ctl_mstring(tchar,grow) label = {(tchar*)ctl_mstring_(tchar,grow,0),(tchar*)ctl_mstring_(tchar,grow,0),(tchar*)ctl_mstring_(tchar,grow,0)} |
#define ctl_gstring_begin | ( | tchar, | |||
self | ) | ( (self)->begin ) |
#define ctl_gstring_compare | ( | tchar, | |||
p1, | |||||
p2 | ) | ctl_mstring_(tchar,grow, compare )( p1, p2 ) |
#define ctl_gstring_destroy | ( | tchar, | |||
self | ) |
Value:
{\ if( (self)->begin != ctl_mstring_(tchar,grow,0) ) \ ctl_free((self)->begin); \ (self)->begin = (self)->endBuff = (self)->end = (tchar*)ctl_mstring_(tchar,grow,0);\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
Definition at line 35 of file gstring.h.
Referenced by ctl_xmlwrite_string_char(), ctl_xmlwrite_string_wchar_t(), and wchar_t_xml_read_string().
#define ctl_gstring_end | ( | tchar, | |||
self | ) | ( (self)->end ) |
#define ctl_gstring_fill | ( | tchar, | |||
self, | |||||
fillVal, | |||||
count | ) | ctl_mstring_(tchar,grow, fill )((self), (fillVal), (count) ) |
#define ctl_gstring_filltab | ( | tchar, | |||
self, | |||||
fillVal, | |||||
tabPos | ) | ctl_mstring_(tchar,grow, filltab )((self), (fillVal), (tabPos) ) |
Fill to some tab position with a given number of characters.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
fillVal | Fill character value to repeat | |
tabPos | If this is 10, and parse is <10 chars from begin, this will fill up to 10 |
#define ctl_gstring_foreach | ( | tchar, | |||
self, | |||||
iterator | ) |
Value:
tchar* iterator = (self)->begin;\ tchar* ppConcat(end_,iterator) = (self)->end;\ for( ; iterator < ppConcat(end_,iterator); ++iterator )
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
iterator | What to call the iterator |
#define ctl_gstring_foreach_reverse | ( | tchar, | |||
self, | |||||
iterator | ) |
Value:
tchar* iterator = (self)->end;\ tchar* ppConcat(end_,iterator) = (self)->begin;\ while( iterator-- < ppConcat(end_,iterator) )
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
iterator | What to call the iterator |
#define ctl_gstring_init | ( | tchar, | |||
self | ) | (self)->begin = (self)->end = (self)->endBuff = (tchar*)ctl_mstring_(tchar,grow,0)\ |
Initialize from a NUL terminated string pointer.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
Definition at line 58 of file gstring.h.
Referenced by ctl_xmlwrite_string_char(), ctl_xmlwrite_string_wchar_t(), and wchar_t_xml_read_string().
#define ctl_gstring_init_cstring | ( | tchar, | |||
self, | |||||
cstr | ) |
Value:
{\ (self)->begin = (self)->end = (self)->endBuff = (tchar*)ctl_mstring_(tchar,grow,0);\ ctl_gstring_strncpy(tchar, (self), (cstr)->begin, (cstr)->end-(cstr)->begin );\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
cstr | Pointer to a const string to initialize from |
#define ctl_gstring_init_sz | ( | tchar, | |||
self, | |||||
sz | ) |
Value:
{\ (self)->begin = (self)->end = (self)->endBuff = (tchar*)ctl_mstring_(tchar,grow,0);\ ctl_gstring_strcpy(tchar, (self), (sz) );\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
sz | Pointer to a string |
#define ctl_gstring_makeClabel | ( | tchar, | |||
self | ) | ctl_mstring_(tchar,grow, makeClabel )( (self) ) |
#define ctl_gstring_move | ( | tchar, | |||
p1, | |||||
p2 | ) |
Value:
{\ (p1)->begin = (p2)->begin;\ (p1)->end = (p2)->end;\ (p1)->endBuff = (p2)->endBuff;\ (p2)->begin = (p2)->end = (p2)->endBuff = NULL;\ }
tchar | Template: type of string we're working with | |
p1 | String to end up with contents of p2 | |
p2 | String to end up with contents of p1 |
#define ctl_gstring_putbool | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"true") : szconst(tchar,"false"), ~0u ) |
#define ctl_gstring_putbool10 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"1") : szconst(tchar,"0"), ~0u ) |
#define ctl_gstring_putboolonoff | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"on") : szconst(tchar,"off"), ~0u ) |
#define ctl_gstring_putboolyesno | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, strncat )((self),(value) ? szconst(tchar,"yes") : szconst(tchar,"no"), ~0u ) |
#define ctl_gstring_putenum | ( | tchar, | |||
self, | |||||
value, | |||||
szzList, | |||||
szUndefined | ) | ctl_mstring_(tchar,grow, putenum )((self),(value),(szzList), countof(szzList),(szUndefined) ) |
Write an enumerated value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
value | Value to write | |
szzList | A NULL terminated list of strings to apply; assumes this is fully qualified with its length | |
szUndefined | A (default) value to write when the passed value is out of range |
#define ctl_gstring_putenum_max | ( | tchar, | |||
self, | |||||
value, | |||||
szzList, | |||||
max, | |||||
szUndefined | ) | ctl_mstring_(tchar,grow, putenum )((self),(value),(szzList), (max), (szUndefined) ) |
Write an enumerated value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
value | Value to write | |
szzList | A NULL terminated list of strings to apply | |
max | A known maximum for the length of szzList, so we don't have to count. | |
szUndefined | A (default) value to write when the passed value is out of range |
#define ctl_gstring_putfloat32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putfloat64 )((self),(value) ) |
#define ctl_gstring_putfloat64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putfloat64 )((self),(value) ) |
#define ctl_gstring_putint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putint32 )((self),(int32)(int16)(value) ) |
#define ctl_gstring_putint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putint32 )((self),(value) ) |
#define ctl_gstring_putint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putint64 )((self),(value) ) |
#define ctl_gstring_putint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putint32 )((self),(int32)(int8)(value) ) |
#define ctl_gstring_putuint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putuint32 )((self),(uint32)(uint16)(value) ) |
#define ctl_gstring_putuint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putuint32 )((self),(value) ) |
#define ctl_gstring_putuint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putuint64 )((self),(value) ) |
#define ctl_gstring_putuint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putuint32 )((self),(uint32)(uint8)(value) ) |
#define ctl_gstring_putxint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 4 ) |
#define ctl_gstring_putxint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 8 ) |
Write a value as a hexadecimal number.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
value | Value to write |
Definition at line 350 of file gstring.h.
Referenced by ctl_xmlwrite_string_wchar_t().
#define ctl_gstring_putxint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint64 )((self),(uint32)(value), 16 ) |
#define ctl_gstring_putxint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 2 ) |
#define ctl_gstring_putxuint16 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint32 )((self),(value), 4 ) |
#define ctl_gstring_putxuint32 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint32 )((self),(value), 8 ) |
#define ctl_gstring_putxuint64 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint64 )((self),(value), 16 ) |
#define ctl_gstring_putxuint8 | ( | tchar, | |||
self, | |||||
value | ) | ctl_mstring_(tchar,grow, putxuint32 )((self),(uint32)(value), 2 ) |
#define ctl_gstring_rcompare | ( | tchar, | |||
p1, | |||||
p2 | ) | ctl_mstring_(tchar,grow, rcompare )( p1, p2 ) |
#define ctl_gstring_remain | ( | tchar, | |||
self | ) | ( (self)->endBuff - (self)->end ) |
#define ctl_gstring_reset | ( | tchar, | |||
self | ) | { if( (self)->begin != ctl_mstring_(tchar,grow,0) ) { (self)->end = (self)->begin; *(self)->begin = 0; } } |
Reset parse point to beginning.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
Definition at line 141 of file gstring.h.
Referenced by ctl_xmlread_getattribute(), ctl_xmlread_getcontent(), ctl_xmlread_getname(), ctl_xmlread_gettextafter(), ctl_xmlread_gettextbefore(), and wchar_t_xml_read_gstring().
#define ctl_gstring_resize | ( | tchar, | |||
self, | |||||
count | ) | { ctl_mstring_(tchar,grow, grow )( (self), (count) - ((self)->end-(self)->begin) ); *((self)->end = (self)->begin+(count)) = 0; } |
Grow or shrink a string, in preparation for some external copy/operation.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
count | Character count to grow to |
Definition at line 168 of file gstring.h.
Referenced by char_record_read_gstring(), char_serial_read_gstring(), char_xml_read_gstring(), wchar_t_record_read_gstring(), and wchar_t_serial_read_gstring().
#define ctl_gstring_size | ( | tchar, | |||
self | ) | ((size_t)( (self)->end - (self)->begin )) |
Tell how many characters are in the string, right now.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
Definition at line 132 of file gstring.h.
Referenced by char_record_size_gstring(), ctl_xmlread_string(), ctl_xmlwrite_string_char(), and wchar_t_record_size_gstring().
#define ctl_gstring_sprintf | ( | tchar, | |||
selffmtargs | ) | ctl_mstring_(tchar,grow, sprintf ) selffmtargs |
Add/overwrite text at parse ala sprintf formatting arguments.
tchar | Template: type of string we're working with | |
selffmtargs | Wrap selffmtargs in their own parentheses to group them, then pass them in, like certain macro implementations of trace |
#define ctl_gstring_strcat | ( | tchar, | |||
self, | |||||
sz | ) | ctl_mstring_(tchar,grow, strncat )((self),(sz), ~0u ) |
Concatenate a string onto this at parse.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
sz | String to concatenate |
Definition at line 427 of file gstring.h.
Referenced by ctl_xmlwrite_string_char(), and ctl_xmlwrite_string_wchar_t().
#define ctl_gstring_strcpy | ( | tchar, | |||
self, | |||||
sz | ) | ctl_mstring_(tchar,grow, strncpy )((self),(sz), ~0u ) |
#define ctl_gstring_strinsert | ( | tchar, | |||
self, | |||||
position, | |||||
sz | ) | ctl_mstring_(tchar,grow, strninsert )((self),(position),(sz), 0u ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
position | Where to insert | |
sz | String to replace this with |
#define ctl_gstring_strncat | ( | tchar, | |||
self, | |||||
sz, | |||||
maxLen | ) | ctl_mstring_(tchar,grow, strncat )((self),(sz),(maxLen) ) |
#define ctl_gstring_strncpy | ( | tchar, | |||
self, | |||||
sz, | |||||
maxLen | ) | ctl_mstring_(tchar,grow, strncpy )((self),(sz),(maxLen) ) |
Copy another string on top of this, setting the parse point and end after sz.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
sz | String to replace this with | |
maxLen | Maximum count of characters to take from sz |
Definition at line 456 of file gstring.h.
Referenced by ctl_xmlread_string().
#define ctl_gstring_strninsert | ( | tchar, | |||
self, | |||||
position, | |||||
sz, | |||||
maxLen | ) | ctl_mstring_(tchar,grow, strninsert )((self),(position),(sz),(maxLen) ) |
Insert a string at parse; anything between 'position' and 'parse' is maintained AFTER inserted string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
position | Where to insert | |
sz | String to replace this with | |
maxLen | Maximum count of characters to take from sz |
#define ctl_gstring_swap | ( | tchar, | |||
p1, | |||||
p2 | ) |
Value:
{\ ctl_gstring(tchar) tmp = *(p1);\ *(p1) = *(p2);\ *(p2) = tmp;\ }
tchar | Template: type of string we're working with | |
p1 | String to end up with contents of p2 | |
p2 | String to end up with contents of p1 |
#define ctl_gstring_truncate | ( | tchar, | |||
self, | |||||
newsize | ) | ctl_mstring_(tchar,grow, truncate )( (self), (newsize) ) |
#define ctl_gstring_vsprintf | ( | tchar, | |||
self, | |||||
fmt, | |||||
args | ) | ctl_mstring_(tchar,grow, vsprintf )((self),(fmt),(args) ) |
Add/overwrite text at parse ala vsprintf formatting arguments.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
fmt | Printf string format argument | |
args | Arguments to the printf, ala stdarg.h |
#define ctl_mstring | ( | tchar, | |||
handler | ) | ppConcat4(ctl_mstring_,tchar,_,handler) |
#define ctl_mstring_ | ( | tchar, | |||
handler, | |||||
function | ) | ppConcat3(ctl_mstring(tchar,handler),_,function) |
#define ctl_sconst | ( | tchar | ) | ppConcat(ctl_sconst_,tchar) |
Get class name from base name and character type.
tchar | Character type |
Definition at line 24 of file cstring.h.
Referenced by char_xml_read_gstring(), char_xml_read_string(), ctl_xmlread_getattribute(), ctl_xmlread_getattribute_int(), raw_xml_readbytes(), wchar_t_xml_read_gstring(), and wchar_t_xml_read_string().
#define ctl_sconst_ | ( | tchar, | |||
function | ) | ppConcat3(ctl_sconst( tchar ),_,function) |
#define ctl_sconst_auto | ( | tchar, | |||
begin, | |||||
end, | |||||
label | ) | ctl_sconst( tchar ) label = { (begin), (begin), (end) } |
Make fixed string operator on stack or as a global, with begin/end pointers Uses non-standard ANSI extension: non-const initializers.
tchar | Template: type of string we're working with | |
begin | First valid character in string | |
end | One place after the last valid character in the string, and not necessarily NUL | |
label | What to call this instance |
#define ctl_sconst_auto_buff | ( | tchar, | |||
buff, | |||||
len, | |||||
label | ) | ctl_sconst( tchar ) label = { (buff), (buff), (buff)+cstrnlen(tchar)((buff),(len)) } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers.
tchar | Template: type of string we're working with | |
buff | Const pointer to a buffer containing const string data | |
len | size_t length of buff | |
label | What to call this instance |
#define ctl_sconst_auto_mmap | ( | tchar, | |||
mmap, | |||||
label | ) | ctl_sconst( tchar ) label = { (const tchar*)ctl_mmap_ptr(mmap), (const tchar*)ctl_mmap_ptr(mmap), (const tchar*)ctl_mmap_ptr(mmap)+ctl_mmap_size(mmap) } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers.
tchar | Template: type of string we're working with | |
mmap | A memory mapped file that's been loaded up | |
label | What to call this instance |
#define ctl_sconst_auto_string | ( | tchar, | |||
mstr, | |||||
label | ) | ctl_sconst( tchar ) label = { (mstr)->begin, (mstr)->begin, (mstr)->end } |
Make fixed string operator on stack or as a global, with buffer Uses non-standard ANSI extension: non-const initializers.
tchar | Template: type of string we're working with | |
mstr | Pointer to another compatible string with begin/end (gstring/fstring/cstring) to initialize from | |
label | What to call this instance |
#define ctl_sconst_auto_sz | ( | tchar, | |||
sz, | |||||
label | ) | ctl_sconst( tchar ) label = { (sz), (sz), (sz)+cstrlen(tchar)((sz)) } |
#define ctl_sconst_begin | ( | tchar, | |||
self | ) | ( (self)->begin ) |
#define ctl_sconst_compare | ( | tchar, | |||
p1, | |||||
p2 | ) | ctl_sconst_(tchar,compare)( (p1),(p2) ) |
#define ctl_sconst_consumed | ( | tchar, | |||
self | ) | ( (self)->parse - (self)->begin ) |
#define ctl_sconst_copy | ( | tchar, | |||
self, | |||||
from | ) |
Value:
{\ (self)->begin = (from)->begin;\ (self)->parse = (from)->parse;\ (self)->end = (from)->end;\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
from | Instance to copy |
#define ctl_sconst_dmatch | ( | tchar, | |||
self, | |||||
substring, | |||||
chOpen, | |||||
chClose | ) | ctl_sconst_(tchar,dmatch)( self, substring, chOpen, chClose ) |
Search for a block of text enclosed by two symbols, such as (), {} or [] The depth of opening types is matched to the depth of closing types.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
substring | A ctl_sconst to receive the bounds of the discovered string | |
chOpen | The opening character | |
chClose | The closing character |
#define ctl_sconst_dmatchstr | ( | tchar, | |||
self, | |||||
substring, | |||||
szOpen, | |||||
szClose | ) | ctl_sconst_(tchar,dmatchstr)( self, substring, szOpen, szClose ) |
Search for a block of text enclosed by two strings, such as "<",/>" "begin","end".
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
substring | A ctl_sconst to receive the bounds of the discovered string | |
szOpen | The opening string | |
szClose | The closing string |
#define ctl_sconst_end | ( | tchar, | |||
self | ) | ( (self)->end ) |
#define ctl_sconst_findclass | ( | tchar, | |||
self, | |||||
classname | ) | ctl_sconst_(tchar,ppConcat(find_,classname))( self ) |
Find the next instance of a character class ala ctype.h.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
classname | One of: isalnum, isalpha, iscntrl... or just see DEF_Supported_Class_Scans for a list of generated scans |
#define ctl_sconst_findnotclass | ( | tchar, | |||
self, | |||||
classname | ) | ctl_sconst_(tchar,ppConcat(find_not_,classname))( self ) |
Find the next instance that is not of a character class ala ctype.h.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
classname | One of: isalnum, isalpha, iscntrl... or just see DEF_Supported_Class_Scans for a list of generated scans |
#define ctl_sconst_foreach | ( | tchar, | |||
self, | |||||
iterator | ) |
Value:
const tchar* iterator = (self)->begin;\ const tchar* ppConcat(end_,iterator) = (self)->end;\ for( ; iterator < ppConcat(end_,iterator); ++iterator )
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
iterator | What to call the iterator |
Definition at line 1005 of file cstring.h.
Referenced by wchar_t_xml_read_gstring(), and wchar_t_xml_read_string().
#define ctl_sconst_foreach_reverse | ( | tchar, | |||
self, | |||||
iterator | ) |
Value:
const tchar* iterator = (self)->end;\ const tchar* ppConcat(end_,iterator) = (self)->begin;\ while( iterator-- < ppConcat(end_,iterator) )
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on(like 'this' in C++) | |
iterator | What to call the iterator |
#define ctl_sconst_from_ctlfixed | ( | tchar, | |||
self, | |||||
fixed | ) |
Value:
{\ (self)->parse = (self)->begin = (fixed)->begin;\ (self)->end = (fixed)->end;\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
fixed | Fixed (buffered) string we're referencing |
#define ctl_sconst_from_ctlstring | ( | tchar, | |||
self, | |||||
variable | ) |
Value:
{\ (self)->parse = (self)->begin = (variable)->begin;\ (self)->end = (self)->begin + (variable)->(len);\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
variable | Variable length string we're referencing (This may become invalid if variable string is changed!) |
#define ctl_sconst_getbool | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getbool)( self, pValue ) |
Decode a boolean; any decimal number, true/on, false/off will do.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getenum | ( | tchar, | |||
self, | |||||
pValue, | |||||
szz | ) | ctl_sconst_(tchar,getenum)( self, pValue, szz ) |
Decode one of a set of possible strings to an index into that set.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to integer to receive the value | |
szz | A NULL terminated array of string pointers to match against |
#define ctl_sconst_getfloat32 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getfloat32)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getfloat64 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getfloat64)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getienum | ( | tchar, | |||
self, | |||||
pValue, | |||||
szz | ) | ctl_sconst_(tchar,getienum)( self, pValue, szz ) |
Decode one of a set of possible strings to an index into that set, case insensitive.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to integer to receive the value | |
szz | A NULL terminated array of string pointers to match against |
#define ctl_sconst_getint16 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getint16)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getint32 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getint32)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
Definition at line 702 of file cstring.h.
Referenced by ctl_xmlread_getattribute_int().
#define ctl_sconst_getint64 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getint64)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getint8 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getint8)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getuint16 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getuint16)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getuint32 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getuint32)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getuint64 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getuint64)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getuint8 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getuint8)( self, pValue ) |
Decode a value.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxbool | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar,getbool)( self, pValue ) |
Decode an 8 bit hexadecimal value, stopping at 2 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxint16 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxint16 )( self, pValue ) |
Decode a 16 bit hexadecimal value, stopping at 4 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxint32 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxuint32 )( self, (uint32*)(pValue), 8 ) |
Decode a 32 bit hexadecimal value, stopping at 8 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxint64 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxuint64 )( self, (uint64*)(pValue), 16 ) |
Decode a 64 bit hexadecimal value, stopping at 16 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxint8 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxint8 )( self, pValue ) |
Decode an 8 bit hexadecimal value, stopping at 2 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxn | ( | tchar, | |||
self, | |||||
pValue, | |||||
numDigits | ) | ctl_sconst_(tchar, getx64 )( self, pValue, numDigits ) |
Decode a hexadecimal value up to 32 bits (8 digits), limiting to some arbitrary number of places of precision Useful for places where we simply append hexadecimal data together at fixed widths.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to uint32 variable to receive value | |
numDigits | Number of digits to stop after; i.e. 4 if you only want 16 bits |
#define ctl_sconst_getxnn | ( | tchar, | |||
self, | |||||
pValue, | |||||
numDigits | ) | ctl_sconst_(tchar, getx64 )( self, pValue, numDigits ) |
Decode a hexadecimal value up to 64 bits (16 digits), limiting to some arbitrary number of places of precision Useful for places where we simply append hexadecimal data together at fixed widths.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to uint64 variable to receive value | |
numDigits | Number of digits to stop after; i.e. 4 if you only want 16 bits |
#define ctl_sconst_getxuint16 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxuint16 )( self, pValue ) |
Decode a 16 bit hexadecimal value, stopping at 4 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxuint32 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxuint32 )( self, pValue, 8 ) |
Decode a 32 bit hexadecimal value, stopping at 8 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxuint64 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxuint64 )( self, pValue, 16 ) |
Decode a 64 bit hexadecimal value, stopping at 16 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
#define ctl_sconst_getxuint8 | ( | tchar, | |||
self, | |||||
pValue | ) | ctl_sconst_(tchar, getxuint8 )( self, pValue ) |
Decode an 8 bit hexadecimal value, stopping at 2 digits.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pValue | Pointer to variable to receive value |
Definition at line 783 of file cstring.h.
Referenced by raw_xml_readbytes().
#define ctl_sconst_icompare | ( | tchar, | |||
self, | |||||
other | ) | ctl_sconst_(tchar,icompare)( (self), (other) ) |
#define ctl_sconst_init | ( | tchar, | |||
self, | |||||
buff, | |||||
len | ) |
Value:
{\ (self)->parse = (self)->begin = (buff);\ (self)->end = (self)->begin + cstrnlen(tchar)((buff),(len));\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
buff | Pointer to a string buffer | |
len | size_t length of buff |
#define ctl_sconst_init_mmap | ( | tchar, | |||
self, | |||||
mmap | ) |
Value:
{\ (self)->parse = (self)->begin = (const tchar*)ctl_mmap_ptr(mmap);\ (self)->end = (self)->begin + ctl_mmap_size(mmap);\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
mmap | Pointer to a memory mapped file that's been loaded up |
#define ctl_sconst_init_pointers | ( | tchar, | |||
self, | |||||
pBegin, | |||||
pEnd | ) |
Value:
{\ (self)->parse = (self)->begin = (pBegin);\ (self)->end = (pEnd);\ assert( (self)->end >= (self)->begin );\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
pBegin | Start pointer | |
pEnd | End pointer |
Definition at line 169 of file cstring.h.
Referenced by char_serial_peek_sconst(), char_serial_read_sconst(), wchar_t_serial_peek_sconst(), and wchar_t_serial_read_sconst().
#define ctl_sconst_init_sz | ( | tchar, | |||
self, | |||||
sz | ) |
Value:
{\ (self)->parse = (self)->begin = (sz);\ (self)->end = (self)->begin + cstrlen(tchar)(sz);\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
sz | Pointer to a string |
#define ctl_sconst_isalnum | ( | tchar, | |||
self | ) | ( cisalnum(tchar)(*(self)->parse) ) |
#define ctl_sconst_isalpha | ( | tchar, | |||
self | ) | ( cisalpha(tchar)(*(self)->parse) ) |
#define ctl_sconst_iscntrl | ( | tchar, | |||
self | ) | ( ciscntrl(tchar)(*(self)->parse) ) |
#define ctl_sconst_isdigit | ( | tchar, | |||
self | ) | ( cisdigit(tchar)(*(self)->parse) ) |
#define ctl_sconst_isgraph | ( | tchar, | |||
self | ) | ( cisgraph(tchar)(*(self)->parse) ) |
#define ctl_sconst_islower | ( | tchar, | |||
self | ) | ( cislower(tchar)(*(self)->parse) ) |
#define ctl_sconst_isprint | ( | tchar, | |||
self | ) | ( cisprint(tchar)(*(self)->parse) ) |
#define ctl_sconst_ispunct | ( | tchar, | |||
self | ) | ( cispunct(tchar)(*(self)->parse) ) |
#define ctl_sconst_isspace | ( | tchar, | |||
self | ) | ( cisspace(tchar)(*(self)->parse) ) |
#define ctl_sconst_isupper | ( | tchar, | |||
self | ) | ( cisupper(tchar)(*(self)->parse) ) |
#define ctl_sconst_isxdigit | ( | tchar, | |||
self | ) | ( cisxdigit(tchar)(*(self)->parse) ) |
#define ctl_sconst_left | ( | tchar, | |||
self, | |||||
cstr_left, | |||||
count | ) |
Value:
{\ (cstr_left)->begin = (cstr_left)->parse = (self)->(begin);\ (cstr_left)->end = (cstr_left)->begin + (count);\ if( (cstr_left)->end > (self)->end )\ (cstr_left)->end = (self)->end;\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
cstr_left | Substring to receive pointers | |
count | Number of characters from left end of 'self' to initialize 'left' with |
#define ctl_sconst_mid | ( | tchar, | |||
self, | |||||
cstr_mid, | |||||
offset, | |||||
count | ) |
Value:
{\ (cstr_mid)->begin = (cstr_mid)->parse = (self)->begin + (offset);\ (cstr_mid)->end = (cstr_mid)->begin + (count);\ if( (cstr_mid)->begin > (self)->end )\ {\ (cstr_mid)->begin = (self)->end;\ (cstr_mid)->end = (self)->end;\ }\ if( (cstr_mid)->end > (self)->end )\ (cstr_mid)->end = (self)->end;\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
cstr_mid | Substring to receive pointers | |
offset | 0 based start index of data | |
count | Number of characters from left end of 'self' to initialize 'left' with |
#define ctl_sconst_next | ( | tchar, | |||
self | ) | ( (self)->parse < (self)->end ? (++(self)->parse) : (self)->end ) |
#define ctl_sconst_nextspace | ( | tchar, | |||
self | ) | ctl_sconst_(tchar,nextspace)( self ) |
Skip over any NON-white space until we find a space.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
#define ctl_sconst_parse | ( | tchar, | |||
self | ) | ( (self)->parse ) |
#define ctl_sconst_prev | ( | tchar, | |||
self | ) | ( (self)->parse > (self)->begin ? (--(self)->parse) : (self)->begin ) |
#define ctl_sconst_printf_arg | ( | self | ) | ((self)->end - (self)->begin), (self)->begin |
Printf arguments for ctl_sconst_printf_fmt.
self | Instance of string we're operating on (like 'this' in C++) Example: printf( szconst(char,"Hello ") ctl_sconst_printf_fmt(char) szconst(char,"!\n"), ctl_sconst_printf_arg(str) ); |
#define ctl_sconst_printf_fmt | ( | tchar | ) | szconst(tchar,"%.*s") |
Printf format string for ctl_sconst_printf_arg.
tchar | Template: type of string we're working with Example: printf( szconst(char,"Hello ") ctl_sconst_printf_fmt(char) szconst(char,"!\n"), ctl_sconst_printf_arg(str) ); |
#define ctl_sconst_rcompare | ( | tchar, | |||
p1, | |||||
p2 | ) | ctl_sconst_(tchar,compare)( (p2),(p1) ) |
#define ctl_sconst_remain | ( | tchar, | |||
self | ) | ( (self)->end - (self)->parse ) |
#define ctl_sconst_reset | ( | tchar, | |||
self | ) | ( (self)->parse = (self)->begin ) |
#define ctl_sconst_right | ( | tchar, | |||
self, | |||||
cstr_right, | |||||
count | ) |
Value:
{\ (cstr_right)->begin = (cstr_right)->parse = (self)->(end)-(count);\ (cstr_right)->end = (self)->end;\ if( (cstr_right)->begin < (self)->begin )\ (cstr_right)->begin = (self)->begin;\ }
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
cstr_right | Substring to receive pointers | |
count | Number of characters from left end of 'self' to initialize 'left' with |
#define ctl_sconst_scanclass | ( | tchar, | |||
self, | |||||
found, | |||||
classname | ) | ctl_sconst_(tchar,ppConcat(scan_,classname))( self, found ) |
Scan for a block of characters that are of a class type.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
found | If the character class was found, this cstring points to the first and ends with the first NOT (or (self)->end) | |
classname | One of: isalnum, isalpha, iscntrl... or just see DEF_Supported_Class_Scans for a list of generated scans |
#define ctl_sconst_scannotclass | ( | tchar, | |||
self, | |||||
found, | |||||
classname | ) | ctl_sconst_(tchar,ppConcat(scan_not_,classname))( self, found ) |
Scan for a block of characters that are NOT of a class type.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
found | If the non-character class was found, this cstring points to the first and ends with the first NOT (or (self)->end) | |
classname | One of: isalnum, isalpha, iscntrl... or just see DEF_Supported_Class_Scans for a list of generated scans |
#define ctl_sconst_size | ( | tchar, | |||
self | ) | ((size_t)( (self)->end - (self)->begin )) |
Tell how many characters are in the string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
Definition at line 228 of file cstring.h.
Referenced by char_xml_read_gstring(), and char_xml_read_string().
#define ctl_sconst_skipspace | ( | tchar, | |||
self | ) | ctl_sconst_(tchar,skipspace)( self ) |
Skip over any white space.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) |
#define ctl_sconst_strchr | ( | tchar, | |||
self, | |||||
ch | ) | ctl_sconst_(tchar,strchr)( self, ch ) |
Look for a character in a string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
ch | What character we're seeking |
#define ctl_sconst_strcmp | ( | tchar, | |||
self, | |||||
sz | ) | ctl_sconst_(tchar,strcmp)( self, sz ) |
#define ctl_sconst_strichr | ( | tchar, | |||
self, | |||||
ch | ) | ctl_sconst_(tchar,strichr)( self, ch ) |
Look for a character in a string; case insensitive.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
ch | What character we're seeking |
#define ctl_sconst_stricmp | ( | tchar, | |||
self, | |||||
sz | ) | ctl_sconst_(tchar,stricmp)( self, sz ) |
#define ctl_sconst_stristr | ( | tchar, | |||
self, | |||||
sz | ) | ctl_sconst_(tchar,stristr)( self, sz ) |
Look for a string in a string; case insensitive.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
sz | String we're seeking |
#define ctl_sconst_strncmp | ( | tchar, | |||
self, | |||||
sz, | |||||
count | ) | ctl_sconst_(tchar,strncmp)( self, sz, count ) |
#define ctl_sconst_strnicmp | ( | tchar, | |||
self, | |||||
sz, | |||||
count | ) | ctl_sconst_(tchar,strnicmp)( self, sz, count ) |
Do a case insensitive string comparison at parse point.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
sz | String to compare with | |
count | Maximum length of compare |
#define ctl_sconst_strpbrk | ( | tchar, | |||
self, | |||||
szSet | ) | ctl_sconst_(tchar,strpbrk)( self, szSet ) |
Look for any one of the characters in szSet in this string starting at parse point.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
szSet | String containing characters to look for |
#define ctl_sconst_strstr | ( | tchar, | |||
self, | |||||
sz | ) | ctl_sconst_(tchar,strstr)( self, sz ) |
Look for a string in a string.
tchar | Template: type of string we're working with | |
self | Instance of string we're operating on (like 'this' in C++) | |
sz | String we're seeking |
#define ctldecl_ctl_mstring | ( | tchar, | |||
handler | ) |
Base class for ctl_fstring and ctl_string.
tchar | Character type | |
handler | Template: Handler for when added text will exceed current size: fixed or grow. |
This means that the code in all modifying cases will depend on knowing how bit the data will be, when appended, deciding (based on template) to grow or fixed, then performing the operation if it can.
The fixed string method is safe, but if you exceed your predicted requirements, your final string will be truncated.
The grow string method is also safe, and will make strings bigger as data is added to them, but you must *remember to destroy the string* Keep in mind that memory allocation is not free, and that in a busy heap, many cycles can be lost searching for free space to store a string that could've been written into a stack based buffer. Especially if you are leaking strings.
#define ctldecl_ctl_sconst | ( | tchar | ) |
Declare a constant string parser class of functionality.
tchar | Character type |
This is many orders of magnitude faster than conventional string parsing with allocated 'smart' strings.
What it also means is the underlying string should not be changed while an instance of substring is operating on it - it's literally pointing right at the data, and if it's reallocated, freed or modified, it could be pointing at invalid data, or heap space that isn't even valid for reading.
#define DEF_Supported_Class_Scans | ( | tchar, | |||
def | ) |
Value:
def( tchar, isalnum )\ def( tchar, isalpha )\ def( tchar, iscntrl )\ def( tchar, isdigit )\ def( tchar, isgraph )\ def( tchar, islower )\ def( tchar, ispunct )\ def( tchar, isspace )\ def( tchar, isupper )\ def( tchar, isprint )\ def( tchar, isxdigit )
tchar | Character class template passed through to generators | |
def | Filter to generate definitions based on this list |
#define ppCtypeSelect | ( | tchar, | |||
xchar, | |||||
xwchar_t | ) | ppConcat(_ppCtypeSelect_,tchar)(xchar,xwchar_t) |
Make selection logic for character type handler a little more compact.
tchar | Kind of char we want | |
xchar | This is extracted into the preprocessor output if 'tchar' is 'char' | |
xwchar_t | This is extracted into the preprocessor output if 'tchar' is 'wchar_t' |
Definition at line 146 of file ctlstring.h.
#define szconst | ( | tchar, | |||
sz | ) | ppConcat(szconst_,tchar)(sz) |
Make the "correct" kind of string constant by template tchar.
tchar | Type of character | |
sz | string constant |
Definition at line 39 of file ctlstring.h.
Referenced by ctl_profiles_dump_averages_sheet(), ctl_xmlread_init(), ctl_xmlread_next(), ctl_xmlread_rawattribute(), ctl_xmlread_translate_char(), ctl_xmlread_translate_wchar_t(), ctl_xmlwrite_addheader(), ctl_xmlwrite_containertag(), ctl_xmlwrite_endtag(), ctl_xmlwrite_generaltag(), ctl_xmlwrite_newline(), ctl_xmlwrite_string_char(), and ctl_xmlwrite_string_wchar_t().
#define szconvert | ( | tchardst, | |||
tcharsrc | ) | (ch) ppConcat3(szconvert_,tchardst,tcharsrc) |
Convert from wchar_t<->char.
tcharsrc | Type of character ch is | |
tchardst | Type of character ch should become |
Definition at line 50 of file ctlstring.h.
#define szstrfmt | ( | tchar | ) | ppConcat(szstrfmt_,tchar) |
The 'standard' format is for ls when receiving wchar_t strings, and s when receiving char strings.
tchar | Type of character printf is for |
Definition at line 62 of file ctlstring.h.
ctl_mstring_xgrow | ( | tchar | , | |
handler | , | |||
const tchar | ctl_mstring_(tchar, handler, 0)[1] = szconst(tchar,""); | |||
) |
See if the string needs to grow, grow it according to templats
(tchar,handler) Template: type of string we're working with
self Instance of string we're operating on (like 'this' in C++)
addLen How much to grow by
.
Manufacture modifiable string functions based on template parameters tchar Character type handler Template: Handler for when added text will exceed current size: fixed or grow.
bool ctl_sconst_ | ( | tchar | , | |
strchr | ||||
) |
Look for a character in a string tchar Template: type of string we're working with self Instance of string we're operating on (like 'this' in C++) ch What character we're seeking.
bool wchar_t ppConcat | ( | ctl_sconst_ | , | |
wchar_t | ||||
) | [read] |
bool char ppConcat | ( | ctl_sconst_ | , | |
char | ||||
) | [read] |
int fixed const ppConcat4 | ( | ctl_mstring_ | , | |
wchar_t | , | |||
_ | , | |||
fixed | ||||
) | [read] |
int fixed const ppConcat4 | ( | ctl_mstring_ | , | |
char | , | |||
_ | , | |||
fixed | ||||
) | [read] |
int grow const ppConcat4 | ( | ctl_mstring_ | , | |
wchar_t | , | |||
_ | , | |||
grow | ||||
) | [read] |
int grow const ppConcat4 | ( | ctl_mstring_ | , | |
char | , | |||
_ | , | |||
grow | ||||
) | [read] |