CBMC
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
json_stream_arrayt Class Reference

Provides methods for streaming JSON arrays. More...

#include <json_stream.h>

+ Inheritance diagram for json_stream_arrayt:
+ Collaboration diagram for json_stream_arrayt:

Public Member Functions

  json_stream_arrayt (std::ostream &out, unsigned indent=0)
  Construct a new JSON array stream.
 
  Flushes and closes the stream on destruction.
 
  Push back a JSON element into the current array stream.
 
  Push back and return a new non-streaming JSON element into the current array stream.
 
  Add a JSON object child stream.
 
  Add a JSON array child stream.
 
- Public Member Functions inherited from json_streamt
void  close ()
  Outputs the current current child stream and closes this JSON stream.
 
 

Protected Member Functions

  Output the non-streaming JSON objects and closes the current child stream.
 
  Output the finalizing character for a JSON array.
 
- Protected Member Functions inherited from json_streamt
  json_streamt (std::ostream &_out, unsigned _indent)
  Constructor to be used by derived classes.
 
  Create a new JSON array child stream.
 
  Create a new JSON object child stream.
 
  Outputs the delimiter between JSON elements.
 

Additional Inherited Members

- Protected Types inherited from json_streamt
typedef std::map< std::string, jsontobjectt
  Non-streaming JSON elements These will be printed when closing the stream or creating a child stream.
 
- Protected Attributes inherited from json_streamt
  Denotes whether the current stream is open or has been invalidated.
 
std::ostream &  out
 
 
  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.
 
 
std::unique_ptr< json_streamtchild_stream
  The current child stream.
 

Detailed Description

Provides methods for streaming JSON arrays.

Definition at line 92 of file json_stream.h.

Constructor & Destructor Documentation

◆  json_stream_arrayt()

json_stream_arrayt::json_stream_arrayt ( std::ostream &  out,
unsigned  indent = 0 
)
explicit

Construct a new JSON array stream.

Parameters
out output stream
indent indentation level

Definition at line 27 of file json_stream.cpp.

◆  ~json_stream_arrayt()

json_stream_arrayt::~json_stream_arrayt ( )
inlineoverride

Flushes and closes the stream on destruction.

Definition at line 98 of file json_stream.h.

Member Function Documentation

◆  output_child_stream()

void json_stream_arrayt::output_child_stream ( )
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.

◆  output_finalizer()

void json_stream_arrayt::output_finalizer ( )
overrideprotectedvirtual

Output the finalizing character for a JSON array.

Implements json_streamt.

Definition at line 50 of file json_stream.cpp.

◆  push_back() [1/2]

jsont & json_stream_arrayt::push_back ( )
inline

Push back and return a new non-streaming JSON element into the current array stream.

Provided for compatibility with jsont.

Returns
a new empty, non-streaming JSON object

Definition at line 120 of file json_stream.h.

◆  push_back() [2/2]

void json_stream_arrayt::push_back ( const jsontjson )
inline

Push back a JSON element into the current array stream.

Provided for compatibility with jsont.

Parameters
json a non-streaming JSON element

Definition at line 106 of file json_stream.h.

◆  push_back_stream_array()

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.

◆  push_back_stream_object()

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.


The documentation for this class was generated from the following files:

AltStyle によって変換されたページ (->オリジナル) /