libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches
CMUTIL_JsonArray Struct Reference

JSON array type. More...

Data Fields

CMUTIL_Json parent
 
size_t(* GetSize )(const CMUTIL_JsonArray *jarr)
 Get the size of the JSON array.
 
CMUTIL_Json *(* Get )(const CMUTIL_JsonArray *jarr, uint32_t index)
 Get a JSON value from the JSON array by index.
 
int64_t(* GetLong )(const CMUTIL_JsonArray *jarr, uint32_t index)
 Get a long integer value from the JSON array by index.
 
double(* GetDouble )(const CMUTIL_JsonArray *jarr, uint32_t index)
 Get a double value from the JSON array by index.
 
const CMUTIL_String *(* GetString )(const CMUTIL_JsonArray *jarr, uint32_t index)
 Get a string value from the JSON array by index.
 
const char *(* GetCString )(const CMUTIL_JsonArray *jarr, uint32_t index)
 Get a C-style string value from the JSON array by index.
 
CMBool(* GetBoolean )(const CMUTIL_JsonArray *jarr, uint32_t index)
 Get a boolean value from the JSON array by index.
 
void(* Add )(CMUTIL_JsonArray *jarr, CMUTIL_Json *json)
 Add a JSON value to the JSON array.
 
void(* AddLong )(CMUTIL_JsonArray *jarr, int64_t value)
 Add a long integer value to the JSON array.
 
void(* AddDouble )(CMUTIL_JsonArray *jarr, double value)
 Add a double value to the JSON array.
 
void(* AddString )(CMUTIL_JsonArray *jarr, const char *value)
 Add a string value to the JSON array.
 
void(* AddBoolean )(CMUTIL_JsonArray *jarr, CMBool value)
 Add a boolean value to the JSON array.
 
void(* AddNull )(CMUTIL_JsonArray *jarr)
 Add a null value to the JSON array.
 
CMUTIL_Json *(* Remove )(CMUTIL_JsonArray *jarr, uint32_t index)
 Remove a JSON value from the JSON array by index.
 
void(* Delete )(CMUTIL_JsonArray *jarr, uint32_t index)
 Delete a JSON value from the JSON array by index.
 

Detailed Description

JSON array type.

Must be destroyed with CMUTIL_JsonDestroy.

Field Documentation

◆ parent

CMUTIL_Json CMUTIL_JsonArray::parent

JSON base object

◆ GetSize

size_t(* CMUTIL_JsonArray::GetSize) (const CMUTIL_JsonArray *jarr)

Get the size of the JSON array.

This method returns the number of elements in the JSON array.

Parameters
jarrThe JSON array to get the size from.
Returns
The size of the JSON array.

◆ Get

CMUTIL_Json *(* CMUTIL_JsonArray::Get) (const CMUTIL_JsonArray *jarr, uint32_t index)

Get a JSON value from the JSON array by index.

This method retrieves the JSON value at the specified index in the JSON array.

Parameters
jarrThe JSON array to get the JSON value from.
indexThe index of the JSON value to retrieve.
Returns
A pointer to the JSON value at the specified index, or NULL if the index is out of bounds.

◆ GetLong

int64_t(* CMUTIL_JsonArray::GetLong) (const CMUTIL_JsonArray *jarr, uint32_t index)

Get a long integer value from the JSON array by index.

This method retrieves the long integer value at the specified index in the JSON array.

Parameters
jarrThe JSON array to get the long integer value from.
indexThe index of the long integer value to retrieve.
Returns
The long integer value at the specified index, or 0 if the index is out of bounds or the value is not a long integer.

◆ GetDouble

double(* CMUTIL_JsonArray::GetDouble) (const CMUTIL_JsonArray *jarr, uint32_t index)

Get a double value from the JSON array by index.

This method retrieves the double value at the specified index in the JSON array.

Parameters
jarrThe JSON array to get the double value from.
indexThe index of the double value to retrieve.
Returns
The double value at the specified index, or 0.0 if the index is out of bounds or the value is not a double.

◆ GetString

const CMUTIL_String *(* CMUTIL_JsonArray::GetString) (const CMUTIL_JsonArray *jarr, uint32_t index)

Get a string value from the JSON array by index.

This method retrieves the string value at the specified index in the JSON array. Ownership of the returned string is not transferred to the caller.

Parameters
jarrThe JSON array to get the string value from.
indexThe index of the string value to retrieve.
Returns
A pointer to the string value at the specified index, or NULL if the index is out of bounds or the value is not a string.

◆ GetCString

const char *(* CMUTIL_JsonArray::GetCString) (const CMUTIL_JsonArray *jarr, uint32_t index)

Get a C-style string value from the JSON array by index.

This method retrieves the C-style string value at the specified index in the JSON array. Ownership of the returned string is not transferred to the caller.

Parameters
jarrThe JSON array to get the C-style string value from.
indexThe index of the C-style string value to retrieve.
Returns
A pointer to the C-style string value at the specified index, or NULL if the index is out of bounds or the value is not a C-style string.

◆ GetBoolean

CMBool(* CMUTIL_JsonArray::GetBoolean) (const CMUTIL_JsonArray *jarr, uint32_t index)

Get a boolean value from the JSON array by index.

This method retrieves the boolean value at the specified index in the JSON array.

Parameters
jarrThe JSON array to get the boolean value from.
indexThe index of the boolean value to retrieve.
Returns
The boolean value at the specified index, or CMFalse if the index is out of bounds or the value is not a boolean.

◆ Add

void(* CMUTIL_JsonArray::Add) (CMUTIL_JsonArray *jarr, CMUTIL_Json *json)

Add a JSON value to the JSON array.

This method appends a JSON value to the end of the JSON array. Ownership of the JSON value is transferred to the JSON array.

Parameters
jarrThe JSON array to add the JSON value to.
jsonThe JSON value to add.

◆ AddLong

void(* CMUTIL_JsonArray::AddLong) (CMUTIL_JsonArray *jarr, int64_t value)

Add a long integer value to the JSON array.

This method appends a long integer value to the end of the JSON array.

Parameters
jarrThe JSON array to add the long integer value to.
valueThe long integer value to add.

◆ AddDouble

void(* CMUTIL_JsonArray::AddDouble) (CMUTIL_JsonArray *jarr, double value)

Add a double value to the JSON array.

This method appends a double value to the end of the JSON array.

Parameters
jarrThe JSON array to add the double value to.
valueThe double value to add.

◆ AddString

void(* CMUTIL_JsonArray::AddString) (CMUTIL_JsonArray *jarr, const char *value)

Add a string value to the JSON array.

This method appends a string value to the end of the JSON array. Ownership of the string value is not transferred to the JSON array.

Parameters
jarrThe JSON array to add the string value to.
valueThe string value to add.

◆ AddBoolean

void(* CMUTIL_JsonArray::AddBoolean) (CMUTIL_JsonArray *jarr, CMBool value)

Add a boolean value to the JSON array.

This method appends a boolean value to the end of the JSON array.

Parameters
jarrThe JSON array to add the boolean value to.
valueThe boolean value to add.

◆ AddNull

void(* CMUTIL_JsonArray::AddNull) (CMUTIL_JsonArray *jarr)

Add a null value to the JSON array.

This method appends a null value to the end of the JSON array.

Parameters
jarrThe JSON array to add the null value to.

◆ Remove

CMUTIL_Json *(* CMUTIL_JsonArray::Remove) (CMUTIL_JsonArray *jarr, uint32_t index)

Remove a JSON value from the JSON array by index.

This method removes the JSON value at the specified index from the JSON array. Ownership of the removed JSON value is transferred to the caller.

Parameters
jarrThe JSON array to remove the JSON value from.
indexThe index of the JSON value to remove.
Returns
The removed JSON value, or NULL if the index is out of bounds.

◆ Delete

void(* CMUTIL_JsonArray::Delete) (CMUTIL_JsonArray *jarr, uint32_t index)

Delete a JSON value from the JSON array by index.

This method removes the JSON value at the specified index from the JSON array. Ownership of the removed JSON value is not transferred to the caller.

Parameters
jarrThe JSON array to delete the JSON value from.
indexThe index of the JSON value to delete.

The documentation for this struct was generated from the following file: