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

Loading of nom::Value objects from XML documents using the RapidXml library. More...

#include <RapidXmlDeserializer.hpp>

Inheritance diagram for nom::RapidXmlDeserializer:
[legend]

Public Types

typedef RapidXmlDeserializer SelfType
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

Public Member Functions

 RapidXmlDeserializer (void)
 Default constructor; initialize the parser with no additional options.
 ~RapidXmlDeserializer (void)
 Destructor.
 RapidXmlDeserializer (uint32 options)
 Construct a parser with a feature set enumeration.
Value deserialize (const std::string &source)
 Parse XML data to a nom::Value object.
bool load (const std::string &filename, Value &output)
 Restore data from a XML (.xml) file to a nom::Value object.

Private Member Functions

bool read (const std::string &input, Value &dest) const
bool read_value (const rapidxml::xml_node< char > &object, Value &dest) const
bool read_array (const rapidxml::xml_node< char > *object, Value &dest) const
 Internal helper method for un-serialization of array nodes.
bool read_object (const rapidxml::xml_node< char > *node, Value &dest) const
 Internal helper method for un-serialization of object nodes.

Private Attributes

uint32 options_

Detailed Description

Loading of nom::Value objects from XML documents using the RapidXml library.

[TO BE WRITTEN]

References

  1. http://sfmlcoder.wordpress.com/2011/05/29/a-lightweight-xml-parser-rapid-xml/
  2. http://www.w3schools.com/xml/xml_attributes.asp

    Todo
    Implement XML comments
    Todo
    Finish implementation of ::serialize_object & related case handling, err handling

Definition at line 61 of file RapidXmlDeserializer.hpp.

Member Typedef Documentation

◆ SelfType

typedef RapidXmlDeserializer nom::RapidXmlDeserializer::SelfType

Definition at line 64 of file RapidXmlDeserializer.hpp.

Constructor & Destructor Documentation

◆ RapidXmlDeserializer() [1/2]

nom::RapidXmlDeserializer::RapidXmlDeserializer ( void )

Default constructor; initialize the parser with no additional options.

Remarks
No options are currently implemented for the XML parser.

◆ RapidXmlDeserializer() [2/2]

nom::RapidXmlDeserializer::RapidXmlDeserializer ( uint32 options)

Construct a parser with a feature set enumeration.

Remarks
No options are currently implemented for the XML parser.

Member Function Documentation

◆ deserialize()

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

Parse XML data to a nom::Value object.

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

Implements nom::IValueDeserializer.

◆ load()

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

Restore data from a XML (.xml) file to a nom::Value object.

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::RapidXmlDeserializer::read_array ( const rapidxml::xml_node< char > * object,
Value & dest ) const
private

Internal helper method for un-serialization of array nodes.

Remarks
rapidxml::xml_attribute<>

Member Data Documentation

◆ options_

uint32 nom::RapidXmlDeserializer::options_
private

Definition at line 99 of file RapidXmlDeserializer.hpp.


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