gstring.h File Reference

Growing string class. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#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_(tchar)   ctl_mstring_(tchar,grow)
#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.


Detailed Description

Growing string class.

Author:
David Mace
The string class that stretches.

*CAUTION* C++ programmers: There is no such thing as a destructor! You must invoke ctl_gstring_destroy on your strings, or leak, leak, leak!

Definition in file gstring.h.


Define Documentation

#define ctl_gstring_ ( tchar   )     ctl_mstring_(tchar,grow)

Function naming for ctl_gstring members

Definition at line 27 of file gstring.h.


Generated on Fri Jan 2 15:28:35 2009 for Squat by  doxygen 1.5.6