]> Dogcows Code - chaz/yoink/blobdiff - src/moof/settings.cc
the massive refactoring effort
[chaz/yoink] / src / moof / settings.cc
similarity index 55%
rename from src/Moof/Settings.cc
rename to src/moof/settings.cc
index 584643023892b89c2dec9bf373dcb160f9b3b2a1..4e026929dd779c8dfbffaa0dfa98b26f15f6a928 100644 (file)
 
 #include <cstdlib>             // getenv
 
-#include "Settings.hh"
+#include "log.hh"
+#include "settings.hh"
 
 
-namespace Mf {
+namespace moof {
 
 
-Settings::~Settings()
+settings::settings(int argc, char* argv[], const std::string& path)
+{
+       script_.import_base_library();
+       log::import(script_);
+
+       parse_args(argc, argv);
+       load_files(path);
+}
+
+settings::~settings()
 {
        save();
 }
 
 
-void Settings::parseArgs(int argc, char* argv[])
+void settings::parse_args(int argc, char* argv[])
 {
        for (int i = 1; i < argc; ++i)
        {
-               if (mScript.doString(argv[i]) != Script::SUCCESS)
+               if (script_.do_string(argv[i]) != script::success)
                {
                        std::string str;
-                       mScript[-1].get(str);
-                       logWarning << "invalid option: " << argv[i]
+                       script_[-1].get(str);
+                       log_warning << "invalid option: " << argv[i]
                                           << ": " << str << std::endl;
-                       mScript.clearStack();
+                       script_.clear_stack();
                }
        }
 }
 
 
-void Settings::loadFromFiles(const std::string& path)
+void settings::load_files(const std::string& path)
 {
        std::vector<std::string> paths;
        boost::split(paths, path, boost::is_any_of(":"));
 
-       loadFromFiles(paths);
+       load_files(paths);
 }
 
-void Settings::loadFromFiles(const std::vector<std::string>& path)
+void settings::load_files(const std::vector<std::string>& path)
 {
        std::vector<std::string> copy(path);
        std::vector<std::string>::iterator it;
@@ -68,40 +78,40 @@ void Settings::loadFromFiles(const std::vector<std::string>& path)
                {
                        boost::replace_all(*it, "$HOME", home);
 
-                       //Mf::logDebug("Copying global settings...");
+                       //logDebug("Copying global settings...");
                        //mUserFile = *it;
-                       //mGlobals.pushCopy();
-                       //mScript.set("globals", Script::REGISTRY);
+                       //mGlobals.push_copy();
+                       //script_.set("globals", script::registry_index);
                }
 
-               if (mScript.doFile(*it) != Script::SUCCESS)
+               if (script_.do_file(*it) != script::success)
                {
                        std::string str;
-                       mScript[-1].get(str);
-                       logWarning(str);
-                       mScript.clearStack();
+                       script_[-1].get(str);
+                       log_warning(str);
+                       script_.clear_stack();
                }
        }
 }
 
 
-void Settings::clear()
+void settings::clear()
 {
-       mScript.reset();
+       script_.reset();
 }
 
 
-void Settings::saveAs(const std::string& path)
+void settings::save_as(const std::string& path)
 {
        mUserFile = path;
        save();
 }
 
-void Settings::save() const
+void settings::save() const
 {
        // TODO saving settings not yet implemented
 }
 
 
-} // namepsace Mf
+} // namepsace moof
 
This page took 0.023503 seconds and 4 git commands to generate.