A String buffer implementation. This implementation allows for dynamically creating string and appending to them in a reasonably efficient matter.
More...
|
typedef void * | ruString |
| An opaque data type representing a regify-util string object. More...
|
|
|
RUAPI ruString | ruStringNew (const char *instr) |
| Creates a new String object from a string. More...
|
|
RUAPI ruString | ruStringNewn (const char *instr, rusize size) |
| Creates a new String object of initial size from a string. More...
|
|
RUAPI ruString | ruStringNewf (const char *format,...) |
| Creates a new String object from a formatted string. More...
|
|
RUAPI int32_t | ruStringReset (ruString rs) |
| Empties the string for reuse without freeing the buffer. More...
|
|
RUAPI ruString | ruStringFree (ruString rs, bool keepBuffer) |
| Frees the given String Object object. More...
|
|
RUAPI int32_t | ruStringAppend (ruString rs, const char *str) |
| Append given string to String Object. More...
|
|
RUAPI int32_t | ruStringAppendUriEncoded (ruString rs, const char *instr) |
| Append given string URI encoded to String Object. More...
|
|
RUAPI int32_t | ruStringAppendn (ruString rs, const char *instr, rusize len) |
| Append given string to String Object. More...
|
|
RUAPI int32_t | ruStringAppendf (ruString rs, const char *format,...) |
| Appends formatted string to String Object. More...
|
|
RUAPI char * | ruStringGetCString (ruString rs) |
| Returns the underlying char* of the given String Object. More...
|
|
RUAPI rusize | ruStringLen (ruString rs, int32_t *code) |
| Returns the current length of the String Object. More...
|
|
RUAPI bool | ruStringEndsWith (ruString rs, const char *suffix, int32_t *code) |
| Whether String Object ends with given suffix. More...
|
|
A String buffer implementation. This implementation allows for dynamically creating string and appending to them in a reasonably efficient matter.
◆ ruString
An opaque data type representing a regify-util string object.
◆ ruStringAppend()
RUAPI int32_t ruStringAppend |
( |
ruString |
rs, |
|
|
const char * |
str |
|
) |
| |
Append given string to String Object.
- Parameters
-
rs | String buffer to append string to. |
str | String to append. |
- Returns
- RUE_OK on success else a regify error code.
◆ ruStringAppendf()
RUAPI int32_t ruStringAppendf |
( |
ruString |
rs, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Appends formatted string to String Object.
- Parameters
-
rs | String buffer to append string to. |
format | A general printf format string to format the remaining arguments. |
... | Any remaining arguments to add to the format string. |
- Returns
- RUE_OK on success else a regify error code.
◆ ruStringAppendn()
RUAPI int32_t ruStringAppendn |
( |
ruString |
rs, |
|
|
const char * |
instr, |
|
|
rusize |
len |
|
) |
| |
Append given string to String Object.
- Parameters
-
rs | String buffer to append string to. |
instr | String to append. |
len | Number of bytes of string to append or RU_SIZE_AUTO to use strlen to determine the length |
- Returns
- RUE_OK on success else a regify error code.
◆ ruStringAppendUriEncoded()
RUAPI int32_t ruStringAppendUriEncoded |
( |
ruString |
rs, |
|
|
const char * |
instr |
|
) |
| |
Append given string URI encoded to String Object.
- Parameters
-
rs | String buffer to append string to. |
instr | String to append. |
- Returns
- RUE_OK on success else a regify error code.
◆ ruStringEndsWith()
RUAPI bool ruStringEndsWith |
( |
ruString |
rs, |
|
|
const char * |
suffix, |
|
|
int32_t * |
code |
|
) |
| |
Whether String Object ends with given suffix.
- Parameters
-
rs | String buffer to check. |
suffix | Suffix to test for. |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- Whether string ends with suffix.
◆ ruStringFree()
Frees the given String Object object.
- Parameters
-
rs | String to free |
keepBuffer | Whether to also free the underlying char* buffer. |
◆ ruStringGetCString()
RUAPI char* ruStringGetCString |
( |
ruString |
rs | ) |
|
Returns the underlying char* of the given String Object.
- Parameters
-
rs | String buffer to return buffer of. |
- Returns
- Underlying char* or NULL in case rs was invalid.
◆ ruStringLen()
Returns the current length of the String Object.
- Parameters
-
rs | String buffer to return the length of. |
code | (Optional) Stores RUE_OK on success or regify error code. |
- Returns
- The length of the string or 0 in case of an error.
◆ ruStringNew()
RUAPI ruString ruStringNew |
( |
const char * |
instr | ) |
|
Creates a new String object from a string.
- Parameters
-
instr | String to start object with. |
- Returns
- The newly created String Object object to be freed with ruStringFree or NULL on error. Check ruLastError in case of NULL;
◆ ruStringNewf()
RUAPI ruString ruStringNewf |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
Creates a new String object from a formatted string.
- Parameters
-
format | A general printf format string to format the remaining arguments. |
... | Any remaining arguments to add to the format string. |
- Returns
- The newly created String Object object to be freed with ruStringFree or NULL on error. Check ruLastError in case of NULL;
◆ ruStringNewn()
Creates a new String object of initial size from a string.
- Parameters
-
instr | String to start object with. |
size | Initial buffer to allocate. When size is less than the length of instr, only size bytes of instr will be copied. |
- Returns
- The newly created String Object object to be freed with ruStringFree or NULL on error. Check ruLastError in case of NULL;
◆ ruStringReset()
RUAPI int32_t ruStringReset |
( |
ruString |
rs | ) |
|
Empties the string for reuse without freeing the buffer.
- Parameters
-
- Returns
- RUE_OK on success else a regify error code.