Lightweight JSON Reader to read any STL compositions and structs. The user need to know the schema of the.
More...
#include <json.h>
|
| JSONReader (std::istream *is) |
| Constructor. More...
|
|
void | ReadString (std::string *out_str) |
| Parse next JSON string. More...
|
|
template<typename ValueType > |
void | ReadNumber (ValueType *out_value) |
| Read Number. More...
|
|
void | BeginObject () |
| Begin parsing an object. More...
|
|
void | BeginArray () |
| Begin parsing an array. More...
|
|
bool | NextObjectItem (std::string *out_key) |
| Try to move to next object item. If this call is successful, user can proceed to call reader->Read to read in the value. More...
|
|
bool | NextArrayItem () |
| Try to read the next element in the array. If this call is successful, user can proceed to call reader->Read to read in the value. More...
|
|
template<typename ValueType > |
void | Read (ValueType *out_value) |
| Read next ValueType. More...
|
|
std::string | line_info () const |
|
Lightweight JSON Reader to read any STL compositions and structs. The user need to know the schema of the.
dmlc::JSONReader::JSONReader |
( |
std::istream * |
is | ) |
|
|
inlineexplicit |
void dmlc::JSONReader::BeginArray |
( |
| ) |
|
|
inline |
void dmlc::JSONReader::BeginObject |
( |
| ) |
|
|
inline |
Begin parsing an object.
std::string key;
std::string value;
}
std::string dmlc::JSONReader::line_info |
( |
| ) |
const |
|
inline |
- Returns
- current line count
bool dmlc::JSONReader::NextArrayItem |
( |
| ) |
|
|
inline |
Try to read the next element in the array. If this call is successful, user can proceed to call reader->Read to read in the value.
- Returns
- true if the read is successful, false if we are at end of the array.
bool dmlc::JSONReader::NextObjectItem |
( |
std::string * |
out_key | ) |
|
|
inline |
Try to move to next object item. If this call is successful, user can proceed to call reader->Read to read in the value.
- Parameters
-
out_key | the key to the next object. |
- Returns
- true if the read is successful, false if we are at end of the object.
template<typename ValueType >
void dmlc::JSONReader::Read |
( |
ValueType * |
out_value | ) |
|
|
inline |
Read next ValueType.
- Parameters
-
out_value | any STL or json readable type to be read |
- Exceptions
-
dmlc::Error | when the read of ValueType is not successful. |
- Template Parameters
-
ValueType | the data type to be read. |
template<typename ValueType >
void dmlc::JSONReader::ReadNumber |
( |
ValueType * |
out_value | ) |
|
|
inline |
Read Number.
- Parameters
-
- Exceptions
-
dmlc::Error | when next token is not number of ValueType. |
- Template Parameters
-
ValueType | type of the number |
void dmlc::JSONReader::ReadString |
( |
std::string * |
out_str | ) |
|
|
inline |
Parse next JSON string.
- Parameters
-
out_str | the output string. |
- Exceptions
-
dmlc::Error | when next token is not string |
The documentation for this class was generated from the following file:
- /work/mxnet/3rdparty/dmlc-core/include/dmlc/json.h