ajstr
Ajax string object.
Holds a null terminated character string with additional data.
The length is known and held internally.
The reserved memory size is known and held internally.
The reference count is known and held internally.
New pointers can refer to the same string without needing
to duplicate the character data.
If a string has multiple references it cannot be changed. Any
instance to be changed is first copied to a new string. This
means that any function which can change the character data must
pass a pointer to the string so that the string can be moved.
A default null string is provided. New strings are by default
implemented as pointers to this with increased reference counters.
AjPStr is implemented as a pointer to a C data structure.
Alias name(s)
Iterator name(s)
Attributes
Name | Type | Description |
Res | size_t | Reserved bytes (usable for expanding in place)
|
Len | size_t | Length of current string, excluding NULL at end
|
Ptr | char* | The string, as a NULL-terminated C string.
|
Use | ajuint | Use count: 1 for single reference, more if several
pointers share the same string.
Must drop to 0 before deleting. Modifying means making
a new string if not 1.
|
Padding | ajint | Padding to alignment boundary
|
String iterator, used to test iterator functionality.
Alias name(s)
Constructor(s)
Name | Description |
ajStrIter | Creates and initialises an iterator for a string
|
Destructor(s)
Modifier(s)
Cast(s)
Attributes
Name | Type | Description |
Start | char* | Starting string pointer
|
End | char* | Final string pointer (NULL character position)
|
Ptr | char* | Current string pointer
|
String token parser object for the string parsing functions. These normally
require a set of characters to be skipped, but some functions use a string
delimiter instead.
Attributes
Name | Type | Description |
String | AjPStr | String
|
Delim | AjPStr | Delimiter set for ajStrToken
|
Pos | ajuint | Position in string
|
Padding | char[4] | Padding to alignment boundary
|
Constructor(s)
Destructor(s)