]> git.tdb.fi Git - builder.git/blobdiff - source/config.cpp
Refactor transitive dependencies to work on all targets
[builder.git] / source / config.cpp
diff --git a/source/config.cpp b/source/config.cpp
deleted file mode 100644 (file)
index de6b9bc..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <fstream>
-#include <msp/error.h>
-#include <msp/path/utils.h>
-#include <msp/time/utils.h>
-#include "config.h"
-
-using namespace std;
-using namespace Msp;
-
-void Config::add_option(const string &n, const string &v, const string &d)
-{
-       options.insert(OptionMap::value_type(n, Option(n, v, d)));
-}
-
-const Config::Option &Config::get_option(const string &name) const
-{
-       OptionMap::const_iterator i=options.find(name);
-       if(i==options.end())
-               throw Exception("Tried to access nonexistent option "+name);
-
-       return i->second;
-}
-
-bool Config::is_option(const string &name) const
-{
-       return options.count(name);
-}
-
-bool Config::process(const RawOptionMap &opts)
-{
-       bool changed=false;
-       for(RawOptionMap::const_iterator i=opts.begin(); i!=opts.end(); ++i)
-       {
-               OptionMap::iterator j=options.find(i->first);
-               if(j!=options.end())
-               {
-                       if(i->second!=j->second.value)
-                               changed=true;
-                       j->second.value=i->second;
-               }
-       }
-
-       if(changed)
-               mtime=Time::now();
-
-       return changed;
-}
-
-void Config::load(const Path::Path &fn)
-{
-       ifstream in(fn.str().c_str());
-       if(!in) return;
-
-       struct stat st;
-       Path::stat(fn, st);
-       mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
-}
-
-Config::Option::Option(const string &n, const string &v, const string &d):
-       name(n),
-       defv(v),
-       descr(d),
-       value(v)
-{ }