Moved the loadXML method from SIMadmin to XMLInputBase
This commit is contained in:
parent
05a6a068a3
commit
e92bf6e65a
@ -83,15 +83,6 @@ bool SIMadmin::read (const char* fileName)
|
||||
}
|
||||
|
||||
|
||||
bool SIMadmin::loadXML (const char* xml)
|
||||
{
|
||||
TiXmlDocument doc;
|
||||
doc.Parse(xml,nullptr,TIXML_ENCODING_UTF8);
|
||||
const TiXmlElement* tag = doc.RootElement();
|
||||
return tag ? this->parse(tag) : false;
|
||||
}
|
||||
|
||||
|
||||
bool SIMadmin::readFlat (const char* fileName)
|
||||
{
|
||||
std::ifstream is(fileName);
|
||||
|
@ -48,10 +48,6 @@ public:
|
||||
//! \brief Parses a data section from an XML document.
|
||||
virtual bool parse(const TiXmlElement* elem);
|
||||
|
||||
//! \brief Loads model data from an XML-formatted text string.
|
||||
//! \details This method is a convenience offered for unit testing only.
|
||||
bool loadXML(const char* xml);
|
||||
|
||||
//! \brief Returns the parallel process administrator.
|
||||
const ProcessAdm& getProcessAdm() const { return adm; }
|
||||
|
||||
|
@ -113,6 +113,15 @@ bool XMLInputBase::readXML (const char* fileName, bool verbose)
|
||||
}
|
||||
|
||||
|
||||
bool XMLInputBase::loadXML (const char* xml)
|
||||
{
|
||||
TiXmlDocument doc;
|
||||
doc.Parse(xml,nullptr,TIXML_ENCODING_UTF8);
|
||||
const TiXmlElement* tag = doc.RootElement();
|
||||
return tag ? this->parse(tag) : false;
|
||||
}
|
||||
|
||||
|
||||
bool XMLInputBase::handlePriorityTags (const TiXmlElement* base,
|
||||
std::vector<const TiXmlElement*>& parsed,
|
||||
bool verbose)
|
||||
|
@ -33,6 +33,10 @@ public:
|
||||
//! \param[in] verbose If \e true, print the tags being parsed
|
||||
bool readXML(const char* fileName, bool verbose = true);
|
||||
|
||||
//! \brief Loads data from the XML-formatted text string.
|
||||
//! \details This method is a convenience offered for unit testing only.
|
||||
bool loadXML(const char* xml);
|
||||
|
||||
protected:
|
||||
//! \brief Parses a data section from an XML element.
|
||||
virtual bool parse(const TiXmlElement* elem) = 0;
|
||||
@ -47,10 +51,10 @@ private:
|
||||
//! \param[in] verbose If \e true, print the tags being parsed
|
||||
//!
|
||||
//! \details Certain tags need to be parsed before others. This method takes
|
||||
//! care of this. It is called by the \a readXML method in order to read the
|
||||
//! care of this. It is called by the readXML() method in order to read the
|
||||
//! top level tags in the required order. It can also be called by the
|
||||
//! application-specific SIM class prior to parsing its data blocks.
|
||||
//! In that case the \a getPrioritizedTags method should be reimplemented
|
||||
//! application-specific %SIM class prior to parsing its data blocks.
|
||||
//! In that case the getPrioritizedTags() method should be reimplemented
|
||||
//! by the sub-class to take care of the application-specific tags.
|
||||
bool handlePriorityTags(const TiXmlElement* base,
|
||||
std::vector<const TiXmlElement*>& parsed,
|
||||
|
Loading…
Reference in New Issue
Block a user