| 1 |
// Component to read configuration |
|---|
| 2 |
// Copyright (c) 2007 Gregor Richards |
|---|
| 3 |
// License for redistribution is by either the Artistic License |
|---|
| 4 |
// in artistic.txt, or the GNU General Public License in gnu.txt |
|---|
| 5 |
// or any later version. |
|---|
| 6 |
// See the included readme.txt for details. |
|---|
| 7 |
|
|---|
| 8 |
#ifndef CONFIG_H |
|---|
| 9 |
#define CONFIG_H |
|---|
| 10 |
|
|---|
| 11 |
#include <map> |
|---|
| 12 |
#include <string> |
|---|
| 13 |
|
|---|
| 14 |
#ifdef __WIN32 |
|---|
| 15 |
#define DIRSEP "\\" |
|---|
| 16 |
#else |
|---|
| 17 |
#define DIRSEP "/" |
|---|
| 18 |
#endif |
|---|
| 19 |
|
|---|
| 20 |
typedef std::map<std::string, std::string> ConfigSection; |
|---|
| 21 |
typedef std::map<std::string, ConfigSection> Config; |
|---|
| 22 |
|
|---|
| 23 |
extern Config masterConfig; |
|---|
| 24 |
|
|---|
| 25 |
extern std::string compileFlags; |
|---|
| 26 |
extern std::string linkFlags; |
|---|
| 27 |
extern std::string liblinkFlags; |
|---|
| 28 |
extern std::string shliblinkFlags; |
|---|
| 29 |
|
|---|
| 30 |
// Read a configuration file |
|---|
| 31 |
void readConfig(char *argvz, const std::string &profile, bool generate); |
|---|
| 32 |
|
|---|
| 33 |
// Read from a command |
|---|
| 34 |
int readCommand(std::string cmd, char *buf, int len); |
|---|
| 35 |
|
|---|
| 36 |
// Add a flag, with a default |
|---|
| 37 |
void addFlag(std::string &to, const std::string §ion, const std::string &flag, |
|---|
| 38 |
const std::string &def, const std::string &inp = "", const std::string &out = "", |
|---|
| 39 |
bool pre = false); |
|---|
| 40 |
|
|---|
| 41 |
// Add a library to linkFlags |
|---|
| 42 |
void linkLibrary(const std::string &name); |
|---|
| 43 |
|
|---|
| 44 |
#endif |
|---|