Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
TemplateHandler Class Reference

A SAX-Handler for loading options. More...

#include <TemplateHandler.h>

Inheritance diagram for TemplateHandler:
[legend]
Collaboration diagram for TemplateHandler:
[legend]

Static Public Member Functions

static void parseTemplate (OptionsCont &options, const std::string &templateString)
 run parser
 

Private Member Functions

TemplateHandleroperator= (const TemplateHandler &s)=delete
 invalid assignment operator
 
 TemplateHandler (const TemplateHandler &s)=delete
 invalid copy constructor
 
 TemplateHandler (OptionsCont &options)
 Constructor.
 
 ~TemplateHandler ()
 destructor
 
Handlers for the SAX DocumentHandler interface
void startElement (const XMLCh *const name, XERCES_CPP_NAMESPACE::AttributeList &attributes)
 Called on the occurrence of the beginning of a tag.
 
bool addOption (std::string value, const std::string &synonymes, const std::string &type, const std::string &help, bool required, bool positional, const std::string &listSep) const
 add option
 
void endElement (const XMLCh *const name)
 Called on the end of an element.
 
Handlers for the SAX ErrorHandler interface
void warning (const XERCES_CPP_NAMESPACE::SAXParseException &exception)
 Called on an XML-warning.
 
void error (const XERCES_CPP_NAMESPACE::SAXParseException &exception)
 Called on an XML-error.
 
void fatalError (const XERCES_CPP_NAMESPACE::SAXParseException &exception)
 Called on an XML-fatal error.
 

Private Attributes

bool myError
 The information whether an error occurred.
 
int myLevel
 The nesting level of parsed elements.
 
std::string myOptionName
 The name of the current option.
 
OptionsContmyOptions
 The options to fill.
 
std::string mySubTopic
 current subtopic
 

Static Private Attributes

static const std::string INVALID_DOUBLE_STR = toString(INVALID_DOUBLE)
 invalid double in string format
 
static const std::string INVALID_INT_STR = toString(INVALID_INT)
 invalid int in string format
 

Detailed Description

A SAX-Handler for loading options.

Definition at line 43 of file TemplateHandler.h.

Constructor & Destructor Documentation

◆ TemplateHandler() [1/2]

TemplateHandler::TemplateHandler ( OptionsCont options)
private

Constructor.

Definition at line 76 of file TemplateHandler.cpp.

◆ ~TemplateHandler()

TemplateHandler::~TemplateHandler ( )
private

destructor

Definition at line 82 of file TemplateHandler.cpp.

◆ TemplateHandler() [2/2]

TemplateHandler::TemplateHandler ( const TemplateHandler s)
privatedelete

invalid copy constructor

Member Function Documentation

◆ addOption()

bool TemplateHandler::addOption ( std::string  value,
const std::string &  synonymes,
const std::string &  type,
const std::string &  help,
bool  required,
bool  positional,
const std::string &  listSep 
) const
private

add option

Definition at line 141 of file TemplateHandler.cpp.

References OptionsCont::addDescription(), OptionsCont::addSynonyme(), OptionsCont::doRegister(), OptionsCont::exists(), INVALID_DOUBLE_STR, INVALID_INT_STR, Option::isSet(), myOptionName, myOptions, mySubTopic, Option::set(), OptionsCont::setFurtherAttributes(), and WRITE_WARNING.

Referenced by startElement().

Here is the caller graph for this function:

◆ endElement()

void TemplateHandler::endElement ( const XMLCh *const  name)
private

Called on the end of an element.

Resets the element name

Definition at line 229 of file TemplateHandler.cpp.

References myLevel, and myOptionName.

◆ error()

void TemplateHandler::error ( const XERCES_CPP_NAMESPACE::SAXParseException &  exception)
private

Called on an XML-error.

The warning is reported to the error-instance of MsgHandler

Definition at line 249 of file TemplateHandler.cpp.

References myError, toString(), StringUtils::transcode(), and WRITE_ERROR.

◆ fatalError()

void TemplateHandler::fatalError ( const XERCES_CPP_NAMESPACE::SAXParseException &  exception)
private

Called on an XML-fatal error.

The warning is reported to the error-instance of MsgHandler

Definition at line 259 of file TemplateHandler.cpp.

References myError, toString(), StringUtils::transcode(), and WRITE_ERROR.

◆ operator=()

TemplateHandler & TemplateHandler::operator= ( const TemplateHandler s)
privatedelete

invalid assignment operator

◆ parseTemplate()

void TemplateHandler::parseTemplate ( OptionsCont options,
const std::string &  templateString 
)
static

run parser

Definition at line 52 of file TemplateHandler.cpp.

References myError, OptionsCont::resetDefault(), TLF, and StringUtils::transcode().

Referenced by GNEApplicationWindow::GNEApplicationWindow(), and GNEPythonTool::GNEPythonTool().

Here is the caller graph for this function:

◆ startElement()

void TemplateHandler::startElement ( const XMLCh *const  name,
XERCES_CPP_NAMESPACE::AttributeList &  attributes 
)
private

Called on the occurrence of the beginning of a tag.

Sets the name of the last item

Definition at line 86 of file TemplateHandler.cpp.

References addOption(), OptionsCont::addOptionSubTopic(), OptionsCont::getSubTopics(), myLevel, myOptionName, myOptions, mySubTopic, StringUtils::toBool(), and StringUtils::transcode().

◆ warning()

void TemplateHandler::warning ( const XERCES_CPP_NAMESPACE::SAXParseException &  exception)
private

Called on an XML-warning.

The warning is reported to the warning-instance of MsgHandler

Definition at line 239 of file TemplateHandler.cpp.

References myError, toString(), StringUtils::transcode(), and WRITE_WARNING.

Field Documentation

◆ INVALID_DOUBLE_STR

const std::string TemplateHandler::INVALID_DOUBLE_STR = toString(INVALID_DOUBLE)
staticprivate

invalid double in string format

Definition at line 119 of file TemplateHandler.h.

Referenced by addOption().

◆ INVALID_INT_STR

const std::string TemplateHandler::INVALID_INT_STR = toString(INVALID_INT)
staticprivate

invalid int in string format

Definition at line 116 of file TemplateHandler.h.

Referenced by addOption().

◆ myError

bool TemplateHandler::myError
private

The information whether an error occurred.

Definition at line 101 of file TemplateHandler.h.

Referenced by error(), fatalError(), parseTemplate(), and warning().

◆ myLevel

int TemplateHandler::myLevel
private

The nesting level of parsed elements.

Definition at line 104 of file TemplateHandler.h.

Referenced by endElement(), and startElement().

◆ myOptionName

std::string TemplateHandler::myOptionName
private

The name of the current option.

Definition at line 110 of file TemplateHandler.h.

Referenced by addOption(), endElement(), and startElement().

◆ myOptions

OptionsCont& TemplateHandler::myOptions
private

The options to fill.

Definition at line 107 of file TemplateHandler.h.

Referenced by addOption(), and startElement().

◆ mySubTopic

std::string TemplateHandler::mySubTopic
private

current subtopic

Definition at line 113 of file TemplateHandler.h.

Referenced by addOption(), and startElement().


The documentation for this class was generated from the following files: