nlib
|
JSON parser. Reads and parses the JSON string from the stream. More...
#include "nn/nlib/msgpack/JsonReader.h"
Public Types | |
enum | Option { OPTION_DEFAULT = 0x00000000, OPTION_RELAXED = 0x00000001 } |
Defines the option value that may be passed to Read . More... | |
Public Member Functions | |
InputStream * | GetStream () noexcept |
Gets the base stream specified in Init . More... | |
int | GetLine () const noexcept |
Gets the line number (near where the error occurred). | |
int | GetColumn () const noexcept |
Gets the digit number (near where the error occurred). | |
bool | Read (MpObject *obj, uint32_t option=0) noexcept |
Reads and parses the JSON string from the stream, and sets it in the obj parameter. More... | |
Basic Member Functions | |
JsonReader () noexcept | |
Instantiates the object with default parameters (default constructor). | |
~JsonReader () noexcept | |
Destructor. | |
Initialization and Finalization | |
bool | Init (InputStream *stream, const JsonReaderSettings &settings) noexcept |
Initializes JsonReader based on the settings parameter. Sets an error and returns false when it fails. More... | |
bool | Init (InputStream *stream) noexcept |
Initializes JsonReader based on the default settings. Sets an error and returns false when it fails. More... | |
bool | Close () noexcept |
Closes JsonReader . More... | |
Error Checking | |
errno_t | GetErrorValue () const noexcept |
Gets the error that occurred. More... | |
operator bool () const | |
Returns true if an error has not occurred. | |
Static Public Member Functions | |
static errno_t | ReadEx (MpObject *obj, const void *jsontext, uint32_t option=0, size_t n=RSIZE_MAX) noexcept |
Parse the JSON string in the specified object. More... | |
static bool | Read (MpObject *obj, const char *jsontext, uint32_t option=0) noexcept |
Parse the JSON string in the specified object. More... | |
JSON parser. Reads and parses the JSON string from the stream.
Definition at line 38 of file JsonReader.h.
Defines the option value that may be passed to Read
.
Definition at line 40 of file JsonReader.h.
|
inlinenoexcept |
Closes JsonReader
.
true
when successful.JsonReader
, and detaches the base stream. The base stream will not be closed. Init
member function again. Definition at line 52 of file JsonReader.h.
|
inlinenoexcept |
Gets the error that occurred.
0 | No error occurred. |
EILSEQ | Incorrect JSON character found (parse error). |
EINVAL | Error in an argument. |
EEXIST | Attempted to initialize a JsonReader that has already been initialized. |
EIO | An error occurred in the base stream. |
EBADF | Attempted to use an uninitialized JsonReader . |
E2BIG | The size of the array (and similar items) is too big. |
ENOMEM | Failed to allocate memory. |
Definition at line 53 of file JsonReader.h.
|
inlinenoexcept |
Gets the base stream specified in Init
.
Definition at line 54 of file JsonReader.h.
|
noexcept |
Initializes JsonReader
based on the settings parameter. Sets an error and returns false
when it fails.
[in] | stream | Pointer to the input stream. |
[in] | settings | Settings for the JSON parser. |
true
when successful.
|
inlinenoexcept |
Initializes JsonReader
based on the default settings. Sets an error and returns false
when it fails.
[in] | stream | Pointer to the input stream. |
true
when successful. Definition at line 48 of file JsonReader.h.
|
inlinestaticnoexcept |
Parse the JSON string in the specified object.
[in] | obj | The object that stores the converted JSON. |
[in] | jsontext | JSON string. |
[in] | option | Option. The value synthesized by the logical disjunction of the JsonReader::Option type value is assigned. |
true
on success.JsonReader
to read and parses the JSON string from the stream. Returns false
if there is any error during this process. If this occurs, obj is not altered. Definition at line 61 of file JsonReader.h.
|
noexcept |
Reads and parses the JSON string from the stream, and sets it in the obj parameter.
[in] | obj | Object where the read JSON is set. |
[in] | option | Option. The value synthesized by the logical disjunction of the JsonReader::Option type value is assigned. |
true
when successful.MpObject
and stored in the obj parameter. Sets an error and returns false
when an error occurs while reading.
|
staticnoexcept |
Parse the JSON string in the specified object.
[in] | obj | The object that stores the converted JSON. |
[in] | jsontext | JSON string. |
[in] | option | Option. The value synthesized by the logical disjunction of the JsonReader::Option type value is assigned. |
[in] | n | The size of jsontext parameter. This parameter must be specified if jsontext is not null-terminated. |
true
on success.JsonReader
to read and parses the JSON string from the stream. Returns false
if there is any error during this process. If this occurs, obj is not altered. © 2013, 2014, 2015 Nintendo Co., Ltd. All rights reserved.