ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
#include <string.h>
Public Member Functions | |
cstring (size_t size) | |
Create a cstring node allocated for specified string size. More... | |
void | clear (size_t offset) |
Used to clear a string at specified offset. More... | |
void | set (size_t offset, const char *text, size_t size) |
Set part or all of a string with new text. More... | |
void | set (const char *text) |
Set our string from null terminated text up to our allocated size. More... | |
void | add (const char *text) |
Append null terminated text to our string buffer. More... | |
void | add (char character) |
Append a single character to our string buffer. More... | |
void | fix (void) |
Fill our string buffer to end if fill mode. More... | |
void | inc (size_t number) |
Adjust size of our string buffer by deleting characters from start of buffer. More... | |
void | dec (size_t number) |
Adjust size of our string buffer by deleting characters from end of buffer. More... | |
![]() | |
bool | is_copied (void) const |
Test if the object has copied references. More... | |
bool | is_retained (void) const |
Test if the object has been referenced (retained) by anyone yet. More... | |
unsigned | copied (void) const |
Return the number of active references (retentions) to our object. More... | |
void | retain (void) __OVERRIDE |
Increase reference count when retained. More... | |
void | release (void) __OVERRIDE |
Decrease reference count when released. More... | |
Public Attributes | |
size_t | max |
Allocated size of cstring text. More... | |
size_t | len |
Current length of cstring text. More... | |
char | text [1] |
Null terminated text, in overdraft space. More... | |
Protected Member Functions | |
virtual void | dealloc (void) __OVERRIDE |
Dealloc object no longer referenced. More... | |
![]() | |
CountedObject () | |
Construct a counted object, mark initially as unreferenced. More... | |
CountedObject (const ObjectProtocol &ref) | |
Construct a copy of a counted object. More... | |
virtual void | dealloc (void) |
Dealloc object no longer referenced. More... | |
void | reset (void) |
Force reset of count. More... | |
Private Member Functions | |
__DELETE_COPY (cstring) | |
ucommon::String::cstring::cstring | ( | size_t | size | ) |
Create a cstring node allocated for specified string size.
The new operator would also need the size as an overdraft value.
size | of string. |
Definition at line 32 of file string.cpp.
References len, max, ucommon::String::size(), and text.
|
private |
void ucommon::String::cstring::add | ( | char | character | ) |
Append a single character to our string buffer.
character | to append. |
Definition at line 104 of file string.cpp.
References ch, ucommon::String::fix(), ucommon::String::len(), and ucommon::max().
void ucommon::String::cstring::add | ( | const char * | text | ) |
Append null terminated text to our string buffer.
text | to append. |
Definition at line 86 of file string.cpp.
References ucommon::String::fix(), ucommon::String::len(), ucommon::max(), ucommon::String::size(), and ucommon::String::str.
Referenced by ucommon::String::add(), and ucommon::String::operator|().
void ucommon::String::cstring::clear | ( | size_t | offset | ) |
Used to clear a string at specified offset.
offset | to clear from. |
Definition at line 45 of file string.cpp.
References ucommon::String::len(), and ucommon::String::offset().
Referenced by ucommon::String::clear().
|
protectedvirtual |
Dealloc object no longer referenced.
The dealloc routine would commonly be used for a self delete to return the object back to a heap when it is no longer referenced.
Reimplemented from ucommon::CountedObject.
Definition at line 262 of file string.cpp.
void ucommon::String::cstring::dec | ( | size_t | number | ) |
Adjust size of our string buffer by deleting characters from end of buffer.
number | of characters to delete. |
Definition at line 54 of file string.cpp.
References ucommon::String::fix(), ucommon::String::len(), and ucommon::String::offset().
Referenced by ucommon::String::operator--(), and ucommon::String::operator-=().
void ucommon::String::cstring::fix | ( | void | ) |
Fill our string buffer to end if fill mode.
Definition at line 40 of file string.cpp.
References ucommon::String::len().
Referenced by ucommon::UString::add(), ucommon::String::chop(), ucommon::String::cut(), ucommon::String::erase(), ucommon::String::fill(), ucommon::String::fix(), ucommon::String::operator bool(), ucommon::String::operator!(), ucommon::String::paste(), ucommon::String::printf(), ucommon::UString::set(), ucommon::String::split(), ucommon::String::trim(), ucommon::String::unquote(), and ucommon::String::vprintf().
void ucommon::String::cstring::inc | ( | size_t | number | ) |
Adjust size of our string buffer by deleting characters from start of buffer.
number | of characters to delete. |
Definition at line 69 of file string.cpp.
References ucommon::String::fix(), ucommon::String::len(), and ucommon::String::offset().
Referenced by ucommon::String::operator++(), and ucommon::String::operator+=().
void ucommon::String::cstring::set | ( | const char * | text | ) |
Set our string from null terminated text up to our allocated size.
text | to set from. |
Definition at line 153 of file string.cpp.
References ucommon::String::fix(), ucommon::String::len(), ucommon::max(), ucommon::String::size(), and ucommon::String::str.
void ucommon::String::cstring::set | ( | size_t | offset, |
const char * | text, | ||
size_t | size | ||
) |
Set part or all of a string with new text.
offset | to set from. |
text | to insert from null terminated string. |
size | of field to modify. This is filled for fill mode. |
Definition at line 116 of file string.cpp.
References ucommon::String::len(), ucommon::max(), ucommon::String::offset(), ucommon::String::size(), and ucommon::String::str.
Referenced by ucommon::memstring::c_copy(), ucommon::String::clear(), ucommon::memstring::memstring(), ucommon::String::rsplit(), ucommon::String::set(), and ucommon::String::String().
size_t ucommon::String::cstring::len |
Current length of cstring text.
Definition at line 145 of file string.h.
Referenced by ucommon::UString::add(), ucommon::String::at(), ucommon::String::chop(), ucommon::String::count(), ucommon::String::cow(), cstring(), ucommon::String::cut(), ucommon::String::end(), ucommon::String::fill(), ucommon::String::find(), ucommon::String::fix(), ucommon::String::full(), ucommon::String::get(), ucommon::String::len(), ucommon::String::offset(), ucommon::String::operator bool(), ucommon::String::operator!(), ucommon::String::operator()(), ucommon::String::operator[](), ucommon::String::paste(), ucommon::String::printf(), ucommon::String::replace(), ucommon::String::rfind(), ucommon::String::rskip(), ucommon::String::rsplit(), ucommon::String::search(), ucommon::String::skip(), ucommon::String::split(), ucommon::String::trim(), and ucommon::String::vprintf().
size_t ucommon::String::cstring::max |
Allocated size of cstring text.
Definition at line 144 of file string.h.
Referenced by ucommon::memstring::c_copy(), ucommon::String::cow(), cstring(), ucommon::String::erase(), ucommon::String::fill(), ucommon::String::full(), ucommon::String::offset(), ucommon::String::printf(), ucommon::String::resize(), ucommon::String::rset(), ucommon::String::set(), ucommon::UString::set(), ucommon::String::size(), and ucommon::String::vprintf().
char ucommon::String::cstring::text[1] |
Null terminated text, in overdraft space.
Definition at line 146 of file string.h.
Referenced by ucommon::UString::add(), ucommon::String::at(), ucommon::UString::at(), ucommon::String::begin(), ucommon::memstring::c_copy(), ucommon::String::c_str(), ucommon::String::ccount(), ucommon::UString::ccount(), ucommon::String::chop(), ucommon::String::chr(), ucommon::String::compare(), ucommon::String::cow(), cstring(), ucommon::String::cut(), ucommon::UString::cut(), ucommon::String::data(), ucommon::String::end(), ucommon::String::equal(), ucommon::String::erase(), ucommon::String::fill(), ucommon::String::find(), ucommon::UString::find(), ucommon::String::fix(), ucommon::String::get(), ucommon::UString::get(), ucommon::String::lower(), ucommon::String::offset(), ucommon::String::operator%(), ucommon::String::operator()(), ucommon::UString::operator()(), ucommon::String::operator+(), ucommon::String::operator[](), ucommon::String::paste(), ucommon::UString::paste(), ucommon::String::printf(), ucommon::String::rchr(), ucommon::String::replace(), ucommon::String::rfind(), ucommon::UString::rfind(), ucommon::String::rset(), ucommon::String::rskip(), ucommon::String::rsplit(), ucommon::String::scanf(), ucommon::String::search(), ucommon::String::set(), ucommon::UString::set(), ucommon::String::skip(), ucommon::String::split(), ucommon::String::String(), ucommon::String::trim(), ucommon::String::unquote(), ucommon::String::upper(), ucommon::UString::UString(), ucommon::String::vprintf(), and ucommon::String::vscanf().