36 #include <xercesc/sax/HandlerBase.hpp> 37 #include <xercesc/sax/AttributeList.hpp> 38 #include <xercesc/sax/SAXParseException.hpp> 39 #include <xercesc/sax/SAXException.hpp> 54 : myRootOnly(rootOnly), myError(false), myOptions(
OptionsCont::getOptions()), myItem() {}
61 XERCES_CPP_NAMESPACE::AttributeList& attributes) {
64 for (
int i = 0; i < (int)attributes.getLength(); i++) {
67 if (key ==
"value" || key ==
"v") {
79 if (value.length() > 0) {
82 WRITE_ERROR(
"Could not set option '" + key +
"' (probably defined twice).");
101 const std::string& value)
const {
115 if (
myValue.find_first_not_of(
"\n\t \a") == std::string::npos) {
128 +
toString(exception.getLineNumber() + 1) +
'/' \
129 +
toString(exception.getColumnNumber()) +
").");
140 +
toString(exception.getLineNumber() + 1) +
'/' 141 +
toString(exception.getColumnNumber()) +
").");
152 +
toString(exception.getLineNumber() + 1) +
'/' 153 +
toString(exception.getColumnNumber()) +
").");
std::string myItem
The name of the currently parsed option.
std::string myValue
The currently read characters string.
void endElement(const XMLCh *const name)
Called on the end of an element.
OptionsCont & myOptions
The options to fill.
void error(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-error.
#define WRITE_WARNING(msg)
bool setSecure(const std::string &name, const std::string &value) const
Tries to set the named option to the given value.
bool myError
The information whether an error occured.
OptionsLoader(const bool routeOnly=false)
Constructor.
bool myRootOnly
The information whether only the root element should be parsed.
void setValue(const std::string &key, std::string &value)
Tries to set the named option to the given value.
virtual void startElement(const XMLCh *const name, XERCES_CPP_NAMESPACE::AttributeList &attributes)
Called on the occurence of the beginning of a tag.
void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-fatal error.
bool errorOccured() const
Returns the information whether an error occured.
bool isWriteable(const std::string &name)
Returns the information whether the named option may be set.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void warning(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-warning.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
void characters(const XMLCh *const chars, const XERCES3_SIZE_t length)
Called on the occurence of character data.
A storage for options typed value containers)
static std::string _2str(const int var)
convert int to string