]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Settings.cc
extreme refactoring
[chaz/yoink] / src / Moof / Settings.cc
similarity index 78%
rename from src/settings.cc
rename to src/Moof/Settings.cc
index 74ab384dd0bb1cd6e2a9a334bfc9ca5cb6bf1efd..d13302d729234f2f7c6aa5710646dae82cf8a53b 100644 (file)
 
 #include <boost/algorithm/string.hpp>
 
 
 #include <boost/algorithm/string.hpp>
 
-#include "settings.hh"
+#include "Settings.hh"
 
 
 
 
-namespace dc {
+namespace Mf {
 
 
 
 
-settings::settings(int argc, char* argv[])
+Settings::Settings(int argc, char* argv[])
 {
        parseArgs(argc, argv);
 }
 
 
 {
        parseArgs(argc, argv);
 }
 
 
-void settings::parseArgs(int argc, char* argv[])
+void Settings::parseArgs(int argc, char* argv[])
 {
        for (int i = 1; i < argc; i++)
        {
 {
        for (int i = 1; i < argc; i++)
        {
@@ -58,25 +58,25 @@ void settings::parseArgs(int argc, char* argv[])
                        std::stringstream stream;
                        stream << stringValue << std::endl;
 
                        std::stringstream stream;
                        stream << stringValue << std::endl;
 
-                       deserializer in(stream);
+                       Deserializer deserializer(stream);
 
                        try
                        {
 
                        try
                        {
-                               serializable_ptr value(in.deserialize());
-                               map[key] = value;
+                               SerializablePtr value(deserializer.deserialize());
+                               map_[key] = value;
                        }
                        catch (std::exception e)
                        {
                                // it doesn't deserialize to anything we know, so just store it
                                // as a string
                        }
                        catch (std::exception e)
                        {
                                // it doesn't deserialize to anything we know, so just store it
                                // as a string
-                               map[key] = serializable_ptr(new wrapped_string(stringValue));
+                               map_[key] = SerializablePtr(new SerializableString(stringValue));
                        }
                }
        }
 }
 
 
                        }
                }
        }
 }
 
 
-void settings::loadFromFile(const std::string& filePath, bool precedence)
+void Settings::loadFromFile(const std::string& filePath, bool precedence)
 {
        std::vector<std::string> paths;
        boost::split(paths, filePath, boost::is_any_of(":"));
 {
        std::vector<std::string> paths;
        boost::split(paths, filePath, boost::is_any_of(":"));
@@ -84,7 +84,7 @@ void settings::loadFromFile(const std::string& filePath, bool precedence)
        loadFromFiles(paths, precedence);
 }
 
        loadFromFiles(paths, precedence);
 }
 
-void settings::loadFromFiles(const std::vector<std::string>& filePaths,
+void Settings::loadFromFiles(const std::vector<std::string>& filePaths,
                bool precedence)
 {
        std::vector<std::string>::const_iterator it;
                bool precedence)
 {
        std::vector<std::string>::const_iterator it;
@@ -100,27 +100,27 @@ void settings::loadFromFiles(const std::vector<std::string>& filePaths,
                        boost::replace_first(path, "$HOME", home);
                }
 
                        boost::replace_first(path, "$HOME", home);
                }
 
-               deserializer in(*it, true);
+               Deserializer deserializer(*it, true);
 
                std::cout << "Looking for a config file at " << path << std::endl;
                try
                {
 
                std::cout << "Looking for a config file at " << path << std::endl;
                try
                {
-                       serializable_ptr obj = in.deserialize();
-                       std::map<std::string,serializable_ptr> dict;
-                       if (obj && obj->get(dict))
+                       SerializablePtr obj = deserializer.deserialize();
+                       std::map<std::string,SerializablePtr> map;
+                       if (obj && obj->get(map))
                        {
                                if (!precedence)
                                {
                        {
                                if (!precedence)
                                {
-                                       map.insert(dict.begin(), dict.end());
+                                       map_.insert(map.begin(), map.end());
                                }
                                else
                                {
                                }
                                else
                                {
-                                       dict.insert(map.begin(), map.end());
-                                       map = dict;
+                                       map.insert(map_.begin(), map_.end());
+                                       map_ = map;
                                }
                        }
                }
                                }
                        }
                }
-               catch (deserializer::exception e)
+               catch (Deserializer::Exception e)
                {
                        std::cerr << "Cannot load settings from " << *it <<
                                " because an exception was thrown: " << e.what() << std::endl;
                {
                        std::cerr << "Cannot load settings from " << *it <<
                                " because an exception was thrown: " << e.what() << std::endl;
@@ -129,7 +129,7 @@ void settings::loadFromFiles(const std::vector<std::string>& filePaths,
 }
 
 
 }
 
 
-} // namepsace dc
+} // namepsace Mf
 
 /** vim: set ts=4 sw=4 tw=80: *************************************************/
 
 
 /** vim: set ts=4 sw=4 tw=80: *************************************************/
 
This page took 0.021254 seconds and 4 git commands to generate.