CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
jsoncommon.h
Go to the documentation of this file.
1
26
27
#pragma once
28
29
#include <
cx/serialize/streambuf.h
>
30
36
38
typedef
enum
JSON_PARSE_CONTEXT
{
40
JSON_Top
,
42
JSON_Object
,
44
JSON_Array
,
45
}
JsonContextType
;
46
48
typedef
enum
JSON_PARSE_EVENT
{
50
JSON_Parse_Unknown
,
52
JSON_Object_Begin
,
54
JSON_Object_Key
,
56
JSON_Object_End
,
58
JSON_Array_Begin
,
60
JSON_Array_End
,
62
JSON_String
,
64
JSON_Int
,
66
JSON_Float
,
68
JSON_True
,
70
JSON_False
,
72
JSON_Null
,
74
JSON_Error
,
76
JSON_End
77
}
JsonEventType
;
78
79
typedef
struct
JSONParseContext
JSONParseContext
;
80
86
typedef
struct
JSONParseContext
{
88
JSONParseContext
*
parent
;
90
JsonContextType
ctype
;
91
93
union
{
95
string
curKey
;
97
int32
curIdx
;
98
}
cdata
;
99
}
JSONParseContext
;
100
105
typedef
struct
JSONParseEvent
{
107
JSONParseContext
*
ctx
;
108
110
JsonEventType
etype
;
112
union
{
114
int64
intData
;
116
double
floatData
;
118
string
strData
;
119
}
edata
;
120
}
JSONParseEvent
;
121
JSON_PARSE_EVENT
JSON_PARSE_EVENT
JSON parse event types.
Definition
jsoncommon.h:48
JSON_PARSE_CONTEXT
JSON_PARSE_CONTEXT
JSON parser context types.
Definition
jsoncommon.h:38
JsonEventType
enum JSON_PARSE_EVENT JsonEventType
JSON parse event types.
JsonContextType
enum JSON_PARSE_CONTEXT JsonContextType
JSON parser context types.
JSON_String
@ JSON_String
String value parsed.
Definition
jsoncommon.h:62
JSON_Null
@ JSON_Null
Null value parsed.
Definition
jsoncommon.h:72
JSON_Object_Begin
@ JSON_Object_Begin
New object starts at current context.
Definition
jsoncommon.h:52
JSON_Int
@ JSON_Int
Number parsed that fits in int64.
Definition
jsoncommon.h:64
JSON_Float
@ JSON_Float
Number parsed that requires float64.
Definition
jsoncommon.h:66
JSON_Array_End
@ JSON_Array_End
End of current array.
Definition
jsoncommon.h:60
JSON_End
@ JSON_End
Parsing finished; cleanup user context if needed.
Definition
jsoncommon.h:76
JSON_True
@ JSON_True
Boolean true value parsed.
Definition
jsoncommon.h:68
JSON_Array_Begin
@ JSON_Array_Begin
New array starts at current context.
Definition
jsoncommon.h:58
JSON_False
@ JSON_False
Boolean false value parsed.
Definition
jsoncommon.h:70
JSON_Object_End
@ JSON_Object_End
End of current object.
Definition
jsoncommon.h:56
JSON_Parse_Unknown
@ JSON_Parse_Unknown
Never sent; indicates a parse error.
Definition
jsoncommon.h:50
JSON_Object_Key
@ JSON_Object_Key
Valid JSON string parsed in object key context.
Definition
jsoncommon.h:54
JSON_Error
@ JSON_Error
Parse error occurred; strData contains error message (JSON_End follows)
Definition
jsoncommon.h:74
JSON_Array
@ JSON_Array
Currently parsing an array.
Definition
jsoncommon.h:44
JSON_Object
@ JSON_Object
Currently parsing an object.
Definition
jsoncommon.h:42
JSON_Top
@ JSON_Top
Top-level context (bare value)
Definition
jsoncommon.h:40
streambuf.h
Core stream buffer implementation for efficient data streaming.
JSONParseContext
Definition
jsoncommon.h:86
JSONParseContext::curKey
string curKey
Current key being parsed (for objects)
Definition
jsoncommon.h:95
JSONParseContext::curIdx
int32 curIdx
Current array index (for arrays)
Definition
jsoncommon.h:97
JSONParseContext::ctype
JsonContextType ctype
Type of current context.
Definition
jsoncommon.h:90
JSONParseContext::cdata
union JSONParseContext::@6 cdata
Context-specific data.
JSONParseContext::parent
JSONParseContext * parent
Parent context in the stack.
Definition
jsoncommon.h:88
JSONParseEvent
Definition
jsoncommon.h:105
JSONParseEvent::intData
int64 intData
Integer value (for JSON_Int)
Definition
jsoncommon.h:114
JSONParseEvent::edata
union JSONParseEvent::@7 edata
Event-specific data.
JSONParseEvent::ctx
JSONParseContext * ctx
Current parser context.
Definition
jsoncommon.h:107
JSONParseEvent::etype
JsonEventType etype
Type of event.
Definition
jsoncommon.h:110
JSONParseEvent::strData
string strData
String value (for JSON_String, JSON_Object_Key, JSON_Error)
Definition
jsoncommon.h:118
JSONParseEvent::floatData
double floatData
Float value (for JSON_Float)
Definition
jsoncommon.h:116
cx
serialize
jsoncommon.h
Generated by
1.9.8