Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

root/gen/configfile.h

Revision 1489:a048f31bf9f6, 0.8 kB (checked in by Christian Kamm <kamm incasoftware de>, 3 years ago)

Move locating the configuration file into a separate function. Also look in PREFIX/etc/ldc. Fixes #322.

Line 
1 #ifndef LDC_CONF_CONFIGFILE_H
2 #define LDC_CONF_CONFIGFILE_H
3
4 #include <vector>
5 #include <string>
6
7 namespace libconfig
8 {
9     class Config;
10 }
11
12 class ConfigFile
13 {
14 public:
15     typedef std::vector<const char*>    s_vector;
16     typedef s_vector::iterator          s_iterator;
17
18 public:
19     ConfigFile();
20     ~ConfigFile();
21
22     bool read(const char* argv0, void* mainAddr, const char* filename);
23
24     s_iterator switches_begin()   { return switches.begin(); }
25     s_iterator switches_end()     { return switches.end(); }
26
27     const std::string& path()     { return pathstr; }
28
29 private:
30     bool locate(llvm::sys::Path& path, const char* argv0, void* mainAddr, const char* filename);
31
32     libconfig::Config* cfg;
33     std::string pathstr;
34
35     s_vector switches;
36 };
37
38 #endif // LDC_CONF_CONFIGFILE_H
Note: See TracBrowser for help on using the browser.
Copyright © 2008, LDC Development Team.