nlib
|
Converts JSON Schema to a byte-code format available for JsonSchemaValidator. More...
#include "nn/nlib/msgpack/JsonSchema.h"
Classes | |
struct | Detail |
If the conversion of JSON Schema has failed, a string representing the location where the conversion has failed is written into a member named path. More... | |
Public Types | |
enum | Result { kOk = 0, kInvalidParam, kAlreadyInitialized, kOutOfMemory, kInvalidSchema, kFileNotFound, kIoError, kUriError, kBufferSizeNotEnough } |
The result of the function executed. More... | |
Public Member Functions | |
constexpr | JsonSchemaConverter () noexcept |
Instantiates the object with default parameters (default constructor). | |
~JsonSchemaConverter () noexcept | |
Destructor. | |
Result | Init (const JsonSchemaConverterSettings &settings) noexcept |
Initializes the object. More... | |
Result | Init () noexcept |
Initializes JsonSchemaConverterSettings with the default values. | |
void | Reset () noexcept |
Sets the object to the same state as the one obtained after the default constructor has run. | |
Result | Convert (const char *uri, Detail *detail) noexcept |
Converts JSON Schema to a format available for JsonSchemaValidator. More... | |
Result | Convert (MpObject *schema, Detail *detail) noexcept |
Converts JSON Schema to a format available for JsonSchemaValidator. More... | |
Result | Export (size_t *written, nlib_byte_t *buf, size_t bufsize) const noexcept |
Writes JSON Schema converted to byte-code. More... | |
template<size_t N> | |
Result | Export (size_t *written, nlib_byte_t(&buf)[N]) const noexcept |
Writes JSON Schema converted to byte-code. More... | |
Converts JSON Schema to a byte-code format available for JsonSchemaValidator.
Definition at line 70 of file JsonSchema.h.
The result of the function executed.
Definition at line 72 of file JsonSchema.h.
|
noexcept |
Converts JSON Schema to a format available for JsonSchemaValidator.
[in] | uri | The absolute URI indicating JSON which should be JSON Schema. |
[in] | detail | If specifying non-NULL, additional information can be obtained when an error has occurred. |
kOk | The conversion has been successfully completed. |
kOutOfMemory | Memory allocation failed. |
kInvalidSchema | Invalid schema. |
kFileNotFound | The file to be read could not be found. |
kIoError | Reading the file failed. |
kUriError | Invalid URI was found or uri was a relative URI. |
JsonSchemaConverterSettings::uri_mapper
is used to convert the URI to the actual file path. If uri is NULL
, uri is assumed to be "nlibpath:///jsonschema/schema.json." Converts JSON Schema to a format available for JsonSchemaValidator.
[in,out] | schema | The JSON Schema to be converted. Note that internal values may be changed. |
[in] | detail | If not specifying NULL , additional information can be obtained when an error has occurred. |
kOk | The conversion has been successfully completed. |
kOutOfMemory | Memory allocation failed. |
kInvalidParam | schema was NULL . |
kInvalidSchema | Invalid schema. |
kFileNotFound | The file to be read could not be found. |
kIoError | Reading the file failed. |
kUriError | An invalid URI was found. |
|
noexcept |
Writes JSON Schema converted to byte-code.
[out] | written | The number of bytes written. |
[out] | buf | The buffer that the data is written into. |
[in] | bufsize | The size of the buffer. |
0 | Success. |
kInvalidParam | written or buf is NULL. |
kOutOfMemory | Memory allocation failed. |
kBufferSizeNotEnough | Insufficient buffer size. |
|
inlinenoexcept |
Writes JSON Schema converted to byte-code.
N | The size of the buffer. |
[out] | written | The number of bytes written. |
[out] | buf | The buffer that the data is written into. |
0 | Success. |
kOutOfMemory | Memory allocation failed. |
kBufferSizeNotEnough | Insufficient buffer size. |
Definition at line 99 of file JsonSchema.h.
|
noexcept |
Initializes the object.
[in] | settings | Structure for specifying conversion options. |
kOk | Success. |
kAlreadyInitialized | The object has been already initialized. |
kOutOfMemory | Memory allocation failed. |
© 2012-2017 Nintendo Co., Ltd. All rights reserved.