UCommon
Public Member Functions
ucommon::stringbuf< S > Class Template Reference

A string class that has a predefined string buffer. More...

#include <string.h>

Inheritance diagram for ucommon::stringbuf< S >:
Inheritance graph
[legend]
Collaboration diagram for ucommon::stringbuf< S >:
Collaboration graph
[legend]

Public Member Functions

void operator= (const char *text)
 Assign a string buffer from a null terminated string.
void operator= (string &object)
 Assign a string buffer from another string object.
 stringbuf ()
 Create an empty instance of a string buffer.
 stringbuf (const char *text)
 Create a string buffer from a null terminated string.
- Public Member Functions inherited from ucommon::memstring
 memstring (void *memory, strsize_t size, char fill=0)
 Create an instance of a memory string.
 ~memstring ()
 Destroy memory string.
- Public Member Functions inherited from ucommon::string
int __isoc99_scanf (const char *format,...)
 Scan input items from a string object.
int __isoc99_vscanf (const char *format, va_list args)
 Scan input items from a string object.
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.
char at (int position) const
 Return character found at a specific position in the string.
const char * begin (void) const
 Get pointer to first character in string for iteration.
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.
strsize_t ccount (const char *list) const
 Count number of occurrences of characters in string.
void chop (const char *list)
 Chop trailing characters from the string.
void chop (strsize_t count=1)
 Chop trailing characters from text.
const char * chr (char character) const
 Find pointer in string where specified character appears.
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.
int collate (const char *string) const
virtual int compare (const char *string) const
 Compare the values of two string.
string copy (strsize_t offset, strsize_t size) const
 Convenience method for substring extraction.
strsize_t count (void) const
 Count all characters in the string (strlen).
void cut (strsize_t offset, strsize_t size=0)
 Cut (remove) text from string.
const char * end (void) const
 Get pointer to last character in string for iteration.
char fill (void)
 Get filler character used for field array strings.
const char * find (const char *list, strsize_t offset=0) const
 Find a character in the string.
bool full (void) const
 Test if the string's allocated space is all used up.
string get (strsize_t offset, strsize_t size=0) const
 Get a new string object as a substring of the current object.
string left (strsize_t size) const
 Convenience method for left of string.
strsize_t len (void)
 Get length of string.
void lower (void)
 Convert string to lower case.
strsize_t offset (const char *pointer) const
 Find offset of a pointer into our string buffer.
 operator bool () const
 Test if string has data.
 operator const char * () const
 Casting reference to raw text string.
bool operator! () const
 Test if string is empty.
bool operator!= (const char *text) const
 Compare our object with null terminated text.
stringoperator% (short &value)
 Parse short integer value from a string.
stringoperator% (unsigned short &value)
 Parse long integer value from a string.
stringoperator% (long &value)
 Parse long integer value from a string.
stringoperator% (unsigned long &value)
 Parse long integer value from a string.
stringoperator% (double &value)
 Parse double value from a string.
stringoperator% (const char *text)
 Parse text from a string in a scan expression.
stringoperator& (const char *text)
 Concatenate null terminated text to our object.
stringoperator&= (const char *text)
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* () const
 Reference raw text buffer by pointer operator.
bool operator*= (const char *substring)
bool operator*= (regex &expr)
stringoperator*= (strsize_t number)
 Delete a specified number of characters from start of string.
stringoperator+ (const char *text)
 Concatenate null terminated text to our object.
stringoperator++ (void)
 Delete first character from string.
stringoperator+= (const char *text)
 Concatenate text to an existing string object.
stringoperator+= (strsize_t number)
 Delete a specified number of characters from start of string.
stringoperator-- (void)
 Delete last character from string.
stringoperator-= (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.
stringoperator<< (const char *text)
stringoperator<< (char code)
bool operator<= (const char *text) const
 Compare our object with null terminated text.
stringoperator= (const string &object)
 Assign our string with the cstring of another object.
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.
const char operator[] (int offset) const
 Reference a single character in string object by array offset.
string operator^ (const char *text)
 Transitional concat operator until abi can be changed.
stringoperator^= (const string &object)
 Create new cow instance and assign value from another string object.
stringoperator^= (const char *text)
 Create new cow instance and assign value from null terminated text.
stringoperator| (const char *text)
 Concatenate null terminated text to our object.
stringoperator|= (const char *text)
 Concatenate text to an existing string object.
void paste (strsize_t offset, const char *text, strsize_t size=0)
 Insert (paste) text into string.
strsize_t printf (const char *format,...)
 Print items into a string object.
const char * rchr (char character) const
 Find pointer in string where specified character last appears.
unsigned replace (const char *string, const char *text=((void *) 0), unsigned flags=0)
unsigned replace (regex &expr, const char *text=((void *) 0), unsigned flags=0)
virtual bool resize (strsize_t size)
 Resize and re-allocate string memory.
const char * rfind (const char *list, strsize_t offset=npos) const
 Find last occurrence of character in the string.
string right (strsize_t offset) const
 Convenience method for right of string.
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.
const char * rskip (const char *list, strsize_t offset=npos) const
 Skip trailing characters in the string.
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 * search (const char *string, unsigned instance=0, unsigned flags=0) const
 Search for a substring in the string.
const char * search (regex &expr, unsigned instance=0, unsigned flags=0) const
void set (const char *text)
 Set string object to text of a null terminated string.
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.
strsize_t size (void) const
 Get the size of currently allocated space for string.
const char * skip (const char *list, strsize_t offset=0) const
 Skip lead characters 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.
 string ()
 Create a new empty string object.
 string (long value)
 Create a string from a long integer.
 string (double value)
 Create a string from a floating point.
 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.
void strip (const char *list)
 Strip lead and trailing characters from the string.
void trim (const char *list)
 Trim lead characters from the string.
void trim (strsize_t count=1)
 Trim lead characters from text.
bool unquote (const char *quote)
 Unquote a quoted string.
void upper (void)
 Convert string to upper case.
strsize_t vprintf (const char *format, va_list args)
 Print items into a string object.
virtual ~string ()
 Destroy string.
- Public Member Functions inherited from ucommon::ObjectProtocol
ObjectProtocolcopy (void)
 Retain (increase retention of) object when copying.
virtual ~ObjectProtocol ()
 Required virtual destructor.

Additional Inherited Members

- Public Types inherited from ucommon::string
enum  { SENSITIVE = 0x00, INSENSITIVE = 0x01 }
 This is an internal class which contains the actual string data along with some control fields. More...
- Static Public Member Functions inherited from ucommon::memstring
static memstringcreate (strsize_t size, char fill=0)
 Create a memory string with memory allocated from the heap.
static memstringcreate (MemoryProtocol *pager, strsize_t size, char fill=0)
 Create a memory string with memory allocated from a pager.
- Static Public Attributes inherited from ucommon::memstring
static const size_t header
- Protected Member Functions inherited from ucommon::memstring
cstring * c_copy (void) const
 Return cstring to use in copy constructors.
- Protected Attributes inherited from ucommon::string
cstring * str
 cstring instance our object references.

Detailed Description

template<strsize_t S>
class ucommon::stringbuf< S >

A string class that has a predefined string buffer.

The string class and buffer are allocated together as one object. This allows one to use string objects entirely resident on the local stack as well as on the heap. Using a string class on the local stack may be more convenient than a char array since one can use all the features of the class including assignment and concatenation which a char buffer cannot as easily do.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 1777 of file string.h.

Constructor & Destructor Documentation

template<strsize_t S>
ucommon::stringbuf< S >::stringbuf ( const char *  text)
inline

Create a string buffer from a null terminated string.

Parameters
textto place in object.

Definition at line 1792 of file string.h.

Member Function Documentation

template<strsize_t S>
void ucommon::stringbuf< S >::operator= ( const char *  text)
inline

Assign a string buffer from a null terminated string.

Parameters
textto assign to object.

Reimplemented from ucommon::memstring.

Definition at line 1798 of file string.h.

template<strsize_t S>
void ucommon::stringbuf< S >::operator= ( string object)
inline

Assign a string buffer from another string object.

Parameters
objectto assign from.

Reimplemented from ucommon::memstring.

Definition at line 1805 of file string.h.


The documentation for this class was generated from the following file: