|
The types, constants and functions that constitute the cstring API.
Modules | |
Function Control Flags | |
These flags control the behaviour of the various functions in the library. | |
Classes | |
struct | cstring_t |
The cstring structure
Represents a cstring as a string slice - length + pointer - along with the allocated capacity, and flags controlling the allocation arena and other characteristics. More... | |
Defines | |
#define | cstring_t_DEFAULT { 0, NULL, 0, 0 } |
Default initialised value for a cstring_t instance. | |
Typedefs | |
typedef size_t | cstring_flags_t |
Flags type. | |
Enumerations | |
enum | CSTRING_RC { CSTRING_RC_SUCCESS = 0, CSTRING_RC_OUTOFMEMORY, CSTRING_RC_FIXED, CSTRING_RC_BORROWED, CSTRING_RC_READONLY, CSTRING_RC_INVALIDARENA, CSTRING_RC_CUSTOMARENANOTSUPPORTED, CSTRING_RC_EXCEEDFIXEDCAPACITY, CSTRING_RC_EXCEEDBORROWEDCAPACITY, CSTRING_RC_CANNOTYIELDFROMSO } |
The return code type of the cstring API. More... | |
Functions | |
char const * | cstring_error (CSTRING_RC rc) |
Returns a non-NULL nul-terminated character string describing the given error code. | |
CSTRING_RC | cstring_init (struct cstring_t *pcs) |
Initialises a cstring instance to a default form. | |
CSTRING_RC | cstring_create (struct cstring_t *pcs, char const *s) |
Creates a cstring instance from a C-style string. | |
CSTRING_RC | cstring_createLen (struct cstring_t *pcs, char const *s, size_t cch) |
Creates a cstring instance from a fixed number of characters. | |
CSTRING_RC | cstring_createEx (struct cstring_t *pcs, char const *s, cstring_flags_t flags, void *arena, size_t capacity) |
Creates a cstring instance with special characteristics from a C-style string. | |
CSTRING_RC | cstring_createLenEx (struct cstring_t *pcs, char const *s, size_t cch, cstring_flags_t flags, void *arena, size_t capacity) |
Creates a cstring instance with special characteristics from a fixed number of characters. | |
CSTRING_RC | cstring_destroy (struct cstring_t *pcs) |
Releases resources and resets the attributes of the cstring instance. | |
CSTRING_RC | cstring_yield2 (struct cstring_t *pcs, char **pPayload, void **pRaw) |
Removes the allocated buffer from the cstring instance into a caller supplied pointer. | |
CSTRING_RC | cstring_setCapacity (struct cstring_t *pcs, size_t capacity) |
Sets the capacity of the cstring instance. | |
CSTRING_RC | cstring_assign (struct cstring_t *pcs, char const *s) |
Assigns a C-style string to the cstring instance. | |
CSTRING_RC | cstring_assignLen (struct cstring_t *pcs, char const *s, size_t cch) |
Assigns a fixed number of characters to the cstring instance. | |
CSTRING_RC | cstring_copy (struct cstring_t *pcs, struct cstring_t const *pcsSrc) |
Copies the contents of one cstring instance to another. | |
CSTRING_RC | cstring_append (struct cstring_t *pcs, char const *s) |
Appends a C-style string to the cstring instance. | |
CSTRING_RC | cstring_appendLen (struct cstring_t *pcs, char const *s, size_t cch) |
Appends a fixed number of characters to the cstring instance. | |
CSTRING_RC | cstring_truncate (struct cstring_t *pcs, size_t len) |
Truncates the cstring instance. | |
CSTRING_RC | cstring_swap (struct cstring_t *pcs1, struct cstring_t *pcs2) |
Swaps the contents of the two cstring instances. |
|
Default initialised value for a cstring_t instance.
|
|
Flags type.
|
|
|
Appends a C-style string to the cstring instance.
|
|
Appends a fixed number of characters to the cstring instance.
|
|
Assigns a C-style string to the cstring instance.
|
|
Assigns a fixed number of characters to the cstring instance.
|
|
Copies the contents of one cstring instance to another.
|
|
Creates a cstring instance from a C-style string.
|
|
Creates a cstring instance with special characteristics from a C-style string.
|
|
Creates a cstring instance from a fixed number of characters.
|
|
Creates a cstring instance with special characteristics from a fixed number of characters.
|
|
Releases resources and resets the attributes of the cstring instance.
|
|
Returns a non-NULL nul-terminated character string describing the given error code.
|
|
Initialises a cstring instance to a default form.
|
|
Sets the capacity of the cstring instance.
|
|
Swaps the contents of the two cstring instances.
|
|
Truncates the cstring instance.
|
|
Removes the allocated buffer from the cstring instance into a caller supplied pointer.
|
|
cstring Library documentation © Matthew Wilson and Synesis Software Pty Ltd, 1994-2005 |