29 #include <xercesc/sax/HandlerBase.hpp> 30 #include <xercesc/sax/AttributeList.hpp> 31 #include <xercesc/sax/SAXParseException.hpp> 32 #include <xercesc/sax/SAXException.hpp> 47 : myRootOnly(rootOnly), myError(false), myOptions(
OptionsCont::getOptions()), myItem() {}
54 XERCES_CPP_NAMESPACE::AttributeList& attributes) {
57 for (
int i = 0; i < (int)attributes.getLength(); i++) {
60 if (key ==
"value" || key ==
"v") {
72 if (value.length() > 0) {
75 WRITE_ERROR(
"Could not set option '" + key +
"' (probably defined twice).");
94 const std::string& value)
const {
108 if (
myValue.find_first_not_of(
"\n\t \a") == std::string::npos) {
121 +
toString(exception.getLineNumber() + 1) +
'/' \
122 +
toString(exception.getColumnNumber()) +
").");
133 +
toString(exception.getLineNumber() + 1) +
'/' 134 +
toString(exception.getColumnNumber()) +
").");
145 +
toString(exception.getLineNumber() + 1) +
'/' 146 +
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.
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8...
bool myError
The information whether an error occurred.
OptionsLoader(const bool routeOnly=false)
Constructor.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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 isWriteable(const std::string &name)
Returns the information whether the named option may be set.
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)
bool errorOccurred() const
Returns the information whether an error occurred.