|
myMPD
Internal API documentation
|
Json print implementation for sds. More...
#include "compile_time.h"#include "src/lib/json/json_print.h"#include "src/lib/list.h"#include "src/lib/sds_extras.h"#include <math.h>#include <string.h>
Functions | |
| sds | json_comma (sds buffer) |
| sds | tojson_raw (sds buffer, const char *key, const char *value, bool comma) |
| sds | tojson_char (sds buffer, const char *key, const char *value, bool comma) |
| sds | tojson_sds (sds buffer, const char *key, sds value, bool comma) |
| sds | tojson_char_len (sds buffer, const char *key, const char *value, size_t len, bool comma) |
| sds | tojson_bool (sds buffer, const char *key, bool value, bool comma) |
| sds | tojson_int (sds buffer, const char *key, int value, bool comma) |
| sds | tojson_uint (sds buffer, const char *key, unsigned value, bool comma) |
| sds | tojson_time (sds buffer, const char *key, time_t value, bool comma) |
| sds | tojson_float (sds buffer, const char *key, float value, bool comma) |
| sds | tojson_int64 (sds buffer, const char *key, int64_t value, bool comma) |
| sds | tojson_uint64 (sds buffer, const char *key, uint64_t value, bool comma) |
| sds | list_to_json_array (sds s, struct t_list *l) |
Json print implementation for sds.
| sds json_comma | ( | sds | buffer | ) |
This unit provides functions for json printing Appends a comma on demand. Comma is omitted on start of string or end of string is already a comma.
| buffer | sds string to append |
| sds list_to_json_array | ( | sds | s, |
| struct t_list * | l | ||
| ) |
Prints the keys of a list as a json array Leading and ending square brackets are added
| s | sds string to append |
| l | pointer to list to add keys from |
| sds tojson_bool | ( | sds | buffer, |
| const char * | key, | ||
| bool | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for a bool value
| buffer | sds string to append |
| key | json key |
| value | bool value |
| comma | true to append a comma |
| sds tojson_char | ( | sds | buffer, |
| const char * | key, | ||
| const char * | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for 0-terminated char values value is encoded as json
| buffer | sds string to append |
| key | json key |
| value | to encode as json |
| comma | true to append a comma |
| sds tojson_char_len | ( | sds | buffer, |
| const char * | key, | ||
| const char * | value, | ||
| size_t | len, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for not 0-terminated values value is encoded as json
| buffer | sds string to append |
| key | json key |
| value | as sds string to encode as json |
| len | length of value |
| comma | true to append a comma |
| sds tojson_float | ( | sds | buffer, |
| const char * | key, | ||
| float | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for a float value
| buffer | sds string to append |
| key | json key |
| value | double value |
| comma | true to append a comma |
| sds tojson_int | ( | sds | buffer, |
| const char * | key, | ||
| int | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for an int value
| buffer | sds string to append |
| key | json key |
| value | integer value |
| comma | true to append a comma |
| sds tojson_int64 | ( | sds | buffer, |
| const char * | key, | ||
| int64_t | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for an int64_t value
| buffer | sds string to append |
| key | json key |
| value | int64_t value |
| comma | true to append a comma |
| sds tojson_raw | ( | sds | buffer, |
| const char * | key, | ||
| const char * | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for already encoded values value is printed raw without any encoding done
| buffer | sds string to append |
| key | json key |
| value | raw data |
| comma | true to append a comma |
| sds tojson_sds | ( | sds | buffer, |
| const char * | key, | ||
| sds | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for sds values value is encoded as json
| buffer | sds string to append |
| key | json key |
| value | as sds string to encode as json |
| comma | true to append a comma |
| sds tojson_time | ( | sds | buffer, |
| const char * | key, | ||
| time_t | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for a time_t value
| buffer | sds string to append |
| key | json key |
| value | time_t value |
| comma | true to append a comma |
| sds tojson_uint | ( | sds | buffer, |
| const char * | key, | ||
| unsigned | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for an unsigned
| buffer | sds string to append |
| key | json key |
| value | unsigned integer value |
| comma | true to append a comma |
| sds tojson_uint64 | ( | sds | buffer, |
| const char * | key, | ||
| uint64_t | value, | ||
| bool | comma | ||
| ) |
Prints a json key/value pair for an uint64_t value
| buffer | sds string to append |
| key | json key |
| value | uint64_t value |
| comma | true to append a comma |