next up previous contents index
Next: 4.10.35 nxo_thread Up: 4.10 Classes Previous: 4.10.33 nxo_stack   Contents   Index

Subsections


4.10.34 nxo_string

The nxo_string class is a subclass of the nxo class. Strings are not `\0'-terminated, mainly since substrings are references to other strings, and the termination character wouldn't be consistently useful. nxo_string_cstring() is useful for creating `\0'-terminated copies of strings for situations where other C functions expect terminated strings.

4.10.34.1 API

void nxo_string_new(cw_nxo_t *a_nxo, bool a_locking, uint32_t a_len):

Input(s):
a_nxo:
Pointer to a string nxo.
a_locking:
Implicit locking mode.
a_len:
Length in bytes of string to create.
Output(s):
None.
Exception(s):
CW_ONYXX_OOM.
Description:
Constructor.
void nxo_string_substring_new(cw_nxo_t *a_nxo, cw_nxo_t *a_string, uint32_t a_offset, uint32_t a_len):

Input(s):
a_nxo:
Pointer to a string nxo.
a_string:
Pointer to a string nxo to create a substring of.
a_offset:
Offset into a_string.
a_len:
Length in bytes of substring to create.
Output(s):
None.
Exception(s):
CW_ONYXX_OOM.
Description:
Substring constructor.
void nxo_string_copy(cw_nxo_t *a_to, cw_nxo_t *a_from):

Input(s):
a_to:
Pointer to a string nxo.
a_from:
Pointer to a string nxo.
Output(s):
None.
Exception(s):
None.
Description:
Copy the contents of a_from to a_to. The length of a_to must be at least that of a_from.
void nxo_string_cstring(cw_nxo_t *a_to, cw_nxo_t *a_from, cw_nxo_t *a_thread):

Input(s):
a_to:
Pointer to an nxo.
a_from:
Pointer to a string or name nxo.
a_thread:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
CW_ONYXX_OOM.
Description:
Create a copy of a_from, but append a `\0' character to make it usable in calls to typical C functions that expect a terminated string.
uint32_t nxo_string_len_get(const cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
retval:
Length of a_nxo.
Exception(s):
None.
Description:
Return the length of a_nxo.
void nxo_string_el_get(const cw_nxo_t *a_nxo, cw_nxoi_t a_offset, char *r_el):

Input(s):
a_nxo:
Pointer to a string nxo.
a_offset:
Offset of character to get.
r_el:
Pointer to space to copy a character to.
Output(s):
*r_el:
A copy of the character of a_nxo at offset a_offset.
Exception(s):
None.
Description:
Get a copy of the character of a_nxo at offset a_offset.
void nxo_string_el_set(cw_nxo_t *a_nxo, char a_el, cw_nxoi_t a_offset):

Input(s):
a_nxo:
Pointer to a string nxo.
a_el:
A character.
a_offset:
Offset of character in a_nxo to replace with a_el.
Output(s):
None.
Exception(s):
None.
Description:
Copy a_el into the element of a_nxo at offset a_offset.
void nxo_string_lock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
None.
Exception(s):
None.
Description:
If implicit locking is activated for a_nxo, lock it.
void nxo_string_unlock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
None.
Exception(s):
None.
Description:
If implicit locking is activated for a_nxo, unlock it.
char * nxo_string_get(const cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
retval:
Pointer to the string internal to a_nxo.
Exception(s):
None.
Description:
Return a pointer to the string internal to a_nxo.
void nxo_string_set(cw_nxo_t *a_nxo, uint32_t a_offset, const char *a_str, uint32_t a_len):

Input(s):
a_nxo:
Pointer to a string nxo.
a_offset:
Offset into a_nxo to replace.
a_str:
String to replace a range of a_nxo with.
a_len:
Length in bytes of a_str.
Output(s):
None.
Exception(s):
None.
Description:
Replace a_len bytes of a_nxo at offset a_offset with a_str.


next up previous contents index
Next: 4.10.35 nxo_thread Up: 4.10 Classes Previous: 4.10.33 nxo_stack   Contents   Index
Jason Evans 2005-03-16