+++ /dev/null
-#ifndef CONFIG_H_
-#define CONFIG_H_
-
-#include <map>
-#include <string>
-#include <msp/parser/loader.h>
-#include <msp/path/path.h>
-#include <msp/time/timestamp.h>
-#include "misc.h"
-
-class Package;
-
-/**
-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;
- std::string defv;
- std::string descr;
- std::string value;
-
- Option(const std::string &, const std::string &, const std::string &);
- };
- typedef std::map<std::string, Option> OptionMap;
-
- Config(Package &);
- 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;
- 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
- {
- public:
- Loader(Config &);
- private:
- Config &conf;
-
- void option(const std::string &, const std::string &);
- };
-
- Package &package;
- OptionMap options;
- Msp::Time::TimeStamp mtime;
- bool freeze_mtime;
-
- bool set_option(const std::string &, const std::string &);
- void load();
-};
-
-#endif