nomlib
Loading...
Searching...
No Matches
nom::JsonCppDeserializer Class Reference

Restoring of nom::Value objects from JSON documents using the JsonCpp library. More...

#include <JsonCppDeserializer.hpp>

Inheritance diagram for nom::JsonCppDeserializer:
[legend]

Public Member Functions

 JsonCppDeserializer (void)
 Default constructor; initialize the parser to strict mode compliance.
 ~JsonCppDeserializer (void)
 Destructor.
 JsonCppDeserializer (uint32 options)
 Construct a parser with a feature set enumeration.
Value deserialize (const std::string &source)
 Parse JSON data as a nom::Value object.
bool load (const std::string &filename, Value &output)
 Convenience method provided to store JSON-formatted data from a file.

Private Member Functions

bool read (const Json::Value &source, Value &dest) const
bool read_value (const Json::Value &object, Value &dest) const
bool read_array (const Json::Value &object, Value &dest) const
 Internal helper method for un-serialization of array nodes.
bool read_object (const Json::Value &object, Value &dest) const
 Internal helper method for un-serialization of object nodes.

Private Attributes

uint32 options_

Additional Inherited Members

Public Types inherited from nom::IValueDeserializer
typedef IValueDeserializer self_type
typedef self_type * raw_ptr
typedef std::unique_ptr< self_type > unique_ptr
typedef std::shared_ptr< self_type > shared_ptr

Detailed Description

Restoring of nom::Value objects from JSON documents using the JsonCpp library.

[TO BE WRITTEN]

Todo
Additional error handling via Json::Reader::getFormattedErrorMessage

Definition at line 57 of file JsonCppDeserializer.hpp.

Constructor & Destructor Documentation

◆ JsonCppDeserializer() [1/2]

nom::JsonCppDeserializer::JsonCppDeserializer ( void )

Default constructor; initialize the parser to strict mode compliance.

Remarks
See the DeserializerOptions enumeration for more information.

◆ JsonCppDeserializer() [2/2]

nom::JsonCppDeserializer::JsonCppDeserializer ( uint32 options)

Construct a parser with a feature set enumeration.

Remarks
Bit-mask friendly.

Member Function Documentation

◆ deserialize()

Value nom::JsonCppDeserializer::deserialize ( const std::string & source)
virtual

Parse JSON data as a nom::Value object.

Parameters
sourcestd::string containing valid JSON.
Returns
nom::Value object filled from JSON-compliant input on success, or nom::Value::null on err.
Note
Implements IDeserializer interface.

Implements nom::IValueDeserializer.

◆ load()

bool nom::JsonCppDeserializer::load ( const std::string & filename,
Value & output )
virtual

Convenience method provided to store JSON-formatted data from a file.

Parameters
filenameAbsolute file path to data to deserialize from.
outputnom::Value container to store resulting data in.
Note
Implements IDeserializer interface.

Implements nom::IValueDeserializer.

◆ read_array()

bool nom::JsonCppDeserializer::read_array ( const Json::Value & object,
Value & dest ) const
private

Internal helper method for un-serialization of array nodes.

Todo
Err handling where used in code

◆ read_object()

bool nom::JsonCppDeserializer::read_object ( const Json::Value & object,
Value & dest ) const
private

Internal helper method for un-serialization of object nodes.

Todo
Err handling where used in code

◆ read_value()

bool nom::JsonCppDeserializer::read_value ( const Json::Value & object,
Value & dest ) const
private
Todo
Err handling where used in code

Member Data Documentation

◆ options_

uint32 nom::JsonCppDeserializer::options_
private

Definition at line 94 of file JsonCppDeserializer.hpp.


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