6 #include <msp/datafile/loader.h>
7 #include <msp/fs/path.h>
8 #include <msp/time/timestamp.h>
14 Manages configuration for a package. A configuration may have an arbitary
15 amount of options, as well as a modification time (mtime).
20 /** A single configuration option. */
21 struct Option: public Feature
25 Option(const Feature &);
28 typedef std::map<std::string, Option> OptionMap;
29 typedef std::map<std::string, std::string> InputOptions;
32 class Loader: public Msp::DataFile::ObjectLoader<Config>
37 void option(const std::string &, const std::string &);
40 SourcePackage &package;
42 InputOptions pending_options;
43 Msp::Time::TimeStamp mtime;
47 Config(SourcePackage &);
49 /** Adds a configuration option based on a feature. */
50 const Option &add_option(const Feature &);
52 bool set_option(const std::string &, const std::string &);
54 /** Checks whether an option exists. */
55 bool is_option(const std::string &) const;
57 /** Gets a configuration option by name. */
58 const Option &get_option(const std::string &) const;
60 const OptionMap &get_options() const { return options; }
61 const Msp::Time::TimeStamp &get_mtime() const { return mtime; }