]> git.tdb.fi Git - builder.git/blob - source/config.h
Output cleanup
[builder.git] / source / config.h
1 #ifndef CONFIG_H_
2 #define CONFIG_H_
3
4 #include <map>
5 #include <string>
6 #include <msp/parser/loader.h>
7 #include <msp/path/path.h>
8 #include <msp/time/timestamp.h>
9 #include "option.h"
10
11 typedef std::map<std::string, std::string> RawOptionMap;
12
13 class Config
14 {
15 public:
16         struct Option
17         {
18                 std::string name;
19                 std::string defv;
20                 std::string descr;
21                 std::string value;
22
23                 Option(const std::string &, const std::string &, const std::string &);
24         };
25         typedef std::map<std::string, Option> OptionMap;
26
27         void add_option(const std::string &, const std::string &, const std::string &);
28         const Option &get_option(const std::string &) const;
29         const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
30         bool is_option(const std::string &) const;
31         bool process(const RawOptionMap &);
32         void load(const Msp::Path::Path &); 
33 private:
34         class Loader: public Msp::Parser::Loader
35         {
36         };
37         
38         OptionMap options;
39         Msp::Time::TimeStamp mtime;
40 };
41
42 #endif