X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fconfig.h;h=2767f8263a827a67693ee18376d605e842077530;hb=2842eeda5aa7c143b3ff54d48f8673bbdcb35c75;hp=9a73880ac887f331e9eae93d0ccbd48892aff7fd;hpb=cbb3c4c6aab7b04f7bd2178fb8f12846d532a472;p=builder.git diff --git a/source/config.h b/source/config.h index 9a73880..2767f82 100644 --- a/source/config.h +++ b/source/config.h @@ -6,13 +6,19 @@ #include #include #include -#include "option.h" typedef std::map RawOptionMap; +/** +Manages configuration for a package. A configuration may have an arbitary +amount of options, as well as a modification time (mtime). +*/ class Config { public: + /** + A single configuration option. + */ struct Option { std::string name; @@ -26,11 +32,14 @@ public: 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 RawOptionMap &); + void set_source(const Msp::Path::Path &s) { source=s; } + void save() const; private: class Loader: public Msp::Parser::Loader { @@ -42,8 +51,12 @@ private: void option(const std::string &, const std::string &); }; - OptionMap options; + Msp::Path::Path source; + OptionMap options; Msp::Time::TimeStamp mtime; + + bool set_option(const std::string &, const std::string &); + void load(); }; #endif