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 using InputOptions = std::map<std::string, std::string>;
31 class Loader: public Msp::DataFile::ObjectLoader<Config>
36 void option(const std::string &, const std::string &);
39 SourcePackage &package;
40 std::map<std::string, Option> options;
41 InputOptions pending_options;
42 Msp::Time::TimeStamp mtime;
46 Config(SourcePackage &);
48 /** Adds a configuration option based on a feature. */
49 const Option &add_option(const Feature &);
51 bool set_option(const std::string &, const std::string &);
53 /** Checks whether an option exists. */
54 bool is_option(const std::string &) const;
56 /** Gets a configuration option by name. */
57 const Option &get_option(const std::string &) const;
59 const std::map<std::string, Option> &get_options() const { return options; }
60 const Msp::Time::TimeStamp &get_mtime() const { return mtime; }