Configuration.hpp 886 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <boost/noncopyable.hpp>
  3. #include <vector>
  4. #include <string>
  5. #include <stdexcept>
  6. #include <unordered_map>
  7. namespace config {
  8. class ConfigException : public std::runtime_error {
  9. public:
  10. ConfigException(const std::string &message)
  11. : std::runtime_error(message) {
  12. }
  13. };
  14. struct ConfigurationImpl;
  15. class Configuration : boost::noncopyable {
  16. public:
  17. Configuration(const std::string fileName);
  18. Configuration(const std::vector<std::string> fileNames);
  19. ~Configuration();
  20. int getInt(const std::string &property);
  21. bool getBool(const std::string &property);
  22. std::string getString(const std::string &property);
  23. std::unordered_map<std::string, std::string> getChildren(const std::string &property);
  24. private:
  25. ConfigurationImpl *impl;
  26. };
  27. }