myMPD
Internal API documentation
Loading...
Searching...
No Matches
sds_json.h File Reference

JSON functions for sds strings. More...

#include "dist/sds/sds.h"
#include <stdbool.h>
#include <stdio.h>
Include dependency graph for sds_json.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

sds sds_catjson_plain (sds s, const char *p, size_t len)
sds sds_catjson (sds s, const char *p, size_t len)
sds sds_catjsonchar (sds s, const char c)
bool sds_json_unescape (const char *src, size_t slen, sds *dst)

Detailed Description

JSON functions for sds strings.

Function Documentation

◆ sds_catjson()

sds sds_catjson ( sds s,
const char * p,
size_t len )

Append to the sds string "s" a quoted json escaped string After the call, the modified sds string is no longer valid and all the references must be substituted with the new pointer returned by the call.

Parameters
ssds string
pstring to append json escaped
lenlength of the string to append
Returns
modified sds string

◆ sds_catjson_plain()

sds sds_catjson_plain ( sds s,
const char * p,
size_t len )

Append to the sds string "s" a json escaped string After the call, the modified sds string is no longer valid and all the references must be substituted with the new pointer returned by the call.

Parameters
ssds string
pstring to append json escaped
lenlength of the string to append
Returns
modified sds string

◆ sds_catjsonchar()

sds sds_catjsonchar ( sds s,
const char c )

Append to the sds string "s" an json escaped character After the call, the modified sds string is no longer valid and all the references must be substituted with the new pointer returned by the call.

Parameters
ssds string
cchar to escape and append
Returns
modified sds string

◆ sds_json_unescape()

bool sds_json_unescape ( const char * src,
size_t slen,
sds * dst )

Json unescapes "src" and appends the result to the sds string "dst" "dst" must be a pointer to a allocated sds string.

Parameters
srcstring to unescape
slenstring length to unescape
dstpointer to sds string to append the unescaped string
Returns
true on success, false on error