]> git.tdb.fi Git - builder.git/blobdiff - source/config.h
Migrate from msppath to mspfs
[builder.git] / source / config.h
index 355108fb2c35bcd26f5c012c107dc4d587703212..38ac5e44d98ac15f6079871e1a39d0ac9fbd4a80 100644 (file)
@@ -1,13 +1,21 @@
+/* $Id$
+
+This file is part of builder
+Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
 #ifndef CONFIG_H_
 #define CONFIG_H_
 
 #include <map>
 #include <string>
-#include <msp/parser/loader.h>
-#include <msp/path/path.h>
+#include <msp/datafile/loader.h>
+#include <msp/fs/path.h>
 #include <msp/time/timestamp.h>
+#include "misc.h"
 
-typedef std::map<std::string, std::string> RawOptionMap;
+class SourcePackage;
 
 /**
 Manages configuration for a package.  A configuration may have an arbitary
@@ -30,27 +38,35 @@ public:
        };
        typedef std::map<std::string, Option> OptionMap;
 
+       Config(SourcePackage &);
        void add_option(const std::string &, const std::string &, const std::string &);
        const Option &get_option(const std::string &) const;
        const OptionMap &get_options() const          { return options; }
        const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
        bool is_option(const std::string &) const;
-       bool process(const RawOptionMap &);
-       void load(const Msp::Path::Path &); 
-       void save(const Msp::Path::Path &) const;
+       void select_last_profile();
+       void select_profile(const std::string &);
+       bool update(const StringMap &);
+       void finish();
+       void save() const;
 private:
-       class Loader: public Msp::Parser::Loader
+       class Loader: public Msp::DataFile::Loader
        {
        public:
                Loader(Config &);
        private:
                Config &conf;
-               
+
                void option(const std::string &, const std::string &);
        };
-       
-       OptionMap options;
+
+       SourcePackage   &package;
+       OptionMap       options;
        Msp::Time::TimeStamp mtime;
+       bool freeze_mtime;
+
+       bool set_option(const std::string &, const std::string &);
+       void load();
 };
 
 #endif