X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fconfig.h;h=38ac5e44d98ac15f6079871e1a39d0ac9fbd4a80;hb=f52ca29f2357618da9e87a08bfd61f8a0058a8e1;hp=9747d99aae0ee339a1878a8be3e72c7d60489e09;hpb=63adab21a6f229f434b41eb59c5718fdc3c37b15;p=builder.git diff --git a/source/config.h b/source/config.h index 9747d99..38ac5e4 100644 --- a/source/config.h +++ b/source/config.h @@ -1,18 +1,32 @@ +/* $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 #include -#include -#include +#include +#include #include -#include "option.h" +#include "misc.h" -typedef std::map RawOptionMap; +class SourcePackage; +/** +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; @@ -24,27 +38,35 @@ public: }; typedef std::map 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