ajstr


Data type AjPStr

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)

Name
AjPPStr
AjSStr
AjOStr

Iterator name(s)

NameDescription
AjIStr

Attributes

NameTypeDescription
Ressize_tReserved bytes (usable for expanding in place)
Lensize_tLength of current string, excluding NULL at end
Ptrchar*The string, as a NULL-terminated C string.
UseajuintUse 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.
PaddingajintPadding to alignment boundary


Data type AjIStr

String iterator, used to test iterator functionality.

Alias name(s)

Name
AjSStrIter
AjOStrIter

Constructor(s)

NameDescription
ajStrIterCreates and initialises an iterator for a string

Destructor(s)

NameDescription
ajStrIterFreeDestructor for a string iterator

Modifier(s)

NameDescription
ajStrIterNextSteps to the next iteration
ajStrIterBeginreturns result of first iteration
ajStrIterNextSteps to the next iteration
ajStrIterBackNextStep to previous character in string iterator.
ajStrIterEndreturns result of last iteration

Cast(s)

NameDescription
ajStrIterDoneTests whether iteration is complete
ajStrIterGetCreturns the character* from the iterator
ajStrIterGetKreturns the character from the iterator

Attributes

NameTypeDescription
Startchar*Starting string pointer
Endchar*Final string pointer (NULL character position)
Ptrchar*Current string pointer


Data type AjPStrTok

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

NameTypeDescription
StringAjPStrString
DelimAjPStrDelimiter set for ajStrToken
PosajuintPosition in string
Paddingchar[4]Padding to alignment boundary

Constructor(s)

NameDescription
ajStrTokenInitGenerates a string token parser object

Destructor(s)

NameDescription
ajStrTokenClearDestroys a string token parser