1 #ifndef LIBJSON_GUARD_STREAM_H
2 #define LIBJSON_GUARD_STREAM_H
8 #ifdef JSON_LESS_MEMORY
12 #pragma pack(push, JSONStream_pack, 1)
16 #ifdef JSON_MEMORY_CALLBACKS
17 #include "JSONMemory.h"
22 typedef void (*json_stream_callback_t)(JSONNode &,
void *);
27 LIBJSON_OBJECT(JSONStream);
28 JSONStream(json_stream_callback_t call_p, json_stream_e_callback_t call_e = NULL,
void * callbackIdentifier = JSONSTREAM_SELF) json_nothrow;
29 JSONStream(const JSONStream & orig) json_nothrow;
30 JSONStream & operator =(const JSONStream & orig) json_nothrow;
31 ~JSONStream(
void) json_nothrow { LIBJSON_DTOR; }
33 JSONStream & operator << (
const json_char * str) json_nothrow;
35 JSONStream & operator << (
const json_string & str) json_nothrow;
38 static void deleteJSONStream(JSONStream * stream) json_nothrow {
39 #ifdef JSON_MEMORY_CALLBACKS
40 stream -> ~JSONStream();
41 libjson_free<JSONStream>(stream);
47 static JSONStream * newJSONStream(json_stream_callback_t callback, json_stream_e_callback_t call_e,
void * callbackIdentifier) json_nothrow {
48 #ifdef JSON_MEMORY_CALLBACKS
49 return new(json_malloc<JSONStream>(1)) JSONStream(callback, call_e, callbackIdentifier);
51 return new JSONStream(callback, call_e, callbackIdentifier);
55 inline void reset() json_nothrow {
60 inline void * getIdentifier(
void) json_nothrow {
61 if (callback_identifier == JSONSTREAM_SELF){
64 return callback_identifier;
67 #if (JSON_READ_PRIORITY == HIGH) && (!(defined(JSON_LESS_MEMORY)))
68 template<json_
char ch>
69 static size_t FindNextRelevant(
const json_string & value_t,
const size_t pos) json_nothrow json_read_priority;
71 static size_t FindNextRelevant(json_char ch,
const json_string & value_t,
const size_t pos) json_nothrow json_read_priority;
74 void parse(
void) json_nothrow;
76 json_stream_callback_t call;
77 json_stream_e_callback_t err_call;
78 void * callback_identifier;
82 #ifdef JSON_LESS_MEMORY
86 #pragma pack(pop, JSONStream_pack)
void clear()
Clear all values from the vector, leaving with size of 0.