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

JSON Configuration file interface. More...

#include <JsonConfigFile.hpp>

Inheritance diagram for nom::JsonConfigFile:
[legend]

Public Types

typedef JsonConfigFile self_type
typedef self_type * raw_ptr
typedef std::unique_ptr< self_type > unique_ptr
typedef std::shared_ptr< self_type > shared_ptr
Public Types inherited from nom::IConfigFile
typedef IConfigFile self_type
typedef self_type * raw_ptr
typedef std::unique_ptr< self_type > unique_ptr
typedef std::shared_ptr< self_type > shared_ptr
typedef std::pair< std::string, ValuePair
typedef std::map< std::string, Valuevalue_type

Public Member Functions

 JsonConfigFile (void)
 Default constructor; initialize the loader and saver interfaces necessary for JSON I/O.
 ~JsonConfigFile (void)
 Destructor.
bool flush (void)
 Re-implements IConfigFile::flush.
IValueDeserializerdeserializer (void) const
 Re-implements IConfigFile::deserializer.
IValueSerializerserializer (void) const
 Re-implements IConfigFile::serializer.
bool load (void)
 Re-implements IConfigFile::load.
bool save (void)
 Re-implements IConfigFile::save.
Public Member Functions inherited from nom::IConfigFile
 IConfigFile (void)
 Default constructor.
virtual ~IConfigFile (void)
 Destructor.
const std::string & filename (void) const
 Obtain the set file path.
bool exists (const std::string &key) const
 Check to see if an existing configuration key exists.
int get_int (const std::string &key, int default_value) const
uint get_uint (const std::string &key, uint default_value) const
double get_double (const std::string &key, double default_value) const
const std::string get_string (const std::string &key, const std::string &default_value) const
bool get_bool (const std::string &key, bool default_value) const
void set_property (const std::string &key, const Value &value)
 Write a value to the configuration, mapped by key.
bool erase (const std::string &key)
 Destroy a configuration item.
void set_filename (const std::string &filename)
 Set the file I/O path.

Private Member Functions

bool initialize (void)
 Internal helper method for initializing the object state.
void set_deserializer (IValueDeserializer *fp)
 Set the configuration loader.
void set_serializer (IValueSerializer *fp)
 Set the configuration saver.

Private Attributes

std::unique_ptr< IValueDeserializerdeserializer_
 Object pointer to an object deriving from nom::IValueDeserializer.
std::unique_ptr< IValueSerializerserializer_
 Object pointer to an object deriving from nom::IValueSerializer.

Detailed Description

JSON Configuration file interface.

Definition at line 44 of file JsonConfigFile.hpp.

Member Typedef Documentation

◆ raw_ptr

typedef self_type* nom::JsonConfigFile::raw_ptr

Definition at line 49 of file JsonConfigFile.hpp.

◆ self_type

typedef JsonConfigFile nom::JsonConfigFile::self_type

Definition at line 47 of file JsonConfigFile.hpp.

◆ shared_ptr

typedef std::shared_ptr<self_type> nom::JsonConfigFile::shared_ptr

Definition at line 51 of file JsonConfigFile.hpp.

◆ unique_ptr

typedef std::unique_ptr<self_type> nom::JsonConfigFile::unique_ptr

Definition at line 50 of file JsonConfigFile.hpp.

Member Function Documentation

◆ deserializer()

IValueDeserializer * nom::JsonConfigFile::deserializer ( void ) const
virtual

Re-implements IConfigFile::deserializer.

Implements nom::IConfigFile.

◆ flush()

bool nom::JsonConfigFile::flush ( void )
virtual

Re-implements IConfigFile::flush.

Implements nom::IConfigFile.

◆ load()

bool nom::JsonConfigFile::load ( void )
virtual

Re-implements IConfigFile::load.

Implements nom::IConfigFile.

◆ save()

bool nom::JsonConfigFile::save ( void )
virtual

Re-implements IConfigFile::save.

Todo
Do not output JSON when the object size of a nom::Value is zero.

Implements nom::IConfigFile.

◆ serializer()

IValueSerializer * nom::JsonConfigFile::serializer ( void ) const
virtual

Re-implements IConfigFile::serializer.

Implements nom::IConfigFile.

◆ set_deserializer()

void nom::JsonConfigFile::set_deserializer ( IValueDeserializer * fp)
private

Set the configuration loader.

Parameters
fpAn object deriving from nom::IValueDeserializer.
Remarks
Internal functionality of this class is routed through the deserializer set here.

◆ set_serializer()

void nom::JsonConfigFile::set_serializer ( IValueSerializer * fp)
private

Set the configuration saver.

Parameters
fpAn object deriving from nom::IValueSerializer.
Remarks
Internal functionality of this class is routed through the serializer set here.

Member Data Documentation

◆ deserializer_

std::unique_ptr<IValueDeserializer> nom::JsonConfigFile::deserializer_
private

Object pointer to an object deriving from nom::IValueDeserializer.

Definition at line 98 of file JsonConfigFile.hpp.

◆ serializer_

std::unique_ptr<IValueSerializer> nom::JsonConfigFile::serializer_
private

Object pointer to an object deriving from nom::IValueSerializer.

Definition at line 101 of file JsonConfigFile.hpp.


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