String with variable length but guaranteed minimum buffer size.
More...
List of all members.
Detailed Description
String with variable length but guaranteed minimum buffer size.
The minimum buffer size makes life easier in worlds where strcpy etc. rule. Overhead is 4 extra bytes for variable length and 4 bytes for minimum length.
Passing a (char*) null pointer is no problem.
Don't try to add constructors with a single basic type - this leads to nasty hidden bugs because the compiler will try to convert all kinds of things into BufferStrings. If you just need a string from an int, float, ..., just use str = toString( var ). If you need the BufferString later, use: BufferString istr( "", intvar );
Constructor & Destructor Documentation
| BufferString::BufferString |
( |
|
) |
[inline] |
| BufferString::BufferString |
( |
const char * |
s |
) |
[inline] |
| BufferString::BufferString |
( |
int |
minlen, |
|
|
bool |
setnull | |
|
) |
| | |
template<class T >
| BufferString::BufferString |
( |
const char * |
s1, |
|
|
T |
t, |
|
|
const char * |
s = 0 | |
|
) |
| | [inline] |
| virtual BufferString::~BufferString |
( |
|
) |
[virtual] |
Member Function Documentation
| char* BufferString::buf |
( |
|
) |
|
Allocation of min length guaranteed.
| const char* BufferString::buf |
( |
|
) |
const [inline] |
| unsigned int BufferString::bufSize |
( |
|
) |
const [inline] |
| void BufferString::destroy |
( |
|
) |
[inline, private] |
| void BufferString::init |
( |
|
) |
[private] |
| void BufferString::insertAt |
( |
int |
idx, |
|
|
const char * |
| |
|
) |
| | |
| bool BufferString::isEmpty |
( |
|
) |
const |
| bool BufferString::isEqual |
( |
const char * |
, |
|
|
bool |
caseinsens = false | |
|
) |
| | const |
| bool BufferString::isStartOf |
( |
const char * |
, |
|
|
bool |
caseinsens = false | |
|
) |
| | const |
| bool BufferString::matches |
( |
const char * |
, |
|
|
bool |
caseinsens = false | |
|
) |
| | const |
| unsigned int BufferString::minBufSize |
( |
|
) |
const [inline] |
| BufferString::operator const char * |
( |
|
) |
const [inline] |
| bool BufferString::operator!= |
( |
const BufferString & |
s |
) |
const [inline] |
template<class T >
| bool BufferString::operator!= |
( |
T |
t |
) |
const [inline] |
| bool BufferString::operator!= |
( |
const char * |
s |
) |
const [inline] |
| BufferString& BufferString::operator+= |
( |
const char * |
s |
) |
[inline] |
| bool BufferString::operator< |
( |
const char * |
|
) |
const |
template<class T >
| bool BufferString::operator< |
( |
T |
t |
) |
const [inline] |
| bool BufferString::operator== |
( |
const BufferString & |
s |
) |
const [inline] |
template<class T >
| bool BufferString::operator== |
( |
T |
t |
) |
const [inline] |
| bool BufferString::operator== |
( |
const char * |
|
) |
const |
| bool BufferString::operator> |
( |
const char * |
|
) |
const |
template<class T >
| bool BufferString::operator> |
( |
T |
t |
) |
const [inline] |
| char& BufferString::operator[] |
( |
int |
idx |
) |
[inline] |
| const char& BufferString::operator[] |
( |
int |
idx |
) |
const [inline] |
| void BufferString::replaceAt |
( |
int |
idx, |
|
|
const char * |
, |
|
|
bool |
cutoff = true | |
|
) |
| | |
| void BufferString::setBufSize |
( |
unsigned |
int |
) |
|
| void BufferString::setEmpty |
( |
|
) |
|
| void BufferString::setMinBufSize |
( |
unsigned |
int |
) |
|
| unsigned int BufferString::size |
( |
|
) |
const |
| const char * BufferString::str |
( |
|
) |
const [inline] |
- Returns:
- null pointer if empty
Member Data Documentation