Bayonne2 / Common C++ 2 Framework
|
#include <string.h>
Public Types | |
typedef size_t | size_type |
Public Member Functions | |
SString () | |
Create an empty streamable string ready for input. More... | |
SString (const SString &from) | |
Copy constructor. More... | |
~SString () | |
Cancel out the object. More... | |
char * | text (void) const |
Alternate get text method. More... | |
size_t | size (void) const |
Get actual length of string data. More... | |
size_t | length (void) const |
Get length as if null terminated string. More... | |
const char * | getIndex (size_t index) const |
Get a string pointer to string content based on an indexed offset. More... | |
char * | getText (void) const |
Get the text of a string. More... | |
long | getValue (long defvalue=0l) const |
Get the value of a string. More... | |
bool | getBool (bool defbool=false) const |
Get the bool flag of a string. More... | |
const size_t | getLength (void) const |
Get the assigned length of string. More... | |
const size_t | getSize (void) const |
Get the allocation size of the string variable. More... | |
bool | isEmpty (void) const |
Return true if string is empty. More... | |
void | resize (size_t size) |
Re-allocate buffer space for string. More... | |
void | clear (void) |
Clear the contents of the entire string. More... | |
char | at (ssize_t offset) const |
Return a character at a known offset. More... | |
unsigned | count (const String &s, size_t offset=0) const |
Count the number of occurences of a specific string within our string. More... | |
unsigned | count (const char *s, size_t offset=0, size_t len=0) const |
Count the number of occurrences of a specific text pattern within our string. More... | |
String | token (const char *delim=" \t\n\r", size_t offset=0) |
Extract a new string as a token from the current string. More... | |
size_t | find (const String &s, size_t offset=0, unsigned instance=1) const |
Find the index to the nth instance of a substring in our string. More... | |
size_t | find (const char *s, size_t offset=0, size_t len=0, unsigned count=1) const |
Find the index to the nth instance of text in our string. More... | |
size_t | find (unsigned instance, const char *text, size_t offset=0, size_t len=0) const |
A more convenient version of find for nth occurences, by putting the instance first. More... | |
size_t | find (unsigned instance, const String &string, size_t offset=0) const |
A more convenient version of find for nth occurences, by putting the instance first. More... | |
size_t | rfind (const String &s, size_t offset=0) const |
Find last occurence of a substring in our string. More... | |
size_t | rfind (const char *s, size_t offset=0, size_t len=0) const |
Find last occurence of a text in our string. More... | |
void | trim (const char *cs) |
Trim trailing characters from a string. More... | |
void | trim (size_t count) |
Trim n trailing characters from a string. More... | |
void | chop (const char *cs) |
Chop leading characters from a string. More... | |
void | chop (size_t chars) |
Chop n leading characters from a string. More... | |
void | strip (const char *cs) |
Strip lead and trailing characters from a string. More... | |
void | erase (size_t start, size_t len=npos) |
Erase a portion of string. More... | |
void | insert (size_t start, const char *text, size_t len=0) |
Insert text into a string. More... | |
void | insert (size_t start, const String &str) |
Insert other string into our string. More... | |
void | replace (size_t start, size_t len, const char *text, size_t count=0) |
Replace text at a specific position in the string with new text. More... | |
void | replace (size_t start, size_t len, const String &string) |
Replace text at a specific position in the string with new string,. More... | |
String | substr (size_t start, size_t len) const |
Return a new string that contains a specific substring of the current string. More... | |
const char *() | index (size_t ind) const |
Return an indexed string based on the index, such as from a find. More... | |
void | compact (void) |
Reduce the size of the string allocation to the minimum needed based on the current effective length. More... | |
char * | c_str (void) const |
Old ANSI C++ compatible string pointer extraction. More... | |
operator char * () const | |
Get our string data through dereference operator. More... | |
bool | operator! (void) const |
Logical test for string empty. More... | |
char * | data (void) const |
Alternate get text method. More... | |
size_t | capacity (void) const |
Get space allocated to hold current string. More... | |
bool | empty (void) const |
Return true if string is empty. More... | |
void | append (const char *str, size_t count=0) |
Append text to the end of the current string. More... | |
void | append (const char *str, size_t offset, size_t count) |
Append text into the current string. More... | |
void | append (const String &str) |
Append string to the end of the current string. More... | |
void | add (char c) |
Add a character to the end of a string. More... | |
const char | operator[] (unsigned ind) const |
Extract a character by array indexing. More... | |
String & | operator+= (const String &str) |
Append operator. More... | |
String & | operator+= (char c) |
Append operator. More... | |
String & | operator+= (const char *str) |
Append operator. More... | |
String & | operator+= (const std::string &str) |
Append operator. More... | |
bool | operator< (const String &str) const |
bool | operator< (const char *str) const |
bool | operator> (const String &str) const |
bool | operator> (const char *str) const |
bool | operator<= (const String &str) const |
bool | operator<= (const char *str) const |
bool | operator>= (const String &str) const |
bool | operator>= (const char *str) const |
bool | operator== (const String &str) const |
bool | operator== (const char *str) const |
bool | operator!= (const String &str) const |
bool | operator!= (const char *str) const |
bool | operator*= (const String &str) const |
Test if string is contained in our string. More... | |
bool | operator*= (const char *str) const |
Test if text is contained in our string. More... | |
Static Public Attributes | |
static const size_t | npos |
Protected Member Functions | |
int | overflow (int c) |
This is the streambuf function that actually outputs the data to the string. More... | |
bool | isBig (void) const |
Determine if string is allocated in local variable or an external reference. More... | |
const char * | set (const char *str, size_t len=0) |
Set the content of the string variable to the specified string value, and use smart re-allocation strategies if appropriate to shrink the size of the variable. More... | |
void | set (const String &str) |
Set the content of the string variable to that of another variable. More... | |
void | copy (const String &str) |
Impliment the copy constructor, used internally. More... | |
void | init (void) |
Used to initialize a string object. More... | |
size_t | setSize (size_t size) |
Set the size of allocated space in the string variable (capacity) to a known value. More... | |
void | setLength (size_t len) |
Set the length value of the string content. More... | |
virtual int | compare (const char *text, size_t len=0, size_t index=0) const |
A derivable low level comparison operator. More... | |
size_t | search (const char *text, size_t clen=0, size_t offset=0) const |
An internal method used to search for a substring starting at a known offset. More... | |
Static Protected Member Functions | |
static char * | getSpace (size_t size) |
Used to fetch memory, if needed, based on the size, from the pager, or the system heap. More... | |
Static Protected Attributes | |
static const unsigned | minsize |
static const unsigned | slotsize |
static const unsigned | pagesize |
static const unsigned | slotlimit |
static const unsigned | slotcount |
|
inherited |
SString::SString | ( | ) |
Create an empty streamable string ready for input.
SString::SString | ( | const SString & | from | ) |
Copy constructor.
SString::~SString | ( | ) |
Cancel out the object.
|
inherited |
Add a character to the end of a string.
c | char to add. |
|
inherited |
Append text to the end of the current string.
str | text to append. |
count | size of text to append. |
|
inherited |
Append text into the current string.
str | text to append. |
offset | offset to overlay. |
count | size of text to append. |
|
inherited |
Append string to the end of the current string.
str | string to append. |
|
inherited |
Return a character at a known offset.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Clear the contents of the entire string.
|
inlineinherited |
|
protectedvirtualinherited |
A derivable low level comparison operator.
This can be used to create custom comparison data types in derived string classes.
text | text to compare. |
len | length of text to compare. |
index | offset from start of string, used in searchs. |
|
protectedinherited |
Impliment the copy constructor, used internally.
Will always create a minimum sized string allocation.
str | string to copy from. |
|
inherited |
Count the number of occurences of a specific string within our string.
s | string to test. |
offset | offset to start from. |
|
inherited |
Count the number of occurrences of a specific text pattern within our string.
s | text pattern to find |
offset | offset to start from. |
len | length of text pattern if specified. |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Erase a portion of string.
start | starting index to erase from. |
len | number of characters to erase. |
|
inherited |
Find the index to the nth instance of a substring in our string.
s | string to search for. |
offset | offset to start at. |
instance | instance to look for. |
|
inherited |
Find the index to the nth instance of text in our string.
s | string to search for. |
offset | offset to start at. |
len | size of string text. |
count | instance to look for. |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Get the bool flag of a string.
|
inherited |
Get a string pointer to string content based on an indexed offset.
A NULL is returned if the index is outsize of range.
index |
|
inherited |
Get the assigned length of string.
|
inherited |
Get the allocation size of the string variable.
|
staticprotectedinherited |
Used to fetch memory, if needed, based on the size, from the pager, or the system heap.
size | of space needed. |
|
inherited |
Get the text of a string.
|
inherited |
Get the value of a string.
|
inlineinherited |
|
protectedinherited |
Used to initialize a string object.
|
inherited |
Insert text into a string.
start | starting offset to insert at. |
text | text to insert. |
len | size of text to insert. |
|
inherited |
Insert other string into our string.
start | string offset to insert at. |
str | string to insert. |
|
inlineprotectedinherited |
|
inherited |
Return true if string is empty.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inherited |
|
inherited |
Test if string is contained in our string.
|
inherited |
Test if text is contained in our string.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inlineinherited |
|
protected |
This is the streambuf function that actually outputs the data to the string.
Since all output should be done with the standard ostream operators, this function should never be called directly.
|
inherited |
Replace text at a specific position in the string with new text.
start | starting offset to replace at. |
len | length of text to remove. |
text | text to replace with. |
count | size of replacement text. |
|
inherited |
Replace text at a specific position in the string with new string,.
start | starting offset to replace at. |
len | length of text to remove. |
string | reference to replace with. |
|
inherited |
Re-allocate buffer space for string.
size | new size to use. |
|
inherited |
Find last occurence of a substring in our string.
s | string to search for. |
offset | offset to start from. |
|
inherited |
Find last occurence of a text in our string.
s | string to search for. |
offset | offset to start from. |
len | size of string to look for. |
|
protectedinherited |
An internal method used to search for a substring starting at a known offset.
Used by find and count methods.
text | text to search for. |
clen | length of search text. |
offset | offset to start from. |
|
protectedinherited |
Set the content of the string variable to the specified string value, and use smart re-allocation strategies if appropriate to shrink the size of the variable.
str | string to set. |
len | length of string if passed. |
|
protectedinherited |
Set the content of the string variable to that of another variable.
Uses the string set method.
str | string to copy from. |
|
protectedinherited |
Set the length value of the string content.
len | size in bytes. |
|
protectedinherited |
Set the size of allocated space in the string variable (capacity) to a known value.
The value is recomputed and adjusted based on allocation method.
size | in bytes. |
|
inlineinherited |
|
inherited |
Strip lead and trailing characters from a string.
cs | list of chars to strip. |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Extract a new string as a token from the current string.
delim | deliminator characters. |
offset | offset to start from. |
|
inlineinherited |
|
inherited |
Trim n trailing characters from a string.
count | number of bytes to trim. |
struct { ... } String::bigstring |
struct { ... } String::ministring |
|
inherited |