Teonet library
0.4.7
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
jsmn.h
Go to the documentation of this file.
1
#ifndef __JSMN_H_
2
#define __JSMN_H_
3
4
#include <stddef.h>
5
6
#ifdef __cplusplus
7
extern
"C"
{
8
#endif
9
17
typedef
enum
{
18
JSMN_UNDEFINED
= 0,
19
JSMN_OBJECT
= 1,
20
JSMN_ARRAY
= 2,
21
JSMN_STRING
= 3,
22
JSMN_PRIMITIVE
= 4
23
}
jsmntype_t
;
24
25
enum
jsmnerr
{
26
/* Not enough tokens were provided */
27
JSMN_ERROR_NOMEM
= -1,
28
/* Invalid character inside JSON string */
29
JSMN_ERROR_INVAL
= -2,
30
/* The string is not a full JSON packet, more bytes expected */
31
JSMN_ERROR_PART
= -3
32
};
33
40
typedef
struct
{
41
jsmntype_t
type
;
42
int
start
;
43
int
end
;
44
int
size
;
45
#ifdef JSMN_PARENT_LINKS
46
int
parent;
47
#endif
48
}
jsmntok_t
;
49
54
typedef
struct
{
55
unsigned
int
pos
;
/* offset in the JSON string */
56
unsigned
int
toknext
;
/* next token to allocate */
57
int
toksuper
;
/* superior token node, e.g parent object or array */
58
}
jsmn_parser
;
59
63
void
jsmn_init
(
jsmn_parser
*parser);
64
69
int
jsmn_parse
(
jsmn_parser
*parser,
const
char
*js,
size_t
len,
70
jsmntok_t
*tokens,
unsigned
int
num_tokens);
71
72
#ifdef __cplusplus
73
}
74
#endif
75
76
#endif
/* __JSMN_H_ */
jsmntok_t
JSON token description.
Definition:
jsmn.h:40
jsmn_parse
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens)
Run JSON parser.
Definition:
jsmn.c:151
jsmntype_t
jsmntype_t
JSON type identifier.
Definition:
jsmn.h:17
JSMN_UNDEFINED
Definition:
jsmn.h:18
jsmn_parser::toknext
unsigned int toknext
Definition:
jsmn.h:56
JSMN_STRING
Definition:
jsmn.h:21
JSMN_ERROR_NOMEM
Definition:
jsmn.h:27
JSMN_OBJECT
Definition:
jsmn.h:19
jsmntok_t::type
jsmntype_t type
Definition:
jsmn.h:41
jsmn_parser
JSON parser.
Definition:
jsmn.h:54
JSMN_PRIMITIVE
Definition:
jsmn.h:22
jsmn_init
void jsmn_init(jsmn_parser *parser)
Create JSON parser over an array of tokens.
Definition:
jsmn.c:309
jsmn_parser::toksuper
int toksuper
Definition:
jsmn.h:57
jsmntok_t::start
int start
Definition:
jsmn.h:42
JSMN_ERROR_INVAL
Definition:
jsmn.h:29
JSMN_ERROR_PART
Definition:
jsmn.h:31
JSMN_ARRAY
Definition:
jsmn.h:20
jsmntok_t::end
int end
Definition:
jsmn.h:43
jsmntok_t::size
int size
Definition:
jsmn.h:44
jsmn_parser::pos
unsigned int pos
Definition:
jsmn.h:55
jsmnerr
jsmnerr
Definition:
jsmn.h:25
app
embedded
jsmn
jsmn.h
Generated on Tue Apr 13 2021 12:51:55 for Teonet library by
1.8.6