Electroneum
Loading...
Searching...
No Matches
json_archive_base< Stream, IsSaving > Struct Template Reference

the base class of json archive type More...

#include <json_archive.h>

Collaboration diagram for json_archive_base< Stream, IsSaving >:

Public Types

typedef Stream stream_type
typedef json_archive_base< Stream, IsSaving > base_type
typedef boost::mpl::bool_< IsSaving > is_saving
typedef const char * variant_tag_type

Public Member Functions

 json_archive_base (stream_type &s, bool indent=false)
void tag (const char *tag)
void begin_object ()
void end_object ()
void begin_variant ()
void end_variant ()
Streamstream ()

Protected Member Functions

void make_indent ()

Protected Attributes

stream_typestream_
bool indent_
bool object_begin
size_t depth_

Detailed Description

template<class Stream, bool IsSaving>
struct json_archive_base< Stream, IsSaving >

the base class of json archive type

\detailed contains the basic logic for serializing a json archive

Definition at line 51 of file json_archive.h.

Member Typedef Documentation

◆ base_type

template<class Stream, bool IsSaving>
typedef json_archive_base<Stream, IsSaving> json_archive_base< Stream, IsSaving >::base_type

Definition at line 54 of file json_archive.h.

◆ is_saving

template<class Stream, bool IsSaving>
typedef boost::mpl::bool_<IsSaving> json_archive_base< Stream, IsSaving >::is_saving

Definition at line 55 of file json_archive.h.

◆ stream_type

template<class Stream, bool IsSaving>
typedef Stream json_archive_base< Stream, IsSaving >::stream_type

Definition at line 53 of file json_archive.h.

◆ variant_tag_type

template<class Stream, bool IsSaving>
typedef const char* json_archive_base< Stream, IsSaving >::variant_tag_type

Definition at line 57 of file json_archive.h.

Constructor & Destructor Documentation

◆ json_archive_base()

template<class Stream, bool IsSaving>
json_archive_base< Stream, IsSaving >::json_archive_base ( stream_type & s,
bool indent = false )
inline

Definition at line 59 of file json_archive.h.

60 : stream_(s), indent_(indent), object_begin(false), depth_(0) { }
the base class of json archive type
stream_type & stream_

Member Function Documentation

◆ begin_object()

template<class Stream, bool IsSaving>
void json_archive_base< Stream, IsSaving >::begin_object ( )
inline

Definition at line 70 of file json_archive.h.

71 {
72 stream_ << "{";
73 ++depth_;
74 object_begin = true;
75 }
Here is the caller graph for this function:

◆ begin_variant()

template<class Stream, bool IsSaving>
void json_archive_base< Stream, IsSaving >::begin_variant ( )
inline

Definition at line 84 of file json_archive.h.

84{ begin_object(); }
Here is the call graph for this function:

◆ end_object()

template<class Stream, bool IsSaving>
void json_archive_base< Stream, IsSaving >::end_object ( )
inline

Definition at line 77 of file json_archive.h.

78 {
79 --depth_;
81 stream_ << "}";
82 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ end_variant()

template<class Stream, bool IsSaving>
void json_archive_base< Stream, IsSaving >::end_variant ( )
inline

Definition at line 85 of file json_archive.h.

85{ end_object(); }
Here is the call graph for this function:

◆ make_indent()

template<class Stream, bool IsSaving>
void json_archive_base< Stream, IsSaving >::make_indent ( )
inlineprotected

Definition at line 89 of file json_archive.h.

90 {
91 if (indent_)
92 {
93 stream_ << '\n' << std::string(2 * depth_, ' ');
94 }
95 }
Here is the caller graph for this function:

◆ stream()

template<class Stream, bool IsSaving>
Stream & json_archive_base< Stream, IsSaving >::stream ( )
inline

Definition at line 86 of file json_archive.h.

86{ return stream_; }

◆ tag()

template<class Stream, bool IsSaving>
void json_archive_base< Stream, IsSaving >::tag ( const char * tag)
inline

Definition at line 62 of file json_archive.h.

62 {
63 if (!object_begin)
64 stream_ << ", ";
66 stream_ << '"' << tag << "\": ";
67 object_begin = false;
68 }
void tag(const char *tag)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ depth_

template<class Stream, bool IsSaving>
size_t json_archive_base< Stream, IsSaving >::depth_
protected

Definition at line 101 of file json_archive.h.

◆ indent_

template<class Stream, bool IsSaving>
bool json_archive_base< Stream, IsSaving >::indent_
protected

Definition at line 99 of file json_archive.h.

◆ object_begin

template<class Stream, bool IsSaving>
bool json_archive_base< Stream, IsSaving >::object_begin
protected

Definition at line 100 of file json_archive.h.

◆ stream_

template<class Stream, bool IsSaving>
stream_type& json_archive_base< Stream, IsSaving >::stream_
protected

Definition at line 98 of file json_archive.h.


The documentation for this struct was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/serialization/json_archive.h