Lightweight json to write any STL compositions.
More...
#include <json.h>
|
| | JSONWriter (std::ostream *os) |
| | Constructor. More...
|
| |
| void | WriteNoEscape (const std::string &s) |
| | Write a string that do not contain escape characters. More...
|
| |
| void | WriteString (const std::string &s) |
| | Write a string that can contain escape characters. More...
|
| |
| template<typename ValueType > |
| void | WriteNumber (const ValueType &v) |
| | Write a string that can contain escape characters. More...
|
| |
| void | BeginArray (bool multi_line=true) |
| | Start beginning of array. More...
|
| |
| void | EndArray () |
| | Finish writing an array. More...
|
| |
| void | BeginObject (bool multi_line=true) |
| | Start beginning of array. More...
|
| |
| void | EndObject () |
| | Finish writing object. More...
|
| |
| template<typename ValueType > |
| void | WriteObjectKeyValue (const std::string &key, const ValueType &value) |
| | Write key value pair in the object. More...
|
| |
| void | WriteArraySeperator () |
| | Write seperator of array, before writing next element. User can proceed to call writer->Write to write next item. More...
|
| |
| template<typename ValueType > |
| void | WriteArrayItem (const ValueType &value) |
| | Write value into array. More...
|
| |
| template<typename ValueType > |
| void | Write (const ValueType &value) |
| | Write value to json. More...
|
| |
Lightweight json to write any STL compositions.
| dmlc::JSONWriter::JSONWriter |
( |
std::ostream * |
os | ) |
|
|
inlineexplicit |
| void dmlc::JSONWriter::BeginArray |
( |
bool |
multi_line = true | ) |
|
|
inline |
Start beginning of array.
- Parameters
-
| multi_line | whether to start an multi_line array. writer->BeginArray(); for (auto& v : vdata) { writer->WriteArrayItem(v); } writer->EndArray(); |
| void dmlc::JSONWriter::BeginObject |
( |
bool |
multi_line = true | ) |
|
|
inline |
Start beginning of array.
- Parameters
-
| multi_line | whether to start an multi_line array. writer->BeginObject(); for (auto& kv : vmap) { writer->WriteObjectKeyValue(kv.first, kv.second); } writer->EndObject(); |
| void dmlc::JSONWriter::EndArray |
( |
| ) |
|
|
inline |
| void dmlc::JSONWriter::EndObject |
( |
| ) |
|
|
inline |
template<typename ValueType >
| void dmlc::JSONWriter::Write |
( |
const ValueType & |
value | ) |
|
|
inline |
Write value to json.
- Parameters
-
| value | any STL or json readable that can be written. |
- Template Parameters
-
| ValueType | the data type to be write. |
template<typename ValueType >
| void dmlc::JSONWriter::WriteArrayItem |
( |
const ValueType & |
value | ) |
|
|
inline |
Write value into array.
- Parameters
-
| value | The value of to be written. |
- Template Parameters
-
| ValueType | The value type to be written. |
| void dmlc::JSONWriter::WriteArraySeperator |
( |
| ) |
|
|
inline |
Write seperator of array, before writing next element. User can proceed to call writer->Write to write next item.
| void dmlc::JSONWriter::WriteNoEscape |
( |
const std::string & |
s | ) |
|
|
inline |
Write a string that do not contain escape characters.
- Parameters
-
| s | the string to be written. |
template<typename ValueType >
| void dmlc::JSONWriter::WriteNumber |
( |
const ValueType & |
v | ) |
|
|
inline |
Write a string that can contain escape characters.
- Parameters
-
| v | the value to be written. |
- Template Parameters
-
| ValueType | The value type to be written. |
template<typename ValueType >
| void dmlc::JSONWriter::WriteObjectKeyValue |
( |
const std::string & |
key, |
|
|
const ValueType & |
value |
|
) |
| |
|
inline |
Write key value pair in the object.
- Parameters
-
| key | the key of the object. |
| value | the value of to be written. |
- Template Parameters
-
| ValueType | The value type to be written. |
| void dmlc::JSONWriter::WriteString |
( |
const std::string & |
s | ) |
|
|
inline |
Write a string that can contain escape characters.
- Parameters
-
| s | the string to be written. |
The documentation for this class was generated from the following file:
- /work/mxnet/3rdparty/dmlc-core/include/dmlc/json.h