|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Third-party (vendored): jsmn JSON tokenizer implementation (see include/jsmn.h). More...
#include "jsmn.h"Go to the source code of this file.
Functions | |
| static jsmntok_t * | jsmn_alloc_token (jsmn_parser *parser, jsmntok_t *tokens, size_t num_tokens) |
| Allocates a fresh unused token from the token pull. | |
| static void | jsmn_fill_token (jsmntok_t *token, jsmntype_t type, int start, int end) |
| Fills token type and boundaries. | |
| static int | jsmn_parse_primitive (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens) |
| Fills next available token with JSON primitive. | |
| static int | jsmn_parse_string (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, size_t num_tokens) |
| Filsl next token with JSON string. | |
| int | jsmn_parse (jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens) |
| Parse JSON string and fill tokens. | |
| void | jsmn_init (jsmn_parser *parser) |
| Creates a new parser based over a given buffer with an array of tokens available. | |
| int | GetJSONTokenLevel (jsmntok_t *tokens, int startToken) |
| int | GetJSONToken (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type) |
| const char * | GetJSONValue (jsmntok_t *tokens, int tokenCount, const char *json, int token, int &valLength) |
| std::string | GetJSONValueString (jsmntok_t *tokens, int tokenCount, const char *json, int token) |
| int64 | GetJSONValueInt64 (jsmntok_t *tokens, int tokenCount, const char *json, int token) |
| uint64 | GetJSONValueUint64 (jsmntok_t *tokens, int tokenCount, const char *json, int token) |
| float64 | GetJSONValueFloat64 (jsmntok_t *tokens, int tokenCount, const char *json, int token) |
| const char * | GetJSONValue (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, jsmntype_t type, int &valLength, int level, int instance) |
| const char * | GetJSONChildValue (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type, int &valLength) |
| std::string | GetJSONValueString (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, jsmntype_t type, int level, int instance) |
| int64 | GetJSONValueInt64 (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, jsmntype_t type, int level, int instance) |
| uint64 | GetJSONValueUint64 (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, jsmntype_t type, int level, int instance) |
| float64 | GetJSONValueFloat64 (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, jsmntype_t type, int level, int instance) |
| std::string | GetJSONChildValueString (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type) |
| int64 | GetJSONChildValueInt64 (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type) |
| uint64 | GetJSONChildValueUint64 (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type) |
| float64 | GetJSONChildValueFloat64 (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type) |
| std::vector< int > | GetJSONArrayIndexes (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, jsmntype_t type, int level, int instance) |
| std::vector< int > | GetJSONChildArrayIndexes (jsmntok_t *tokens, int tokenCount, const char *json, const char *key, int parent, jsmntype_t type) |
| std::vector< int > | GetJSONChildArrayIndexes (jsmntok_t *tokens, int tokenCount, const char *json, int parent, jsmntype_t type) |
| std::string | AddToJSONRoot (const char *json, const char *subJSON) |
Third-party (vendored): jsmn JSON tokenizer implementation (see include/jsmn.h).
Not part of the CMSDK documentation remediation.
Definition in file jsmn.cpp.
| std::string AddToJSONRoot | ( | const char * | json, |
| const char * | subJSON ) |
Definition at line 539 of file jsmn.cpp.
References cmlabs::utils::laststrstr(), and cmlabs::utils::StringFormat().
Referenced by cmlabs::RequestGateway::replyToClient().
| std::vector< int > GetJSONArrayIndexes | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| jsmntype_t | type, | ||
| int | level, | ||
| int | instance ) |
Definition at line 464 of file jsmn.cpp.
References GetJSONTokenLevel(), and JSMN_UNDEFINED.
Referenced by cmlabs::RESTParser::extractParameters(), and cmlabs::RESTParser::extractParameters().
| std::vector< int > GetJSONChildArrayIndexes | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 492 of file jsmn.cpp.
References JSMN_UNDEFINED.
| std::vector< int > GetJSONChildArrayIndexes | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 519 of file jsmn.cpp.
References JSMN_UNDEFINED.
| const char * GetJSONChildValue | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type, | ||
| int & | valLength ) |
Definition at line 398 of file jsmn.cpp.
References jsmntok_t::end, JSMN_UNDEFINED, and jsmntok_t::start.
Referenced by GetJSONChildValueString().
| float64 GetJSONChildValueFloat64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 457 of file jsmn.cpp.
References cmlabs::utils::Ascii2Float64(), and GetJSONChildValueString().
| int64 GetJSONChildValueInt64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 449 of file jsmn.cpp.
References cmlabs::utils::Ascii2Int64(), and GetJSONChildValueString().
| std::string GetJSONChildValueString | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 441 of file jsmn.cpp.
References GetJSONChildValue().
Referenced by GetJSONChildValueFloat64(), GetJSONChildValueInt64(), GetJSONChildValueUint64(), and cmlabs::RequestGateway::receiveWebsocketData().
| uint64 GetJSONChildValueUint64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 453 of file jsmn.cpp.
References cmlabs::utils::Ascii2Uint64(), and GetJSONChildValueString().
Referenced by cmlabs::RequestGateway::receiveWebsocketData().
| int GetJSONToken | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| int | parent, | ||
| jsmntype_t | type ) |
Definition at line 328 of file jsmn.cpp.
References JSMN_UNDEFINED.
| int GetJSONTokenLevel | ( | jsmntok_t * | tokens, |
| int | startToken ) |
Definition at line 317 of file jsmn.cpp.
References jsmntok_t::parent.
Referenced by GetJSONArrayIndexes(), and GetJSONValue().
| const char * GetJSONValue | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| jsmntype_t | type, | ||
| int & | valLength, | ||
| int | level, | ||
| int | instance ) |
Definition at line 375 of file jsmn.cpp.
References jsmntok_t::end, GetJSONTokenLevel(), JSMN_UNDEFINED, and jsmntok_t::start.
| const char * GetJSONValue | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| int | token, | ||
| int & | valLength ) |
Definition at line 347 of file jsmn.cpp.
References jsmntok_t::end, and jsmntok_t::start.
Referenced by cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::RequestClient::GetJSONReplyParameter(), GetJSONValueString(), and GetJSONValueString().
| float64 GetJSONValueFloat64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| jsmntype_t | type, | ||
| int | level, | ||
| int | instance ) |
Definition at line 436 of file jsmn.cpp.
References cmlabs::utils::Ascii2Float64(), and GetJSONValueString().
| float64 GetJSONValueFloat64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| int | token ) |
Definition at line 370 of file jsmn.cpp.
References cmlabs::utils::Ascii2Float64(), and GetJSONValueString().
| int64 GetJSONValueInt64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| jsmntype_t | type, | ||
| int | level, | ||
| int | instance ) |
Definition at line 428 of file jsmn.cpp.
References cmlabs::utils::Ascii2Int64(), and GetJSONValueString().
| int64 GetJSONValueInt64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| int | token ) |
Definition at line 362 of file jsmn.cpp.
References cmlabs::utils::Ascii2Int64(), and GetJSONValueString().
| std::string GetJSONValueString | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| jsmntype_t | type, | ||
| int | level, | ||
| int | instance ) |
Definition at line 420 of file jsmn.cpp.
References GetJSONValue().
| std::string GetJSONValueString | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| int | token ) |
Definition at line 354 of file jsmn.cpp.
References GetJSONValue().
Referenced by GetJSONValueFloat64(), GetJSONValueFloat64(), GetJSONValueInt64(), GetJSONValueInt64(), GetJSONValueUint64(), and GetJSONValueUint64().
| uint64 GetJSONValueUint64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| const char * | key, | ||
| jsmntype_t | type, | ||
| int | level, | ||
| int | instance ) |
Definition at line 432 of file jsmn.cpp.
References cmlabs::utils::Ascii2Uint64(), and GetJSONValueString().
| uint64 GetJSONValueUint64 | ( | jsmntok_t * | tokens, |
| int | tokenCount, | ||
| const char * | json, | ||
| int | token ) |
Definition at line 366 of file jsmn.cpp.
References cmlabs::utils::Ascii2Uint64(), and GetJSONValueString().
|
static |
Allocates a fresh unused token from the token pull.
Definition at line 11 of file jsmn.cpp.
References jsmntok_t::end, jsmntok_t::parent, jsmntok_t::size, jsmntok_t::start, and jsmn_parser::toknext.
Referenced by jsmn_parse(), jsmn_parse_primitive(), and jsmn_parse_string().
|
static |
Fills token type and boundaries.
Definition at line 29 of file jsmn.cpp.
References jsmntok_t::end, jsmntok_t::size, jsmntok_t::start, and jsmntok_t::type.
Referenced by jsmn_parse_primitive(), and jsmn_parse_string().
| void jsmn_init | ( | jsmn_parser * | parser | ) |
Creates a new parser based over a given buffer with an array of tokens available.
Create JSON parser over an array of tokens.
Definition at line 311 of file jsmn.cpp.
References jsmn_parser::pos, jsmn_parser::toknext, and jsmn_parser::toksuper.
Referenced by cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::RequestClient::GetJSONReplyParameter(), and cmlabs::RequestGateway::receiveWebsocketData().
| int jsmn_parse | ( | jsmn_parser * | parser, |
| const char * | js, | ||
| size_t | len, | ||
| jsmntok_t * | tokens, | ||
| unsigned int | num_tokens ) |
Parse JSON string and fill tokens.
Run JSON parser.
Definition at line 156 of file jsmn.cpp.
References jsmntok_t::end, jsmn_alloc_token(), JSMN_ARRAY, JSMN_ERROR_INVAL, JSMN_ERROR_NOMEM, JSMN_ERROR_PART, JSMN_OBJECT, jsmn_parse_primitive(), jsmn_parse_string(), JSMN_STRING, jsmntok_t::parent, jsmn_parser::pos, jsmntok_t::size, jsmntok_t::start, jsmn_parser::toknext, jsmn_parser::toksuper, and jsmntok_t::type.
Referenced by cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractArrayParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::RESTParser::extractParameters(), cmlabs::RequestClient::GetJSONReplyParameter(), and cmlabs::RequestGateway::receiveWebsocketData().
|
static |
Fills next available token with JSON primitive.
Definition at line 40 of file jsmn.cpp.
References jsmn_alloc_token(), JSMN_ERROR_INVAL, JSMN_ERROR_NOMEM, JSMN_ERROR_PART, jsmn_fill_token(), JSMN_PRIMITIVE, jsmntok_t::parent, jsmn_parser::pos, and jsmn_parser::toksuper.
Referenced by jsmn_parse().
|
static |
Filsl next token with JSON string.
Definition at line 89 of file jsmn.cpp.
References jsmn_alloc_token(), JSMN_ERROR_INVAL, JSMN_ERROR_NOMEM, JSMN_ERROR_PART, jsmn_fill_token(), JSMN_STRING, jsmntok_t::parent, jsmn_parser::pos, and jsmn_parser::toksuper.
Referenced by jsmn_parse().