Fixed some C/C++ compiler errors due to stricter checks.
[rubinius.git] / machine / config_parser.hpp
blobab5211876da31795778ca04a27907d8caa5df6e8
1 #ifndef RBX_CONFIG_PARSER
2 #define RBX_CONFIG_PARSER
4 #include <string>
5 #include <iostream>
6 #include <vector>
8 namespace rubinius {
9 class Configuration;
11 class ConfigParser {
12 public:
13 class Entry {
14 public:
15 std::string variable;
16 std::string value;
18 bool is_number() const;
19 bool is_true() const;
20 bool in_section(std::string prefix) const;
21 long to_i() const;
24 typedef std::vector< std::pair<std::string, Entry*> > ConfigVector;
25 typedef std::vector<Entry*> EntryList;
27 ConfigVector variables;
29 virtual ~ConfigParser();
31 bool load_file(std::string path);
32 Entry* parse_line(const char* line);
33 void import_line(const char* line);
34 void set(const char* name, const char* val);
35 void import_many(std::string string);
36 void import_stream(std::istream&);
37 Entry* find(std::string variable);
38 EntryList* get_section(std::string prefix);
40 void update_configuration(Configuration*);
41 void parsed_options(std::string& str);
43 private:
44 bool process_internal(std::string key, std::string val);
48 #endif