ONE - On-device Neural Engine
Loading...
Searching...
No Matches
crew::JsonExport Class Reference

#include <PConfigJson.h>

Public Member Functions

 JsonExport (std::ostream &os)
 
void open_brace (void)
 
void open_brace (const std::string &key)
 
void open_bracket (const std::string &key)
 
void close_bracket (bool cont)
 
void close_brace (bool cont)
 
void key_val (const std::string &key, const std::string &value, bool cont)
 
void key_val (const std::string &key, const std::vector< std::string > &l, bool cont)
 

Detailed Description

Definition at line 28 of file PConfigJson.h.

Constructor & Destructor Documentation

◆ JsonExport()

crew::JsonExport::JsonExport ( std::ostream &  os)
inline

Definition at line 31 of file PConfigJson.h.

31: _os(os) {}

Member Function Documentation

◆ close_brace()

void crew::JsonExport::close_brace ( bool  cont)

Definition at line 75 of file PConfigJson.cpp.

76{
77 _indent--;
78 indent();
79
80 _os << "}";
81 if (cont)
82 _os << ",";
83 _os << _CLF;
84}

Referenced by main(), and crew::write_json().

◆ close_bracket()

void crew::JsonExport::close_bracket ( bool  cont)

Definition at line 64 of file PConfigJson.cpp.

65{
66 _indent--;
67 indent();
68
69 _os << "]";
70 if (cont)
71 _os << ",";
72 _os << _CLF;
73}

Referenced by crew::write_json().

◆ key_val() [1/2]

void crew::JsonExport::key_val ( const std::string &  key,
const std::string &  value,
bool  cont 
)

Definition at line 86 of file PConfigJson.cpp.

87{
88 indent();
89
90 _os << _DQU << key << _DQU << " : " << _DQU << value << _DQU;
91 if (cont)
92 _os << ",";
93 _os << _CLF;
94}

Referenced by get_input_names_from_summary().

◆ key_val() [2/2]

void crew::JsonExport::key_val ( const std::string &  key,
const std::vector< std::string > &  l,
bool  cont 
)

Definition at line 96 of file PConfigJson.cpp.

97{
98 indent();
99
100 _os << _DQU << key << _DQU << " : [ ";
101 bool comma = false;
102 for (auto &v : l)
103 {
104 if (comma)
105 _os << ", ";
106 else
107 comma = true;
108 _os << _DQU << v << _DQU;
109 }
110 _os << " ]";
111 if (cont)
112 _os << ",";
113 _os << _CLF;
114}

◆ open_brace() [1/2]

void crew::JsonExport::open_brace ( const std::string &  key)

Definition at line 48 of file PConfigJson.cpp.

49{
50 indent();
51
52 _os << _DQU << key << _DQU << " : {" << _CLF;
53 _indent++;
54}

◆ open_brace() [2/2]

void crew::JsonExport::open_brace ( void  )

Definition at line 40 of file PConfigJson.cpp.

41{
42 indent();
43
44 _os << "{" << _CLF;
45 _indent++;
46}

Referenced by main(), and crew::write_json().

◆ open_bracket()

void crew::JsonExport::open_bracket ( const std::string &  key)

Definition at line 56 of file PConfigJson.cpp.

57{
58 indent();
59
60 _os << _DQU << key << _DQU << " : [" << _CLF;
61 _indent++;
62}

Referenced by crew::write_json().


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