X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSettings.hh;h=653d4561dd1e2af4dd4b66ddcd1232b90b893f1d;hp=9c29007613f90d6b35a7c8500208581dae05a5a5;hb=fdfba4553433b9b2804c2772c7645211b828c2ea;hpb=c2321281bf12a7efaedde930422c7ddbc92080d4 diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index 9c29007..653d456 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -37,19 +37,21 @@ #include #include -#include #include namespace Mf { -class Settings : public Singleton +class Settings { public: Settings() {} Settings(int argc, char* argv[]); + // get global instance + static Settings& getInstance(); + void parseArgs(int argc, char* argv[]); void loadFromFile(const std::string& filePath, bool precedence = false); @@ -62,18 +64,18 @@ public: bool getNumber(const std::string& key, T& value); private: - std::map map_; + Serializable::Map map_; }; template bool Settings::get(const std::string& key, T& value) { - std::map::const_iterator it = map_.find(key); + Serializable::Map::const_iterator it = map_.find(key); if (it != map_.end()) { - SerializablePtr obj = (*it).second; + SerializableP obj = (*it).second; return obj->get(value); } else @@ -85,11 +87,11 @@ bool Settings::get(const std::string& key, T& value) template bool Settings::getNumber(const std::string& key, T& value) { - std::map::const_iterator it = map_.find(key); + Serializable::Map::const_iterator it = map_.find(key); if (it != map_.end()) { - SerializablePtr obj = (*it).second; + SerializableP obj = (*it).second; return obj->getNumber(value); } else