Skip to content
Snippets Groups Projects
Commit 895263e5 authored by Andrea Dell'Acqua's avatar Andrea Dell'Acqua
Browse files

add post handling virtual method

parent 1dd75211
Branches
No related tags found
No related merge requests found
Pipeline #1722532 passed
......@@ -6,6 +6,7 @@
#define XMLHandler_H
#include <string>
#include <iostream>
#include <xercesc/dom/DOM.hpp>
#include "ExpressionEvaluator/ExpressionEvaluator.h"
......@@ -18,13 +19,14 @@ public:
virtual ~XMLHandler() {}
std::string GetName() {return m_name;}
virtual void ElementHandle()=0;
virtual void Handle(xercesc::DOMNode *t)
virtual void Handle(xercesc::DOMNode *t)
{
SetCurrentElement(t);
ElementHandle();
}
void StopLoop(bool);
bool IsLoopToBeStopped();
virtual void postLoopHandling() {;}
protected:
std::string m_name;
bool m_stopLoop;
......@@ -32,32 +34,32 @@ protected:
static xercesc::DOMNode *s_currentElement;
static void SetCurrentElement(xercesc::DOMNode *t) {s_currentElement=t;}
static xercesc::DOMNode *GetCurrentElement() {return s_currentElement;}
bool isAttribute(const std::string) const;
std::string getAttribute(const std::string, bool&) const;
std::string getAttributeAsString(const std::string) const;
double getAttributeAsDouble(const std::string) const;
int getAttributeAsInt(const std::string) const;
std::vector<double> getAttributeAsVector(const std::string) const;
std::string getAttributeAsString(const std::string) const;
double getAttributeAsDouble(const std::string) const;
int getAttributeAsInt(const std::string) const;
std::vector<double> getAttributeAsVector(const std::string) const;
std::vector<int> getAttributeAsIntVector(const std::string) const;
std::string getAttributeAsString(const std::string, bool&) const;
double getAttributeAsDouble(const std::string, bool&) const;
int getAttributeAsInt(const std::string, bool&) const;
std::vector<double> getAttributeAsVector(const std::string, bool&) const;
std::vector<int> getAttributeAsIntVector(const std::string, bool&) const;
std::vector<int> getAttributeAsIntVector(const std::string, bool&) const;
std::string getAttributeAsString(const std::string, const std::string) const;
double getAttributeAsDouble(const std::string, const double) const;
int getAttributeAsInt(const std::string, const int) const;
std::vector<double> getAttributeAsVector(const std::string, const std::vector<double>) const;
std::vector<int> getAttributeAsIntVector(const std::string, const std::vector<int>) const;
std::vector<int> getAttributeAsIntVector(const std::string, const std::vector<int>) const;
static bool s_printFlag;
ExpressionEvaluator* Evaluator() const
{
static ExpressionEvaluator* eval=ExpressionEvaluator::GetEvaluator();
return eval;
}
ExpressionEvaluator* Evaluator() const
{
static ExpressionEvaluator* eval=ExpressionEvaluator::GetEvaluator();
return eval;
}
private:
void RegisterToStore();
};
......
......@@ -90,7 +90,7 @@ bool XercesParser::ParseFile(std::string s)
{
XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n " << XERCES_STD_QUALIFIER endl;
errorsOccured = true;
}
}
m_doc=m_parser->getDocument();
return errorsOccured;
}
......@@ -148,7 +148,7 @@ bool XercesParser::ParseString(std::string s)
{
XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n " << XERCES_STD_QUALIFIER endl;
errorsOccured = true;
}
}
m_doc=m_parser->getDocument();
return errorsOccured;
}
......@@ -187,7 +187,7 @@ bool XercesParser::WriteToFile(std::string s)
void XercesParser::navigateTree()
{
if (!m_doc)
if (!m_doc)
{
std::cout<<" something is wrong! no document set!"<<std::endl;
std::cout<<" doing nothing!"<<std::endl;
......@@ -235,6 +235,7 @@ void XercesParser::elementLoop(DOMNode *e)
elementLoop(child);
}
}
if (h) h->postLoopHandling();
}
// XMLHandler *h=XMLHandlerStore::GetHandlerStore()->GetHandler(element);
// bool stopLoop=false;
......@@ -245,8 +246,8 @@ void XercesParser::elementLoop(DOMNode *e)
// }
// TiXmlElement* subelement;
// subelement=element->FirstChildElement();
//
// if (!stopLoop && subelement)
//
// if (!stopLoop && subelement)
// do
// {
// // std::cout<<" \telement "<<subelement->Value()<<std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment