SUMO - Simulation of Urban MObility
|
A SAX-Handler for loading options. More...
#include <OptionsLoader.h>
Public Member Functions | |
bool | errorOccured () const |
Returns the information whether an error occured. More... | |
OptionsLoader () | |
Constructor. More... | |
~OptionsLoader () | |
Handlers for the SAX DocumentHandler interface | |
virtual void | startElement (const XMLCh *const name, XERCES_CPP_NAMESPACE::AttributeList &attributes) |
Called on the occurence of the beginning of a tag. More... | |
void | characters (const XMLCh *const chars, const XERCES3_SIZE_t length) |
Called on the occurence of character data. More... | |
void | endElement (const XMLCh *const name) |
Called on the end of an element. More... | |
Handlers for the SAX ErrorHandler interface | |
void | warning (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Called on an XML-warning. More... | |
void | error (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Called on an XML-error. More... | |
void | fatalError (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Called on an XML-fatal error. More... | |
Private Member Functions | |
OptionsLoader & | operator= (const OptionsLoader &s) |
OptionsLoader (const OptionsLoader &s) | |
bool | setSecure (const std::string &name, const std::string &value) const |
Tries to set the named option to the given value. More... | |
void | setValue (const std::string &key, std::string &value) |
Tries to set the named option to the given value. More... | |
Private Attributes | |
bool | myError |
The information whether an error occured. More... | |
std::string | myItem |
The name of the currently parsed option. More... | |
OptionsCont & | myOptions |
The options to fill. More... | |
std::string | myValue |
The currently read characters string. More... | |
A SAX-Handler for loading options.
Definition at line 54 of file OptionsLoader.h.
OptionsLoader::OptionsLoader | ( | ) |
Constructor.
Definition at line 53 of file OptionsLoader.cpp.
OptionsLoader::~OptionsLoader | ( | ) |
destructor
Definition at line 57 of file OptionsLoader.cpp.
|
private |
invalid copy constructor
void OptionsLoader::characters | ( | const XMLCh *const | chars, |
const XERCES3_SIZE_t | length | ||
) |
Called on the occurence of character data.
If this occurs inside a single tag it sets the option named by the tag to the value given by the character data. This is considered deprecated in favor of attributes.
Definition at line 91 of file OptionsLoader.cpp.
References TplConvert::_2str(), and myValue.
void OptionsLoader::endElement | ( | const XMLCh *const | name | ) |
Called on the end of an element.
Resets the element name
Definition at line 109 of file OptionsLoader.cpp.
References myItem, myValue, and setValue().
void OptionsLoader::error | ( | const XERCES_CPP_NAMESPACE::SAXParseException & | exception | ) |
Called on an XML-error.
The warning is reported to the the error-instance of MsgHandler
Definition at line 133 of file OptionsLoader.cpp.
References TplConvert::_2str(), myError, toString(), and WRITE_ERROR.
bool OptionsLoader::errorOccured | ( | ) | const |
Returns the information whether an error occured.
Definition at line 157 of file OptionsLoader.cpp.
References myError.
Referenced by OptionsIO::loadConfiguration().
void OptionsLoader::fatalError | ( | const XERCES_CPP_NAMESPACE::SAXParseException & | exception | ) |
Called on an XML-fatal error.
The warning is reported to the the error-instance of MsgHandler
Definition at line 145 of file OptionsLoader.cpp.
References TplConvert::_2str(), myError, toString(), and WRITE_ERROR.
|
private |
invalid assignment operator
|
private |
Tries to set the named option to the given value.
Checks the item whether it was default before setting it. Returns the information whether the item was set before (was not a default value)
[in] | name | The name of the option to set |
[in] | value | The new value for the option |
Definition at line 98 of file OptionsLoader.cpp.
References OptionsCont::isWriteable(), myOptions, and OptionsCont::set().
Referenced by setValue().
|
private |
Tries to set the named option to the given value.
Also evaluates whether it is a boolean or a filename option and does the relevant checks / modifications.
[in] | key | The name of the option to set |
[in] | value | The new value for the option |
Definition at line 75 of file OptionsLoader.cpp.
References myError, setSecure(), and WRITE_ERROR.
Referenced by endElement(), and startElement().
|
virtual |
Called on the occurence of the beginning of a tag.
Sets the name of the last item
Definition at line 60 of file OptionsLoader.cpp.
References TplConvert::_2str(), myItem, myValue, and setValue().
void OptionsLoader::warning | ( | const XERCES_CPP_NAMESPACE::SAXParseException & | exception | ) |
Called on an XML-warning.
The warning is reported to the the warning-instance of MsgHandler
Definition at line 123 of file OptionsLoader.cpp.
References TplConvert::_2str(), myError, toString(), and WRITE_WARNING.
|
private |
The information whether an error occured.
Definition at line 163 of file OptionsLoader.h.
Referenced by error(), errorOccured(), fatalError(), setValue(), and warning().
|
private |
The name of the currently parsed option.
Definition at line 169 of file OptionsLoader.h.
Referenced by endElement(), and startElement().
|
private |
|
private |
The currently read characters string.
Definition at line 172 of file OptionsLoader.h.
Referenced by characters(), endElement(), and startElement().