#pragma once #include #include #include #include #include #include #include #include namespace wfr { namespace utils { typedef std::initializer_list> PropertyList; class Properties { private: std::map properties; public: Properties() {} Properties(PropertyList props) { for (auto i : props) { properties.insert(i); } } bool hasProperty(const std::string& key) const noexcept { return properties.find(key) != properties.end(); } const std::string& getProperty(const std::string& key) const { auto i = properties.find(key); if (i != properties.end()) { return i->second; } else { throw exception::wfr_not_found((boost::format("Property \"%1%\" not found.") % key).str()); } } const std::map& getProperties() const { return properties; } void addProperty(const std::string& key, const std::string& value) noexcept { properties[key] = value; } }; } /* namespace utils */ } /* namespace wfr */