CBMC
|
Provides methods for streaming JSON arrays. More...
#include <json_stream.h>
Public Member Functions | |
json_stream_arrayt (std::ostream &out, unsigned indent=0) | |
Construct a new JSON array stream. More... | |
~json_stream_arrayt () override | |
Flushes and closes the stream on destruction. More... | |
void | push_back (const jsont &json) |
Push back a JSON element into the current array stream. More... | |
jsont & | push_back () |
Push back and return a new non-streaming JSON element into the current array stream. More... | |
json_stream_objectt & | push_back_stream_object () |
Add a JSON object child stream. More... | |
json_stream_arrayt & | push_back_stream_array () |
Add a JSON array child stream. More... | |
Public Member Functions inherited from json_streamt | |
void | close () |
Outputs the current current child stream and closes this JSON stream. More... | |
virtual | ~json_streamt ()=default |
Protected Member Functions | |
void | output_child_stream () override |
Output the non-streaming JSON objects and closes the current child stream. More... | |
void | output_finalizer () override |
Output the finalizing character for a JSON array. More... | |
Protected Member Functions inherited from json_streamt | |
json_streamt (std::ostream &_out, unsigned _indent) | |
Constructor to be used by derived classes. More... | |
json_stream_arrayt & | create_child_stream_array () |
Create a new JSON array child stream. More... | |
json_stream_objectt & | create_child_stream_object () |
Create a new JSON object child stream. More... | |
void | output_delimiter () |
Outputs the delimiter between JSON elements. More... | |
Additional Inherited Members | |
Protected Types inherited from json_streamt | |
typedef std::map< std::string, jsont > | objectt |
Non-streaming JSON elements These will be printed when closing the stream or creating a child stream. More... | |
Protected Attributes inherited from json_streamt | |
bool | open |
Denotes whether the current stream is open or has been invalidated. More... | |
std::ostream & | out |
unsigned | indent |
bool | first |
Is the current element the first element in the object or array? This is required to know whether a delimiter must be output or not. More... | |
objectt | object |
std::unique_ptr< json_streamt > | child_stream |
The current child stream. More... | |
Provides methods for streaming JSON arrays.
Definition at line 92 of file json_stream.h.
|
explicit |
Construct a new JSON array stream.
out | output stream |
indent | indentation level |
Definition at line 27 of file json_stream.cpp.
|
inlineoverride |
Flushes and closes the stream on destruction.
Definition at line 98 of file json_stream.h.
|
overrideprotectedvirtual |
Output the non-streaming JSON objects and closes the current child stream.
Implements json_streamt.
Definition at line 34 of file json_stream.cpp.
|
overrideprotectedvirtual |
Output the finalizing character for a JSON array.
Implements json_streamt.
Definition at line 50 of file json_stream.cpp.
|
inline |
Push back and return a new non-streaming JSON element into the current array stream.
Provided for compatibility with jsont
.
Definition at line 120 of file json_stream.h.
|
inline |
Push back a JSON element into the current array stream.
Provided for compatibility with jsont
.
json | a non-streaming JSON element |
Definition at line 106 of file json_stream.h.
json_stream_arrayt & json_stream_arrayt::push_back_stream_array | ( | ) |
Add a JSON array child stream.
Definition at line 93 of file json_stream.cpp.
json_stream_objectt & json_stream_arrayt::push_back_stream_object | ( | ) |
Add a JSON object child stream.
Definition at line 82 of file json_stream.cpp.