2015-11-03 02:13:15 +01:00
|
|
|
#pragma once
|
2015-10-17 22:27:37 +02:00
|
|
|
|
2015-11-04 01:22:59 +01:00
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
|
|
#include <vector>
|
2015-10-17 22:27:37 +02:00
|
|
|
#include <string>
|
|
|
|
#include <stdexcept>
|
2017-05-27 22:12:26 +02:00
|
|
|
#include <unordered_map>
|
2015-10-17 22:27:37 +02:00
|
|
|
|
|
|
|
namespace config {
|
|
|
|
|
|
|
|
class ConfigException : public std::runtime_error {
|
|
|
|
public:
|
|
|
|
ConfigException(const std::string &message)
|
|
|
|
: std::runtime_error(message) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ConfigurationImpl;
|
|
|
|
|
|
|
|
class Configuration : boost::noncopyable {
|
|
|
|
public:
|
|
|
|
Configuration(const std::string fileName);
|
|
|
|
|
|
|
|
Configuration(const std::vector<std::string> fileNames);
|
|
|
|
|
|
|
|
~Configuration();
|
|
|
|
|
|
|
|
int getInt(const std::string &property);
|
|
|
|
|
|
|
|
bool getBool(const std::string &property);
|
|
|
|
|
|
|
|
std::string getString(const std::string &property);
|
|
|
|
|
2017-05-27 22:12:26 +02:00
|
|
|
std::unordered_map<std::string, std::string> getChildren(const std::string &property);
|
|
|
|
|
2015-10-17 22:27:37 +02:00
|
|
|
private:
|
|
|
|
ConfigurationImpl *impl;
|
|
|
|
};
|
|
|
|
}
|