29#ifndef NOMLIB_SERIALIZERS_ICONFIG_FILE_HPP
30#define NOMLIB_SERIALIZERS_ICONFIG_FILE_HPP
35#include "nomlib/config.hpp"
36#include "nomlib/ptree/Value.hpp"
38#include "nomlib/math/Point2.hpp"
57 typedef self_type* raw_ptr;
58 typedef std::unique_ptr<self_type> unique_ptr;
59 typedef std::shared_ptr<self_type> shared_ptr;
61 typedef std::pair<std::string, Value> Pair;
62 typedef std::map<std::string, Value> value_type;
83 virtual bool load(
void ) = 0;
86 virtual bool save(
void ) = 0;
95 bool exists(
const std::string& key )
const;
98 int get_int(
const std::string& key,
int default_value )
const;
101 uint
get_uint(
const std::string& key, uint default_value )
const;
104 double get_double(
const std::string& key,
double default_value )
const;
107 const std::string
get_string(
const std::string& key,
const std::string& default_value )
const;
110 bool get_bool(
const std::string& key,
bool default_value )
const;
121 bool erase(
const std::string& key );
131 const value_type&
get(
void )
const;
value_type config_
The internal configuration storage map.
double get_double(const std::string &key, double default_value) const
std::string filename_
File I/O path.
virtual IValueSerializer * serializer(void) const =0
bool get_bool(const std::string &key, bool default_value) const
virtual bool load(void)=0
Deserialize the configuration from the set file path.
void set_property(const std::string &key, const Value &value)
Write a value to the configuration, mapped by key.
IConfigFile(void)
Default constructor.
bool erase(const std::string &key)
Destroy a configuration item.
const std::string get_string(const std::string &key, const std::string &default_value) const
virtual bool save(void)=0
Serialize the current configuration to the set file path.
uint get_uint(const std::string &key, uint default_value) const
int get_int(const std::string &key, int default_value) const
const value_type & get(void) const
Internal getter method for the storage container.
void set_filename(const std::string &filename)
Set the file I/O path.
virtual IValueDeserializer * deserializer(void) const =0
bool exists(const std::string &key) const
Check to see if an existing configuration key exists.
virtual ~IConfigFile(void)
Destructor.
const std::string & filename(void) const
Obtain the set file path.
friend class JsonConfigFile
Access to our (private) get method; returns value_type container.
virtual bool flush(void)=0
Force an output (save) of the current configuration.
Abstract interface for loading nom::Value objects.
Abstract interface for saving nom::Value objects.
Generic interface for opaque data containers.