A copy-on-write string class that operates by reference count. More...
#include <string.h>
Data Structures | |
class | cstring |
This is an internal class which contains the actual string data along with some control fields. More... | |
Public Member Functions | |
string () | |
Create a new empty string object. | |
string (const StringFormat &format) | |
Create a string from a formatting object. | |
string (strsize_t size) | |
Create an empty string with a buffer pre-allocated to a specified size. | |
string (strsize_t size, char fill) | |
Create a filled string with a buffer pre-allocated to a specified size. | |
string (strsize_t size, const char *format,...) | |
Create a string by printf-like formating into a pre-allocated space of a specified size. | |
string (const char *text) | |
Create a string from null terminated text. | |
string (const char *text, strsize_t size) | |
Create a string from null terminated text up to a maximum specified size. | |
string (const char *text, const char *end) | |
Create a string for a substring. | |
string (const string &existing) | |
Construct a copy of a string object. | |
virtual | ~string () |
Destroy string. | |
string | get (strsize_t offset, strsize_t size=0) const |
Get a new string object as a substring of the current object. | |
int | scanf (const char *format,...) |
Scan input items from a string object. | |
int | vscanf (const char *format, va_list args) |
Scan input items from a string object. | |
strsize_t | printf (const char *format,...) |
Print items into a string object. | |
strsize_t | vprintf (const char *format, va_list args) |
Print items into a string object. | |
char * | c_mem (void) const |
Get memory text buffer of string object. | |
const char * | c_str (void) const |
Get character text buffer of string object. | |
virtual bool | resize (strsize_t size) |
Resize and re-allocate string memory. | |
void | set (const char *text) |
Set string object to text of a null terminated string. | |
void | set (const StringFormat &format) |
Set string object to text of a formatted object. | |
void | set (strsize_t offset, const char *text, strsize_t size=0) |
Set a portion of the string object at a specified offset to a text string. | |
void | set (const char *text, char overflow, strsize_t offset, strsize_t size=0) |
Set a text field within our string object. | |
void | rset (const char *text, char overflow, strsize_t offset, strsize_t size=0) |
Set a text field within our string object offset from the end of buffer. | |
void | add (const StringFormat &format) |
Append formatted object to our string buffer. | |
void | add (const char *text) |
Append null terminated text to our string buffer. | |
void | add (char character) |
Append a single character to our string buffer. | |
void | trim (const char *list) |
Trim lead characters from the string. | |
void | chop (const char *list) |
Chop trailing characters from the string. | |
void | strip (const char *list) |
Strip lead and trailing characters from the string. | |
bool | unquote (const char *quote) |
Unquote a quoted string. | |
void | cut (strsize_t offset, strsize_t size=0) |
Cut (remove) text from string. | |
void | clear (strsize_t offset, strsize_t size=0) |
Clear a field of a filled string with filler. | |
void | clear (void) |
Clear string by setting to empty. | |
void | upper (void) |
Convert string to upper case. | |
void | lower (void) |
Convert string to lower case. | |
strsize_t | ccount (const char *list) const |
Count number of occurrances of characters in string. | |
strsize_t | count (void) const |
Count all characters in the string (strlen). | |
strsize_t | size (void) const |
Get the size of currently allocated space for string. | |
strsize_t | offset (const char *pointer) const |
Find offset of a pointer into our string buffer. | |
char | at (int position) const |
Return character found at a specific position in the string. | |
const char * | last (const char *list) const |
Find last occurance of a character in the string. | |
const char * | first (const char *list) const |
Find first occurance of a character in the string. | |
const char * | begin (void) const |
Get pointer to first character in string for iteration. | |
const char * | end (void) const |
Get pointer to last character in string for iteration. | |
const char * | skip (const char *list, strsize_t offset=0) const |
Skip lead characters in the string. | |
const char * | rskip (const char *list, strsize_t offset=npos) const |
Skip trailing characters in the string. | |
const char * | find (const char *list, strsize_t offset=0) const |
Find a character in the string. | |
const char * | rfind (const char *list, strsize_t offset=npos) const |
Find last occurance of character in the string. | |
void | split (const char *pointer) |
Split the string by a pointer position. | |
void | split (strsize_t offset) |
Split the string at a specific offset. | |
void | rsplit (const char *pointer) |
Split the string by a pointer position. | |
void | rsplit (strsize_t offset) |
Split the string at a specific offset. | |
const char * | chr (char character) const |
Find pointer in string where specified character appears. | |
const char * | rchr (char character) const |
Find pointer in string where specified character last appears. | |
strsize_t | len (void) |
Get length of string. | |
char | fill (void) |
Get filler character used for field array strings. | |
operator const char * () const | |
Casting reference to raw text string. | |
const char * | operator* () const |
Reference raw text buffer by pointer operator. | |
bool | full (void) const |
Test if the string's allocated space is all used up. | |
string | operator() (int offset, strsize_t size) const |
Get a new substring through object expression. | |
const char * | operator() (int offset) const |
Reference a string in the object by relative offset. | |
const char | operator[] (int offset) const |
Reference a single character in string object by array offset. | |
bool | operator! () const |
Test if string is empty. | |
operator bool () const | |
Test if string has data. | |
string & | operator^= (const string &object) |
Create new cow instance and assign value from another string object. | |
string & | operator^= (const StringFormat &format) |
Create new cow instance and assign value from formatted string object. | |
string & | operator^= (const char *text) |
Create new cow instance and assign value from null terminated text. | |
string & | operator+ (const char *text) |
Concatenate null terminated text to our object. | |
string & | operator+ (const StringFormat &format) |
Concatenate string formatted object to our object. | |
string & | operator& (const char *text) |
Concatenate null terminated text to our object. | |
string & | operator& (const StringFormat &format) |
Concatenate formatted string object to our object. | |
string & | operator= (const string &object) |
Assign our string with the cstring of another object. | |
string & | operator= (const StringFormat &format) |
Assign our string from a string formatting object. | |
string & | operator= (const char *text) |
Assign text to our existing buffer. | |
string & | operator++ (void) |
Delete first character from string. | |
string & | operator+= (strsize_t number) |
Delete a specified number of characters from start of string. | |
string & | operator-- (void) |
Delete last character from string. | |
string & | operator-= (strsize_t number) |
Delete a specified number of characters from end of string. | |
bool | operator== (const char *text) const |
Compare our object with null terminated text. | |
bool | operator!= (const char *text) const |
Compare our object with null terminated text. | |
bool | operator< (const char *text) const |
Compare our object with null terminated text. | |
bool | operator<= (const char *text) const |
Compare our object with null terminated text. | |
bool | operator> (const char *text) const |
Compare our object with null terminated text. | |
bool | operator>= (const char *text) const |
Compare our object with null terminated text. | |
Static Public Member Functions | |
static int | scanf (string &object, const char *format,...) |
Scan input items from a string object. | |
static strsize_t | printf (string &object, const char *format,...) |
Print formatted items into a string object. | |
static int | read (Socket &socket, string &object) |
Read arbitrary binary data from socket into a string object. | |
static int | write (Socket &socket, string &object) |
Write the string object to a socket. | |
static int | read (FILE *file, string &object) |
Read arbitrary binary data from a file into a string object. | |
static int | write (FILE *file, string &object) |
Write the string object to a file. | |
static bool | getline (Socket &socket, string &object) |
Read a line of text input from a socket into the object. | |
static bool | putline (Socket &socket, string &object) |
Write string as a line of text data to a socket. | |
static bool | getline (FILE *file, string &object) |
Read a line of text input from a file into the object. | |
static bool | putline (FILE *file, string &object) |
Write string as a line of text data to a file. | |
static void | swap (string &object1, string &object2) |
Swap the cstring references between two strings. | |
static void | fix (string &object) |
Fix and reset string object filler. | |
static void | lower (char *text) |
Convert null terminated text to lower case. | |
static void | upper (char *text) |
Convert null terminated text to upper case. | |
static const char * | token (char *text, char **last, const char *list, const char *quote=NULL, const char *end=NULL) |
A thread-safe token parsing routine for null terminated strings. | |
static char * | skip (char *text, const char *list) |
Skip after lead characters in a null terminated string. | |
static char * | rskip (char *text, const char *list) |
Skip before trailing characters in a null terminated string. | |
static char * | unquote (char *text, const char *quote) |
Unquote a quoted null terminated string. | |
static char * | rset (char *buffer, size_t size, const char *text) |
Set a field in a null terminated string relative to the end of text. | |
static char * | set (char *buffer, size_t size, const char *text) |
Safely set a null terminated string buffer in memory. | |
static char * | set (char *buffer, size_t size, const char *text, size_t max) |
Safely set a null terminated string buffer in memory. | |
static char * | add (char *buffer, size_t size, const char *text) |
Safely append a null terminated string into an existing string in memory. | |
static char * | add (char *buffer, size_t size, const char *text, size_t max) |
Safely append a null terminated string into an existing string in memory. | |
static const char * | ifind (const char *text, const char *key, const char *optional) |
Find position of case insensitive substring within a string. | |
static const char * | find (const char *text, const char *key, const char *optional) |
Find position of substring within a string. | |
static size_t | count (const char *text) |
Safe version of strlen function. | |
static int | compare (const char *text1, const char *text2) |
Safe string comparison function. | |
static bool | equal (const char *text1, const char *text2) |
Simple equal test for strings. | |
static int | compare (const char *text1, const char *text2, size_t size) |
Safe string comparison function. | |
static bool | equal (const char *text1, const char *text2, size_t size) |
Simple equal test for strings. | |
static int | case_compare (const char *text1, const char *text2) |
Safe case insensitive string comparison function. | |
static bool | case_equal (const char *text1, const char *text2) |
Simple case insensitive equal test for strings. | |
static int | case_compare (const char *text1, const char *text2, size_t size) |
Safe case insensitive string comparison function. | |
static bool | case_equal (const char *text1, const char *text2, size_t size) |
Simple case insenstive equal test for strings. | |
static char * | trim (char *text, const char *list) |
Return start of string after characters to trim from beginning. | |
static char * | chop (char *text, const char *list) |
Strip trailing characters from the text string. | |
static char * | strip (char *text, const char *list) |
Skip lead and remove trailing characters from a text string. | |
static char * | fill (char *text, size_t size, char character) |
Fill a section of memory with a fixed text character. | |
static unsigned | ccount (const char *text, const char *list) |
Count instances of characters in a list in a text buffer. | |
static char * | find (char *text, const char *list) |
Find the first occurance of a character in a text buffer. | |
static char * | rfind (char *text, const char *list) |
Find the last occurance of a character in a text buffer. | |
static char * | first (char *text, const char *list) |
Get pointer to first character past character requested. | |
static char * | last (char *text, const char *list) |
Get pointer to last character before character requested. | |
static char * | dup (const char *text) |
Duplicate null terminated text into the heap. | |
static const char * | token (string &object, char **last, const char *list, const char *quote=NULL, const char *end=NULL) |
A thread-safe token parsing routine for strings objects. | |
static int | vscanf (string &object, const char *format, va_list args) |
Scan input items from a string object. | |
static strsize_t | vprintf (string &object, const char *format, va_list args) |
Print items into a string object. | |
static strsize_t | len (string &object) |
Count all characters in the string object (strlen). | |
static char * | mem (string &object) |
Get memory text buffer of string object. | |
static strsize_t | size (string &object) |
Get the size of currently allocated space for string. | |
static void | clear (string &object) |
Clear a string object. | |
static unsigned | ccount (string &object, const char *list) |
Count number of occurrances of characters in string object. | |
static size_t | count (string &object) |
Count all characters in the string object (strlen). | |
static void | upper (string &object) |
Convert string object to upper case. | |
static void | lower (string &object) |
Convert string object to lower case. | |
static bool | unquote (string &object, const char *quote) |
Unquote a quoted string. | |
static void | trim (string &object, const char *list) |
Trim lead characters from the string. | |
static void | chop (string &object, const char *list) |
Chop trailing characters from the string. | |
static void | strip (string &object, const char *list) |
Strip lead and trailing characters from the string. | |
static const char * | find (string &object, const char *list) |
Find a character in the string. | |
static const char * | rfind (string &object, const char *list) |
Find last character in the string. | |
static const char * | first (string &object, const char *list) |
Get pointer to first character past character requested. | |
static const char * | last (string &object, const char *list) |
Get pointer to last character past character requested. | |
static double | tod (string &object, char **pointer=NULL) |
Convert string to a double value. | |
static long | tol (string &object, char **pointer=NULL) |
Convert string to a long value. | |
static double | tod (const char *text, char **pointer=NULL) |
Convert text to a double value. | |
static long | tol (const char *text, char **pointer=NULL) |
Convert text to a long value. | |
Static Public Attributes | |
static const strsize_t | npos |
A constant for an invalid position value. | |
Protected Member Functions | |
cstring * | create (strsize_t size, char fill=0) const |
Factory create a cstring object of specified size. | |
virtual int | compare (const char *string) const |
Compare the values of two string. | |
bool | equal (const char *string) const |
Test if two string values are equal. | |
virtual void | retain (void) |
Increase retention of our reference counted cstring. | |
virtual void | release (void) |
Decrease retention of our reference counted cstring. | |
virtual cstring * | c_copy (void) const |
Return cstring to use in copy constructors. | |
virtual void | cow (strsize_t size=0) |
Copy on write operation for cstring. | |
strsize_t | getStringSize (void) |
Protected Attributes | |
cstring * | str |
cstring instance our object references. | |
Friends | |
class | StringFormat |
A copy-on-write string class that operates by reference count.
This string class anchors a counted object that is managed as a copy-on-write instance of the string data. This means that multiple instances of the string class can refer to the same string in memory if it has not been modifed, which reduces heap allocation. The string class offers functions to manipulate both the string object, and generic safe string functions to manipulate ordinary null terminated character arrays directly in memory.
Definition at line 72 of file string.h.
ucc::string::string | ( | const StringFormat & | format | ) |
ucc::string::string | ( | strsize_t | size | ) |
Create an empty string with a buffer pre-allocated to a specified size.
size | of buffer to allocate. |
ucc::string::string | ( | strsize_t | size, | |
char | fill | |||
) |
Create a filled string with a buffer pre-allocated to a specified size.
size | of buffer to allocate. | |
fill | character to use. |
ucc::string::string | ( | strsize_t | size, | |
const char * | format, | |||
... | ||||
) |
ucc::string::string | ( | const char * | text | ) |
ucc::string::string | ( | const char * | text, | |
strsize_t | size | |||
) |
ucc::string::string | ( | const char * | text, | |
const char * | end | |||
) |
ucc::string::string | ( | const string & | existing | ) |
virtual ucc::string::~string | ( | ) | [virtual] |
static char* ucc::string::add | ( | char * | buffer, | |
size_t | size, | |||
const char * | text, | |||
size_t | max | |||
) | [static] |
Safely append a null terminated string into an existing string in memory.
If the resulting string is too large to fit into the buffer, it is truncated to the size.
buffer | to set. | |
size | of buffer. Includes null byte at end of string. | |
text | to set in buffer. | |
max | size of text to append. |
static char* ucc::string::add | ( | char * | buffer, | |
size_t | size, | |||
const char * | text | |||
) | [static] |
void ucc::string::add | ( | char | character | ) |
Append a single character to our string buffer.
character | to append. |
void ucc::string::add | ( | const char * | text | ) |
Append null terminated text to our string buffer.
text | to append. |
void ucc::string::add | ( | const StringFormat & | format | ) |
Append formatted object to our string buffer.
format | object to append. |
char ucc::string::at | ( | int | position | ) | const |
const char* ucc::string::begin | ( | void | ) | const |
virtual cstring* ucc::string::c_copy | ( | void | ) | const [protected, virtual] |
Return cstring to use in copy constructors.
Is virtual for memstring.
Reimplemented in ucc::memstring.
char* ucc::string::c_mem | ( | void | ) | const |
const char* ucc::string::c_str | ( | void | ) | const |
Get character text buffer of string object.
static int ucc::string::case_compare | ( | const char * | text1, | |
const char * | text2, | |||
size_t | size | |||
) | [static] |
Safe case insensitive string comparison function.
text1 | to compare. | |
text2 | to compare. | |
size | limit of strings to compare. |
static int ucc::string::case_compare | ( | const char * | text1, | |
const char * | text2 | |||
) | [static] |
Safe case insensitive string comparison function.
text1 | to compare. | |
text2 | to compare. |
static bool ucc::string::case_equal | ( | const char * | text1, | |
const char * | text2, | |||
size_t | size | |||
) | [static] |
Simple case insenstive equal test for strings.
text1 | to test. | |
text2 | to test. | |
size | limit of strings to compare. |
static bool ucc::string::case_equal | ( | const char * | text1, | |
const char * | text2 | |||
) | [static] |
Simple case insensitive equal test for strings.
text1 | to test. | |
text2 | to test. |
static unsigned ucc::string::ccount | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static unsigned ucc::string::ccount | ( | const char * | text, | |
const char * | list | |||
) | [static] |
Count instances of characters in a list in a text buffer.
text | buffer to examine. | |
list | of characters to count in buffer. |
strsize_t ucc::string::ccount | ( | const char * | list | ) | const |
static void ucc::string::chop | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::chop | ( | char * | text, | |
const char * | list | |||
) | [static] |
void ucc::string::chop | ( | const char * | list | ) |
Chop trailing characters from the string.
list | of characters to remove. |
const char* ucc::string::chr | ( | char | character | ) | const |
static void ucc::string::clear | ( | string & | object | ) | [inline, static] |
static int ucc::string::compare | ( | const char * | text1, | |
const char * | text2, | |||
size_t | size | |||
) | [static] |
Safe string comparison function.
text1 | to compare. | |
text2 | to compare. | |
size | limit of strings to compare. |
static int ucc::string::compare | ( | const char * | text1, | |
const char * | text2 | |||
) | [static] |
Safe string comparison function.
text1 | to compare. | |
text2 | to compare. |
virtual int ucc::string::compare | ( | const char * | string | ) | const [protected, virtual] |
static size_t ucc::string::count | ( | string & | object | ) | [inline, static] |
static size_t ucc::string::count | ( | const char * | text | ) | [static] |
strsize_t ucc::string::count | ( | void | ) | const |
Count all characters in the string (strlen).
virtual void ucc::string::cow | ( | strsize_t | size = 0 |
) | [protected, virtual] |
static char* ucc::string::dup | ( | const char * | text | ) | [static] |
Duplicate null terminated text into the heap.
text | to duplicate. |
const char* ucc::string::end | ( | void | ) | const |
static bool ucc::string::equal | ( | const char * | text1, | |
const char * | text2, | |||
size_t | size | |||
) | [static] |
Simple equal test for strings.
text1 | to test. | |
text2 | to test. | |
size | limit of strings to compare. |
static bool ucc::string::equal | ( | const char * | text1, | |
const char * | text2 | |||
) | [static] |
Simple equal test for strings.
text1 | to test. | |
text2 | to test. |
bool ucc::string::equal | ( | const char * | string | ) | const [protected] |
static char* ucc::string::fill | ( | char * | text, | |
size_t | size, | |||
char | character | |||
) | [static] |
Fill a section of memory with a fixed text character.
Adds a null byte at the end.
text | buffer to fill. | |
size | of text buffer with null terminated byte. | |
character | to fill with. |
char ucc::string::fill | ( | void | ) |
Get filler character used for field array strings.
static const char* ucc::string::find | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::find | ( | char * | text, | |
const char * | list | |||
) | [static] |
Find the first occurance of a character in a text buffer.
text | buffer to examine. | |
list | of characters to search for. |
static const char* ucc::string::find | ( | const char * | text, | |
const char * | key, | |||
const char * | optional | |||
) | [static] |
const char* ucc::string::find | ( | const char * | list, | |
strsize_t | offset = 0 | |||
) | const |
static const char* ucc::string::first | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::first | ( | char * | text, | |
const char * | list | |||
) | [static] |
const char* ucc::string::first | ( | const char * | list | ) | const |
static void ucc::string::fix | ( | string & | object | ) | [static] |
Fix and reset string object filler.
object | to fix. |
bool ucc::string::full | ( | void | ) | const |
Test if the string's allocated space is all used up.
static bool ucc::string::getline | ( | FILE * | file, | |
string & | object | |||
) | [static] |
Read a line of text input from a file into the object.
The maximum number of bytes that may be read is based on the currently allocated size of the object.
file | to read from. | |
object | to save read data. |
Read a line of text input from a socket into the object.
The maximum number of bytes that may be read is based on the currently allocated size of the object.
socket | to read from. | |
object | to save read data. |
static const char* ucc::string::ifind | ( | const char * | text, | |
const char * | key, | |||
const char * | optional | |||
) | [static] |
static const char* ucc::string::last | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::last | ( | char * | text, | |
const char * | list | |||
) | [static] |
const char* ucc::string::last | ( | const char * | list | ) | const |
static void ucc::string::lower | ( | string & | object | ) | [inline, static] |
static void ucc::string::lower | ( | char * | text | ) | [static] |
Convert null terminated text to lower case.
text | to convert. |
static char* ucc::string::mem | ( | string & | object | ) | [inline, static] |
strsize_t ucc::string::offset | ( | const char * | pointer | ) | const |
Find offset of a pointer into our string buffer.
This can be used to find the offset position of a pointer returned by find, for example. This is used when one needs to convert a member function that returns a pointer to call a member function that operates by a offset value. If the pointer is outside the range of the string then npos is returned.
ucc::string::operator const char * | ( | ) | const [inline] |
bool ucc::string::operator!= | ( | const char * | text | ) | const |
Compare our object with null terminated text.
Compare method is used.
text | to compare with. |
string& ucc::string::operator& | ( | const StringFormat & | format | ) |
string& ucc::string::operator& | ( | const char * | text | ) |
const char* ucc::string::operator() | ( | int | offset | ) | const |
Get a new substring through object expression.
offset | of substring. | |
size | of substring or 0 if to end. |
const char* ucc::string::operator* | ( | ) | const [inline] |
string& ucc::string::operator+ | ( | const StringFormat & | format | ) |
string& ucc::string::operator+ | ( | const char * | text | ) |
Concatenate null terminated text to our object.
This creates a new copy-on-write instance to hold the concatenated string.
text | to concatenate. |
Delete a specified number of characters from start of string.
number | of characters to delete. |
Delete a specified number of characters from end of string.
number | of characters to delete. |
bool ucc::string::operator< | ( | const char * | text | ) | const |
Compare our object with null terminated text.
Compare method is used.
text | to compare with. |
bool ucc::string::operator<= | ( | const char * | text | ) | const |
Compare our object with null terminated text.
Compare method is used.
text | to compare with. |
string& ucc::string::operator= | ( | const char * | text | ) |
Assign text to our existing buffer.
This performs a set method.
text | to assign from. |
Reimplemented in ucc::memstring, and ucc::stringbuf< S >.
string& ucc::string::operator= | ( | const StringFormat & | format | ) |
bool ucc::string::operator== | ( | const char * | text | ) | const |
Compare our object with null terminated text.
text | to compare with. |
bool ucc::string::operator> | ( | const char * | text | ) | const |
Compare our object with null terminated text.
Compare method is used.
text | to compare with. |
bool ucc::string::operator>= | ( | const char * | text | ) | const |
Compare our object with null terminated text.
Compare method is used.
text | to compare with. |
const char ucc::string::operator[] | ( | int | offset | ) | const |
Reference a single character in string object by array offset.
offset | to character. |
string& ucc::string::operator^= | ( | const char * | text | ) |
Create new cow instance and assign value from null terminated text.
text | to assign from. |
string& ucc::string::operator^= | ( | const StringFormat & | format | ) |
Create new cow instance and assign value from formatted string object.
format | object to assign from. |
Create new cow instance and assign value from another string object.
object | to assign from. |
strsize_t ucc::string::printf | ( | const char * | format, | |
... | ||||
) |
static bool ucc::string::putline | ( | FILE * | file, | |
string & | object | |||
) | [static] |
Write string as a line of text data to a file.
A newline will be appended to the end.
file | to print to. | |
object | to get text line to put into file. |
Write string as a line of text data to a socket.
A newline will be appended to the end.
socket | to print to. | |
object | to get text line from. |
const char* ucc::string::rchr | ( | char | character | ) | const |
static int ucc::string::read | ( | FILE * | file, | |
string & | object | |||
) | [static] |
Read arbitrary binary data from a file into a string object.
The total number of bytes that may be read is based on the allocated size of the object.
file | to read from. | |
object | to save read data. |
Read arbitrary binary data from socket into a string object.
The total number of bytes that may be read is based on the allocated size of the object.
socket | to read from. | |
object | to save read data. |
virtual void ucc::string::release | ( | void | ) | [protected, virtual] |
virtual bool ucc::string::resize | ( | strsize_t | size | ) | [virtual] |
virtual void ucc::string::retain | ( | void | ) | [protected, virtual] |
static const char* ucc::string::rfind | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::rfind | ( | char * | text, | |
const char * | list | |||
) | [static] |
Find the last occurance of a character in a text buffer.
text | buffer to examine. | |
list | of characters to search for. |
static char* ucc::string::rset | ( | char * | buffer, | |
size_t | size, | |||
const char * | text | |||
) | [static] |
static char* ucc::string::rskip | ( | char * | text, | |
const char * | list | |||
) | [static] |
void ucc::string::rsplit | ( | strsize_t | offset | ) |
void ucc::string::rsplit | ( | const char * | pointer | ) |
static int ucc::string::scanf | ( | string & | object, | |
const char * | format, | |||
... | ||||
) | [static] |
int ucc::string::scanf | ( | const char * | format, | |
... | ||||
) |
static char* ucc::string::set | ( | char * | buffer, | |
size_t | size, | |||
const char * | text, | |||
size_t | max | |||
) | [static] |
static char* ucc::string::set | ( | char * | buffer, | |
size_t | size, | |||
const char * | text | |||
) | [static] |
void ucc::string::set | ( | const StringFormat & | format | ) |
Set string object to text of a formatted object.
format | object to use. |
void ucc::string::set | ( | const char * | text | ) |
strsize_t ucc::string::size | ( | void | ) | const |
Get the size of currently allocated space for string.
static char* ucc::string::skip | ( | char * | text, | |
const char * | list | |||
) | [static] |
const char* ucc::string::skip | ( | const char * | list, | |
strsize_t | offset = 0 | |||
) | const |
void ucc::string::split | ( | strsize_t | offset | ) |
void ucc::string::split | ( | const char * | pointer | ) |
static void ucc::string::strip | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::strip | ( | char * | text, | |
const char * | list | |||
) | [static] |
Skip lead and remove trailing characters from a text string.
This function will modify memory.
text | buffer to examine. | |
list | of characters to trim and chop. |
void ucc::string::strip | ( | const char * | list | ) |
Strip lead and trailing characters from the string.
list | of characters to remove. |
Swap the cstring references between two strings.
object1 | to swap. | |
object2 | to swap. |
static double ucc::string::tod | ( | const char * | text, | |
char ** | pointer = NULL | |||
) | [inline, static] |
static double ucc::string::tod | ( | string & | object, | |
char ** | pointer = NULL | |||
) | [inline, static] |
static const char* ucc::string::token | ( | string & | object, | |
char ** | last, | |||
const char * | list, | |||
const char * | quote = NULL , |
|||
const char * | end = NULL | |||
) | [inline, static] |
A thread-safe token parsing routine for strings objects.
This is related to strtok, but with safety checks for NULL values and a number of enhancements including support for quoted text that may contain token seperators within quotes. The object is modified as it is parsed.
object | to examine for tokens. | |
last | token position or set to NULL for start of string. | |
list | of characters to use as token seperators. | |
quote | pairs of characters for quoted text or NULL if not used. | |
end | of line marker characters or NULL if not used. |
Definition at line 1225 of file string.h.
static const char* ucc::string::token | ( | char * | text, | |
char ** | last, | |||
const char * | list, | |||
const char * | quote = NULL , |
|||
const char * | end = NULL | |||
) | [static] |
A thread-safe token parsing routine for null terminated strings.
This is related to strtok, but with safety checks for NULL values and a number of enhancements including support for quoted text that may contain token seperators within quotes. The text string is modified as it is parsed.
text | string to examine for tokens. | |
last | token position or set to NULL for start of string. | |
list | of characters to use as token seperators. | |
quote | pairs of characters for quoted text or NULL if not used. | |
end | of line marker characters or NULL if not used. |
static long ucc::string::tol | ( | const char * | text, | |
char ** | pointer = NULL | |||
) | [inline, static] |
static long ucc::string::tol | ( | string & | object, | |
char ** | pointer = NULL | |||
) | [inline, static] |
static void ucc::string::trim | ( | string & | object, | |
const char * | list | |||
) | [inline, static] |
static char* ucc::string::trim | ( | char * | text, | |
const char * | list | |||
) | [static] |
Return start of string after characters to trim from beginning.
This function does not modify memory.
text | buffer to examine. | |
list | of characters to skip from start. |
void ucc::string::trim | ( | const char * | list | ) |
Trim lead characters from the string.
list | of characters to remove. |
static bool ucc::string::unquote | ( | string & | object, | |
const char * | quote | |||
) | [inline, static] |
static char* ucc::string::unquote | ( | char * | text, | |
const char * | quote | |||
) | [static] |
bool ucc::string::unquote | ( | const char * | quote | ) |
static void ucc::string::upper | ( | string & | object | ) | [inline, static] |
static void ucc::string::upper | ( | char * | text | ) | [static] |
Convert null terminated text to upper case.
text | to convert. |
strsize_t ucc::string::vprintf | ( | const char * | format, | |
va_list | args | |||
) |
static int ucc::string::vscanf | ( | string & | object, | |
const char * | format, | |||
va_list | args | |||
) | [inline, static] |
int ucc::string::vscanf | ( | const char * | format, | |
va_list | args | |||
) |
static int ucc::string::write | ( | FILE * | file, | |
string & | object | |||
) | [static] |
Write the string object to a file.
file | to write to. | |
object | to get data from. |
Write the string object to a socket.
socket | to write to. | |
object | to get data from. |
cstring* ucc::string::str [protected] |