34 #include <xercesc/parsers/SAXParser.hpp>
35 #include <xercesc/sax/HandlerBase.hpp>
36 #include <xercesc/sax/AttributeList.hpp>
37 #include <xercesc/util/PlatformUtils.hpp>
38 #include <xercesc/sax/SAXParseException.hpp>
39 #include <xercesc/sax/SAXException.hpp>
49 #ifdef CHECK_MEMORY_LEAKS
51 #endif // CHECK_MEMORY_LEAKS
72 throw ProcessError(
"Could not parse commandline options.");
91 if (!oc.
exists(
"configuration-file") || !oc.
isSet(
"configuration-file")) {
94 std::string path = oc.
getString(
"configuration-file");
100 XERCES_CPP_NAMESPACE::SAXParser parser;
101 parser.setValidationScheme(XERCES_CPP_NAMESPACE::SAXParser::Val_Auto);
102 parser.setDoNamespaces(
false);
103 parser.setDoSchema(
false);
107 parser.setDocumentHandler(&handler);
108 parser.setErrorHandler(&handler);
109 parser.parse(path.c_str());
111 throw ProcessError(
"Could not load configuration '" + path +
"'.");
113 }
catch (
const XERCES_CPP_NAMESPACE::XMLException& e) {
void resetWritable()
Resets all options to be writeable.
static void getOptions(bool loadConfig, int argc=0, char **argv=0)
Parses the command line arguments and loads the configuration optionally.
static bool isReadable(std::string path)
Checks whether the given file is readable.
static OptionsCont & getOptions()
Retrieves the options.
static bool parse(int argc, char **argv)
Parses the given command line arguments.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void loadConfiguration()
Loads and parses the configuration.
static std::string _2str(const E *const data)
bool errorOccured() const
Returns the information whether an error occured.
#define PROGRESS_BEGIN_MESSAGE(msg)
A SAX-Handler for loading options.
void relocateFiles(const std::string &configuration) const
Modifies file name options according to the configuration path.
A storage for options typed value containers)
#define PROGRESS_DONE_MESSAGE()
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.