This is an internal class which contains the actual string data along with some control fields.
More...
#include <string.h>
Public Member Functions |
void | add (char *text) |
| Append null terminated text to our string buffer.
|
void | add (char character) |
| Append a single character to our string buffer.
|
void | clear (strsize_t offset, strsize_t size) |
| Used to clear a string.
|
| cstring (strsize_t size) |
| Create a cstring node allocated for specified string size.
|
| cstring (strsize_t size, char fill) |
| Create a filled cstring node allocated for specified string size.
|
void | dec (strsize_t number) |
| Adjust size of our string buffer by deleting characters from end of buffer.
|
void | fix (void) |
| Fill our string buffer to end if fill mode.
|
void | inc (strsize_t number) |
| Adjust size of our string buffer by deleting characters from start of buffer.
|
void | set (strsize_t offset, char *text, strsize_t size) |
| Set part or all of a string with new text.
|
void | set (char *text) |
| Set our string from null terminated text up to our allocated size.
|
void | unfix (void) |
| Trim filler at end to reduce filled string to null terminated string for further processing.
|
unsigned | copied (void) |
| Return the number of active references (retentions) to our object.
|
bool | isCopied (void) |
| Test if the object has copied references.
|
bool | isRetained (void) |
| Test if the object has been referenced (retained) by anyone yet.
|
void | release (void) |
| Decrease reference count when released.
|
void | retain (void) |
| Increase reference count when retained.
|
ObjectProtocol * | copy (void) |
| Retain (increase retention of) object when copying.
|
void | operator++ (void) |
| Increase retention operator.
|
void | operator-- (void) |
| Decrease retention operator.
|
virtual | ~ObjectProtocol () |
| Required virtual destructor.
|
Data Fields |
char | fill |
| Filler character or 0 for none.
|
strsize_t | len |
| Current length of cstring text.
|
strsize_t | max |
| Allocated size of cstring text.
|
char | text [1] |
| Null terminated text, in overdraft space.
|
Additional Inherited Members |
| CountedObject () |
| Construct a counted object, mark initially as unreferenced.
|
| CountedObject (ObjectProtocol &ref) |
| Construct a copy of a counted object.
|
virtual void | dealloc (void) |
| Dealloc object no longer referenced.
|
Detailed Description
This is an internal class which contains the actual string data along with some control fields.
The string can be either NULL terminated or filled like a Pascal-style string, but with a user selected fill character. The cstring object is an overdraft object, as the actual string text which is of unknown size follows immediately after the class control data. This class is primarily for internal use.
- Author:
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 97 of file string.h.
Constructor & Destructor Documentation
ucommon::string::cstring::cstring |
( |
strsize_t |
size | ) |
|
Create a cstring node allocated for specified string size.
The new operator would also need the size as an overdraft value.
- Parameters:
-
ucommon::string::cstring::cstring |
( |
strsize_t |
size, |
|
|
char |
fill |
|
) |
| |
Create a filled cstring node allocated for specified string size.
The new operator would also need the size as an overdraft value. The newly allocated string is filled with the fill value.
- Parameters:
-
size | of string. |
fill | character value to fill string with. |
Member Function Documentation
void ucommon::string::cstring::add |
( |
char * |
text | ) |
|
Append null terminated text to our string buffer.
- Parameters:
-
void ucommon::string::cstring::add |
( |
char |
character | ) |
|
Append a single character to our string buffer.
- Parameters:
-
Used to clear a string.
If null terminated, then the string ends at the offset, otherwise it is simply filled with fill data up to the specified size.
- Parameters:
-
offset | to clear from. |
size | of field to clear. |
void ucommon::string::cstring::dec |
( |
strsize_t |
number | ) |
|
Adjust size of our string buffer by deleting characters from end of buffer.
- Parameters:
-
number | of characters to delete. |
void ucommon::string::cstring::inc |
( |
strsize_t |
number | ) |
|
Adjust size of our string buffer by deleting characters from start of buffer.
- Parameters:
-
number | of characters to delete. |
Set part or all of a string with new text.
- Parameters:
-
offset | to set from. |
text | to insert from null terminated string. |
size | of field to modify. This is filled for fill mode. |
void ucommon::string::cstring::set |
( |
char * |
text | ) |
|
Set our string from null terminated text up to our allocated size.
- Parameters:
-
The documentation for this class was generated from the following file: