1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
//===-- driver/configfile.h - LDC config file handling ----------*- C++ -*-===//
//
// LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// Handles reading and parsing of an LDC config file (ldc.conf/ldc2.conf).
//
//===----------------------------------------------------------------------===//
#ifndef LDC_DRIVER_CONFIGFILE_H
#define LDC_DRIVER_CONFIGFILE_H
#include <string>
#include <vector>
#include "llvm/ADT/SmallString.h"
namespace libconfig
{
class Config;
}
class ConfigFile
{
public:
typedef std::vector<const char*> s_vector;
typedef s_vector::iterator s_iterator;
public:
ConfigFile();
~ConfigFile();
bool read(const char* argv0, void* mainAddr, const char* filename);
s_iterator switches_begin() { return switches.begin(); }
s_iterator switches_end() { return switches.end(); }
const std::string& path() { return pathstr; }
private:
bool locate(llvm::SmallString<128> &path, const char* argv0, void* mainAddr, const char* filename);
libconfig::Config* cfg;
std::string pathstr;
s_vector switches;
};
#endif // LDC_DRIVER_CONFIGFILE_H
|