1 #ifndef ORG_EEROS_CORE_CONFIG_HPP_ 2 #define ORG_EEROS_CORE_CONFIG_HPP_ 18 std::function<int(const char *, char *, int)>
set;
19 std::function<int(const char *, const char *, int)>
get;
26 return strcmp(first, second) < 0;
41 Config(
const char *path =
nullptr);
50 virtual void loadDefaults();
56 virtual bool save(
const char *path =
nullptr) = 0;
62 virtual bool load(
const char *path =
nullptr) = 0;
65 virtual void add(
const char *name,
int &value);
66 virtual void add(
const char *name,
double &value);
67 virtual void add(
const char *name, std::size_t length,
int *start,
int *end,
int default_value = -1);
68 virtual void add(
const char *name, std::size_t length,
double *start,
double *end,
double default_value = NAN);
69 virtual void add(
const char *name, std::string &value);
71 template <
typename T, std::
size_t N >
72 void add(
const char *name, std::array<T,N> &value);
75 std::map<const char*, ConfigPropertyAccessor, CharPtrCompare>
properties;
79 template <
typename T, std::
size_t N >
81 add(name, N, value.begin(), value.end());
86 #endif // ORG_EEROS_CORE_CONFIG_HPP_ Definition: Config.hpp:17
Definition: Config.hpp:14
Configuration.
Definition: Config.hpp:35
Definition: Config.hpp:22
virtual void add(const char *name, int &value)
Definition: Config.cpp:16
const char * path
Definition: Config.hpp:74
std::map< const char *, ConfigPropertyAccessor, CharPtrCompare > properties
Definition: Config.hpp:75
bool operator()(const char *first, const char *second)
Definition: Config.hpp:24