 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
28 #include <xercesc/sax/HandlerBase.hpp>
29 #include <xercesc/sax/AttributeList.hpp>
30 #include <xercesc/sax/SAXParseException.hpp>
31 #include <xercesc/sax/SAXException.hpp>
46 : myRootOnly(rootOnly), myError(false), myOptions(
OptionsCont::getOptions()), myItem() {}
53 XERCES_CPP_NAMESPACE::AttributeList& attributes) {
56 for (
int i = 0; i < (int)attributes.getLength(); i++) {
59 if (key ==
"value" || key ==
"v") {
73 if (value.length() > 0) {
76 WRITE_ERROR(
"Could not set option '" + key +
"' (probably defined twice).");
95 const std::string& value)
const {
109 if (
myValue.find_first_not_of(
"\n\t \a") == std::string::npos) {
122 +
toString(exception.getLineNumber() + 1) +
'/' \
123 +
toString(exception.getColumnNumber()) +
").");
134 +
toString(exception.getLineNumber() + 1) +
'/'
135 +
toString(exception.getColumnNumber()) +
").");
146 +
toString(exception.getLineNumber() + 1) +
'/'
147 +
toString(exception.getColumnNumber()) +
").");
bool setSecure(const std::string &name, const std::string &value) const
Tries to set the named option to the given value.
void warning(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-warning.
#define WRITE_WARNING(msg)
void error(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-error.
OptionsLoader(const bool routeOnly=false)
Constructor.
virtual void startElement(const XMLCh *const name, XERCES_CPP_NAMESPACE::AttributeList &attributes)
Called on the occurence of the beginning of a tag.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
std::string myItem
The name of the currently parsed option.
bool myRootOnly
The information whether only the root element should be parsed.
bool errorOccurred() const
Returns the information whether an error occurred.
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)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static std::string substituteEnvironment(std::string str)
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.
std::string myValue
The currently read characters string.
void setValue(const std::string &key, std::string &value)
Tries to set the named option to the given value.
void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-fatal error.
OptionsCont & myOptions
The options to fill.
bool isWriteable(const std::string &name)
Returns the information whether the named option may be set.
void endElement(const XMLCh *const name)
Called on the end of an element.