Nyx Node
Loading...
Searching...
No Matches
Collaboration diagram for JSON String Object:

Classes

struct  nyx_string_t
 Struct describing a JSON string object. More...

Functions

nyx_string_tnyx_string_t::nyx_string_new (void)
 Allocates a new JSON string object.
STR_t nyx_string_t::nyx_string_get (const nyx_string_t *object)
 Gets the text value of the provided JSON string object.
void nyx_string_t::nyx_string_get_buff (const nyx_string_t *object, __NYX_NULLABLE__ size_t *result_size, __NYX_NULLABLE__ buff_t *result_buff)
 Gets the content of the provided JSON string object as a byte buffer.
bool nyx_string_t::nyx_string_set (nyx_string_t *object, STR_t value, bool managed)
 Sets the text value of the provided JSON string object.
bool nyx_string_t::nyx_string_set_buff (nyx_string_t *object, size_t size, BUFF_t buff, bool managed)
 Sets the content of the provided JSON string object from a byte buffer.
size_t nyx_string_t::nyx_string_length (const nyx_string_t *object)
 Returns the number of content bytes of the provided JSON string object.
str_t nyx_string_t::nyx_string_to_string (const nyx_string_t *object)
 Returns a C string, with the special character escaping, representing the provided JSON string object.
str_t nyx_string_t::nyx_string_to_cstring (const nyx_string_t *object)
 Returns a C string, without special character escaping, representing the provided JSON string object.
__NYX_INLINE__ nyx_string_tnyx_string_t::nyx_string_from (STR_t value, bool managed)
 Returns a JSON string object holding the provided text value.
__NYX_INLINE__ nyx_string_tnyx_string_t::nyx_string_from_buff (size_t size, BUFF_t buff, bool managed)
 Returns a JSON string object holding the provided content bytes.

Detailed Description

JSON String Object.


Class Documentation

◆ nyx_string_t

struct nyx_string_t

Struct describing a JSON string object.

Definition at line 913 of file nyx_node.h.

Collaboration diagram for nyx_string_t:

Public Member Functions

nyx_string_tnyx_string_new (void)
 Allocates a new JSON string object.
STR_t nyx_string_get (const nyx_string_t *object)
 Gets the text value of the provided JSON string object.
void nyx_string_get_buff (const nyx_string_t *object, __NYX_NULLABLE__ size_t *result_size, __NYX_NULLABLE__ buff_t *result_buff)
 Gets the content of the provided JSON string object as a byte buffer.
bool nyx_string_set (nyx_string_t *object, STR_t value, bool managed)
 Sets the text value of the provided JSON string object.
bool nyx_string_set_buff (nyx_string_t *object, size_t size, BUFF_t buff, bool managed)
 Sets the content of the provided JSON string object from a byte buffer.
size_t nyx_string_length (const nyx_string_t *object)
 Returns the number of content bytes of the provided JSON string object.
str_t nyx_string_to_string (const nyx_string_t *object)
 Returns a C string, with the special character escaping, representing the provided JSON string object.
str_t nyx_string_to_cstring (const nyx_string_t *object)
 Returns a C string, without special character escaping, representing the provided JSON string object.
__NYX_INLINE__ nyx_string_tnyx_string_from (STR_t value, bool managed)
 Returns a JSON string object holding the provided text value.
__NYX_INLINE__ nyx_string_tnyx_string_from_buff (size_t size, BUFF_t buff, bool managed)
 Returns a JSON string object holding the provided content bytes.

Public Attributes

nyx_object_t base
 Common object header for JSON objects.
bool managed
 true if the value is freed with this object.
size_t length
 C string length excluding NULL.
str_t value
 C string payload.

Function Documentation

◆ nyx_string_new()

nyx_string_t * nyx_string_new ( void )

Allocates a new JSON string object.

Returns
The new JSON string object.

Definition at line 14 of file json_string.c.

◆ nyx_string_get()

STR_t nyx_string_get ( const nyx_string_t * object)

Gets the text value of the provided JSON string object.

Parameters
objectJSON string object.
Returns
The text value of the provided JSON string object.
Note
The returned text value remains valid until the object is modified or released.

Definition at line 56 of file json_string.c.

◆ nyx_string_get_buff()

void nyx_string_get_buff ( const nyx_string_t * object,
__NYX_NULLABLE__ size_t * result_size,
__NYX_NULLABLE__ buff_t * result_buff )

Gets the content of the provided JSON string object as a byte buffer.

Parameters
objectJSON string object.
result_sizeOptional pointer receiving the number of content bytes.
result_buffOptional pointer receiving the content buffer.
Note
The returned buffer remains valid until the object is modified or released.

◆ nyx_string_set()

bool nyx_string_set ( nyx_string_t * object,
STR_t value,
bool managed )

Sets the text value of the provided JSON string object.

Parameters
objectJSON string object.
valueText value.
managedIf true, ownership of the provided value is transferred to the object.
Returns
true if the value was modified, false otherwise.

Definition at line 76 of file json_string.c.

◆ nyx_string_set_buff()

bool nyx_string_set_buff ( nyx_string_t * object,
size_t size,
BUFF_t buff,
bool managed )

Sets the content of the provided JSON string object from a byte buffer.

Parameters
objectJSON string object.
sizeNumber of content bytes.
buffContent buffer.
managedIf true, ownership of the provided buffer is transferred to the object.
Returns
true if the value was modified, false otherwise.

Definition at line 112 of file json_string.c.

◆ nyx_string_length()

size_t nyx_string_length ( const nyx_string_t * object)

Returns the number of content bytes of the provided JSON string object.

Parameters
objectJSON string object.
Returns
The number of content bytes.

Definition at line 148 of file json_string.c.

◆ nyx_string_to_string()

str_t nyx_string_to_string ( const nyx_string_t * object)

Returns a C string, with the special character escaping, representing the provided JSON string object.

Parameters
objectJSON string object.
Returns
A newly allocated string that represents the provided JSON string object.
Note
Must be freed with nyx_memory_free.

Definition at line 155 of file json_string.c.

◆ nyx_string_to_cstring()

str_t nyx_string_to_cstring ( const nyx_string_t * object)

Returns a C string, without special character escaping, representing the provided JSON string object.

Parameters
objectJSON string object.
Returns
A newly allocated string that represents the provided JSON string object.
Note
Must be freed with nyx_memory_free.

Definition at line 172 of file json_string.c.

◆ nyx_string_from()

__NYX_INLINE__ nyx_string_t * nyx_string_from ( STR_t value,
bool managed )

Returns a JSON string object holding the provided text value.

Parameters
valueText value.
managedIf true, ownership of the provided value is transferred to the object.
Returns
The new JSON string object.

Definition at line 1051 of file nyx_node.h.

◆ nyx_string_from_buff()

__NYX_INLINE__ nyx_string_t * nyx_string_from_buff ( size_t size,
BUFF_t buff,
bool managed )

Returns a JSON string object holding the provided content bytes.

Parameters
sizeNumber of content bytes.
buffContent buffer.
managedIf true, ownership of the provided buffer is transferred to the object.
Returns
The new JSON string object.

Definition at line 1071 of file nyx_node.h.