]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Settings.hh
the massive refactoring effort
[chaz/yoink] / src / Moof / Settings.hh
diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh
deleted file mode 100644 (file)
index 192e2a7..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
-**]  All rights reserved.
-*
-* vi:ts=4 sw=4 tw=75
-*
-* Distributable under the terms and conditions of the 2-clause BSD license;
-* see the file COPYING for a complete text of the license.
-*
-**************************************************************************/
-
-#ifndef _MOOF_SETTINGS_HH_
-#define _MOOF_SETTINGS_HH_
-
-/**
- * @file Settings.hh
- * Load, store, save program settings.
- */
-
-#include <string>
-#include <vector>
-
-#include <boost/algorithm/string.hpp>
-
-#include <Moof/Log.hh>
-#include <Moof/Script.hh>
-
-
-namespace Mf {
-
-
-class Settings
-{
-public:
-
-       Settings(int argc, char* argv[], const std::string& path)
-       {
-               mScript.importBaseLibrary();
-               importLogFunctions(mScript);
-
-               parseArgs(argc, argv);
-               loadFromFiles(path);
-       }
-
-       ~Settings();
-
-       void parseArgs(int argc, char* argv[]);
-
-       void loadFromFiles(const std::string& path);
-       void loadFromFiles(const std::vector<std::string>& path);
-
-       void clear();           // remove all settings
-
-       void saveAs(const std::string& path);
-       void save() const;
-
-       template <class T>
-       bool get(const std::string& key, T& value) const;
-
-private:
-
-       mutable Script  mScript;
-
-       std::string             mUserFile;
-};
-
-
-template <class T>
-bool Settings::get(const std::string& key, T& value) const
-{
-       Script::Slot top = mScript[-1];
-       Script::Slot globals = mScript.globals();
-
-       std::vector<std::string> fields;
-       boost::split(fields, key, boost::is_any_of("."));
-
-       globals.pushCopy();
-
-       std::vector<std::string>::iterator it;
-       for (it = fields.begin(); it != fields.end(); ++it)
-       {
-               if (top.isTable())
-               {
-                       top.pushField(*it);
-               }
-               else
-               {
-                       mScript.clearStack();
-                       return false;
-               }
-       }
-
-       bool got = top.get(value);
-       mScript.clearStack();
-       return got;
-}
-
-
-} // namepsace Mf
-
-#endif // _MOOF_SETTINGS_HH_
-
This page took 0.018827 seconds and 4 git commands to generate.