|
The SWORD Project
1.9.0.svnversion
|
#include <swbuf.h>
Collaboration diagram for SWBuf:Public Member Functions | |
| SWBuf & | append (const char *str, long max=-1) |
| SWBuf & | append (const SWBuf &str, long max=-1) |
| SWBuf & | append (char ch) |
| SWBuf & | append (const unsigned char ch) |
| SWBuf & | append (wchar_t wch) |
| SWBuf & | appendFormatted (const char *format,...) |
| const char * | c_str () const |
| char & | charAt (unsigned long pos) |
| const char & | charAt (unsigned long pos) const |
| char & | charAtGuarded (unsigned long pos) |
| int | compare (const SWBuf &other) const |
| int | compare (const char *other) const |
| bool | endsWith (const SWBuf &postfix) const |
| bool | endsWith (const char *postfix) const |
| char | getFillByte () |
| char * | getRawData () |
| long | indexOf (const SWBuf &needle) const |
| void | insert (unsigned long pos, const char *str, unsigned long start=0, signed long max=-1) |
| void | insert (unsigned long pos, const SWBuf &str, unsigned long start=0, signed long max=-1) |
| void | insert (unsigned long pos, char c) |
| unsigned long | length () const |
| operator const char * () const | |
| bool | operator!= (const SWBuf &other) const |
| bool | operator!= (const char *other) const |
| SWBuf | operator+ (const SWBuf &other) const |
| SWBuf | operator+ (char ch) const |
| SWBuf & | operator+= (const char *str) |
| SWBuf & | operator+= (char ch) |
| SWBuf & | operator-- (int) |
| SWBuf & | operator-= (unsigned long len) |
| bool | operator< (const SWBuf &other) const |
| bool | operator< (const char *other) const |
| SWBuf & | operator<< (unsigned long n) |
| bool | operator<= (const SWBuf &other) const |
| bool | operator<= (const char *other) const |
| SWBuf & | operator= (const char *newVal) |
| SWBuf & | operator= (const SWBuf &other) |
| bool | operator== (const SWBuf &other) const |
| bool | operator== (const char *other) const |
| bool | operator> (const SWBuf &other) const |
| bool | operator> (const char *other) const |
| bool | operator>= (const SWBuf &other) const |
| bool | operator>= (const char *other) const |
| SWBuf & | operator>> (unsigned long n) |
| char & | operator[] (unsigned long pos) |
| char & | operator[] (long pos) |
| char & | operator[] (unsigned int pos) |
| char & | operator[] (int pos) |
| const char & | operator[] (unsigned long pos) const |
| const char & | operator[] (long pos) const |
| const char & | operator[] (unsigned int pos) const |
| const char & | operator[] (int pos) const |
| SWBuf & | replaceBytes (const char *targets, char newByte) |
| void | resize (unsigned long len) |
| void | set (const SWBuf &newVal) |
| void | set (const char *newVal, unsigned long maxSize=0) |
| void | setFillByte (char ch) |
| SWBuf & | setFormatted (const char *format,...) |
| SWBuf & | setFormattedVA (const char *format, va_list argptr) |
| void | setSize (unsigned long len) |
| unsigned long | size () const |
| void | size (unsigned long newSize) |
| bool | startsWith (const SWBuf &prefix) const |
| bool | startsWith (const char *prefix) const |
| const char * | stripPrefix (char separator, bool endOfStringAsSeparator=false) |
| SWBuf () | |
| SWBuf (const char *initVal, unsigned long initSize=0) | |
| SWBuf (const SWBuf &other, unsigned long initSize=0) | |
| SWBuf (char initVal, unsigned long initSize=0) | |
| SWBuf & | toLower () |
| SWBuf & | toUpper () |
| SWBuf & | trim () |
| SWBuf & | trimEnd () |
| SWBuf & | trimStart () |
| ~SWBuf () | |
Static Public Attributes | |
| static char * | nullStr = (char *)"" |
Private Member Functions | |
| void | assureMore (size_t pastEnd) |
| void | assureSize (size_t checkSize) |
| void | init (size_t initSize) |
Private Attributes | |
| unsigned long | allocSize |
| char * | buf |
| char * | end |
| char * | endAlloc |
| char | fillByte |
This class is used as a transport and utility for data buffers.
|
inline |
|
inline |
|
inline |
SWBuf::append - appends a value to the current value of this SWBuf. If the allocated memory is not enough, it will be resized accordingly.
| str | Append this. |
| max | Append only max chars. |
Definition at line 274 of file swbuf.h.
SWBuf::append - appends a value to the current value of this SWBuf If the allocated memory is not enough, it will be resized accordingly.
| str | Append this. |
| max | Append only max chars. |
Definition at line 292 of file swbuf.h.
|
inline |
SWBuf::append - appends a value to the current value of this SWBuf If the allocated memory is not enough, it will be resized accordingly.
| ch | Append this. |
Definition at line 299 of file swbuf.h.
|
inline |
SWBuf::append - appends a wide character value to the current value of this SWBuf If the allocated memory is not enough, it will be resized accordingly. NOTE: This is dangerous, as wchar_t is currently different sizes on different platforms (stupid windoze; stupid c++ spec for not mandating 4byte).
| wch | Append this. |
Definition at line 319 of file swbuf.h.
SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf.
| format | The format string. Same syntax as printf, for example. |
| ... | Add all arguments here. |
Definition at line 81 of file swbuf.cpp.
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
SWBuf::getFillByte - Get the fillByte character
Definition at line 153 of file swbuf.h.
|
inline |
| void SWBuf::insert | ( | unsigned long | pos, |
| const char * | str, | ||
| unsigned long | start = 0, |
||
| signed long | max = -1 |
||
| ) |
SWBuf::insert - inserts the given string at position into this string
| pos | The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s) |
| str | string to be inserted |
| start | start from this position in the string to be inserted |
| max | Insert only max chars. |
Definition at line 99 of file swbuf.cpp.
|
inline |
SWBuf::insert - inserts the given string at position into this string
| pos | The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s) |
| str | string to be inserted |
| start | start from this position in the string to be inserted |
| max | Insert only max chars. |
Definition at line 360 of file swbuf.h.
|
inline |
SWBuf::insert - inserts the given character at position into this string
| pos | The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s) |
| c | Insert this. |
Definition at line 369 of file swbuf.h.
Concatenate another buffer to the end of this buffer
Definition at line 419 of file swbuf.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Replace with a new byte value all occurances in this buffer of any byte value specified in a set
| targets | a set of bytes, any of which will be replaced |
| newByte | value to use as replacement or 0 to remove matching byte. |
Example: replaceBytes("abc", 'z'); // replaces all occurances of 'a', 'b', and 'c' with 'z'
Definition at line 467 of file swbuf.h.
|
inline |
SWBuf::resize - Resize this buffer to a specific length.
| len | The new size of the buffer. One byte for the null will be added. |
Definition at line 266 of file swbuf.h.
SWBuf::set - sets this buf to a new value If the allocated memory is bigger than the new string, it will NOT be resized.
| newVal | the value to set this buffer to. |
Definition at line 204 of file swbuf.h.
|
inline |
SWBuf::set - sets this buf to a new value. If the allocated memory is bigger than the new string, it will NOT be resized.
| newVal | the value to set this buffer to. |
Definition at line 216 of file swbuf.h.
|
inline |
SWBuf::setFillByte - Set the fillByte character
| ch | This character is used when the SWBuf is (re)sized. The memory will be filled with this character. |
Definition at line 146 of file swbuf.h.
SWBuf::setFormatted - sets this buf to a formatted string. If the allocated memory is bigger than the new string, it will NOT be resized.
| format | The format string. Same syntax as printf, for example. |
| ... | Add all arguments here. |
Definition at line 50 of file swbuf.cpp.
|
inline |
SWBuf::setSize - Size this buffer to a specific length.
| len | The new size of the buffer. One byte for the null will be added. |
Definition at line 255 of file swbuf.h.
|
inline |
|
inline |
|
inline |
Strip a prefix from this buffer up to a separator byte. Returns the prefix and modifies this buffer, shifting left to remove prefix
| separator | to use (e.g. ':') |
| endOfStringAsSeparator | - also count end of string as separator. this is useful for tokenizing entire string like: x|y|z if true it will also include 'z'. |
Definition at line 457 of file swbuf.h.
| SWBuf & SWBuf::toLower | ( | ) |
Converts this SWBuf to lowercase &return this
Definition at line 141 of file swbuf.cpp.
| SWBuf & SWBuf::toUpper | ( | ) |
Converts this SWBuf to uppercase &return this
Converts an SWBuf filled with UTF-8 to upper case
| b | SWBuf to change to upper case |
Definition at line 132 of file swbuf.cpp.
|
inline |
|
inline |
|
inline |
|
static |