IFEM 90A354
XMLInputBase.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _XML_INPUT_BASE_H
15#define _XML_INPUT_BASE_H
16
17#include <vector>
18
19namespace tinyxml2 {
20 class XMLDocument;
21 class XMLElement;
22}
23
24
32{
33public:
37 bool readXML(const char* fileName, bool verbose = true);
38
41 bool loadXML(const char* xml);
42
43protected:
49 const tinyxml2::XMLElement* loadFile(tinyxml2::XMLDocument& doc,
50 const char* fileName,
51 bool verbose = false);
52
54 virtual bool parse(const tinyxml2::XMLElement* elem) = 0;
55
57 virtual const char** getPrioritizedTags() const { return nullptr; }
58
59private:
71 bool handlePriorityTags(const tinyxml2::XMLElement* base,
72 std::vector<const tinyxml2::XMLElement*>& parsed,
73 bool verbose);
74};
75
76#endif
Base class for XML based input file parsing.
Definition XMLInputBase.h:32
const tinyxml2::XMLElement * loadFile(tinyxml2::XMLDocument &doc, const char *fileName, bool verbose=false)
Loads an XML input file into a tinyxml2::XMLDocument object.
Definition XMLInputBase.C:98
bool handlePriorityTags(const tinyxml2::XMLElement *base, std::vector< const tinyxml2::XMLElement * > &parsed, bool verbose)
Handles the parsing order for certain XML-tags.
Definition XMLInputBase.C:172
bool loadXML(const char *xml)
Loads data from an XML-formatted text string.
Definition XMLInputBase.C:163
virtual const char ** getPrioritizedTags() const
Returns a list of prioritized XML-tags.
Definition XMLInputBase.h:57
bool readXML(const char *fileName, bool verbose=true)
Reads an XML input file.
Definition XMLInputBase.C:135
virtual bool parse(const tinyxml2::XMLElement *elem)=0
Parses a data section from an XML element.