#include <string.h>
#include "ion_platform_config.h"
#include "ion_types.h"
Go to the source code of this file.
|
#define | DEFAULT_STRING_LENGTH 8 |
|
#define | ION_STRING_INIT(x) (x)->length = 0; (x)->value = NULL |
|
#define | ION_STRING_ASSIGN(dst, src) (dst)->length = (src)->length; (dst)->value = (src)->value |
|
#define | ION_STRING_IS_NULL(x) ((x) == NULL || ((x)->value == NULL)) |
|
#define | ION_STRING_EQUALS(x, y) (((x) == (y)) || (((x)->length == (y)->length) && (memcmp((x)->value, (y)->value, (x)->length) == 0))) |
|
#define | ION_STRING_CHAR_AT(str, ii) ((ii) < (str)->length ? (str)->value[ii] : -1) |
|
◆ DEFAULT_STRING_LENGTH
#define DEFAULT_STRING_LENGTH 8 |
default for minimum alloc, 8 is average from IBM study
◆ ion_string_get_byte()
ION_API_EXPORT BYTE ion_string_get_byte |
( |
ION_STRING * |
str, |
|
|
int |
idx |
|
) |
| |
Returns -1 is idx is out of range or str is null
◆ ion_string_get_bytes()
ION_API_EXPORT BYTE* ion_string_get_bytes |
( |
ION_STRING * |
str | ) |
|
Gets a pointer to the UTF-8 bytes held by the string. The number of bytes in the string is determined via ion_string_get_length().
- Parameters
-
- Returns
- a pointer to the first UTF-8 byte in the string; may be null. The byte sequence is not null-terminated.
◆ ion_string_get_length()
ION_API_EXPORT int ion_string_get_length |
( |
ION_STRING * |
str | ) |
|
Gets the number of UTF-8 bytes held by the string.
- Parameters
-
- Returns
- may be zero.