GlobeEngine
XMLGetter.h
Go to the documentation of this file.
1 #ifndef ExoViewer_XMLGetter_h
2 #define ExoViewer_XMLGetter_h
3 
4 #include "tinyxml2.h"
5 #include <iostream>
6 #include "OpenGL_Includes.h"
7 
8 namespace geAstro{
9 
10 class XMLGetter
11 {
12 public:
13 
14  XMLGetter();
15  ~XMLGetter();
16  void clear();
17 
18  bool setRoot(tinyxml2::XMLElement* _root);
19  tinyxml2::XMLElement* getRoot();
20  tinyxml2::XMLElement* getElementFromDocPath(const char* _path, tinyxml2::XMLDocument* doc, const char* _name);
21 
22  tinyxml2::XMLElement* getFirstChildElement(tinyxml2::XMLElement* _element, const char* _name);
23  const char* getFirstChildElementConstChar(tinyxml2::XMLElement* _element, const char* _name);
24  std::string getFirstChildElementString(tinyxml2::XMLElement* _element, const char* _name);
25  double getFirstChildElementDouble(tinyxml2::XMLElement* _element, const char* _name);
26 
27  bool getFirstChildElementFirstAttributeBool(tinyxml2::XMLElement* _element, const char* _name);
28 
29  const char* GetRootAttributeConstChar(const char* _name);
30 
31  tinyxml2::XMLElement* getNextSiblingElement(tinyxml2::XMLElement* _element, const char* _name);
32 
33  const char* getAttributeConstChar(tinyxml2::XMLElement* _element, const char* _name);
34  std::string getAttributeString(tinyxml2::XMLElement* _element, const char* _name);
35  double getAttributeDouble(tinyxml2::XMLElement* _element, const char* _name);
36  bool getAttributeBool(tinyxml2::XMLElement* _element, const char* _name);
37 
38 private:
39  tinyxml2::XMLElement* root;
40 
41  bool rootIsNULL();
42 
43  const char* getFirstChildElementIfExistsAndNotEmpty(tinyxml2::XMLElement* _element, const char* _name);
44  const char* getAttributeIfExistsAndNotEmpty(tinyxml2::XMLElement* _element, const char* _name);
45 };
46 
47 }
48 
49 #endif
std::string getAttributeString(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:102
bool getAttributeBool(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:120
void clear()
Definition: XMLGetter.cpp:16
double getAttributeDouble(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:112
XMLGetter()
Definition: XMLGetter.cpp:7
tinyxml2::XMLElement * getFirstChildElement(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:41
bool getFirstChildElementFirstAttributeBool(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:80
tinyxml2::XMLElement * getNextSiblingElement(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:149
Definition: AstroCommon.h:18
const char * getAttributeConstChar(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:98
tinyxml2::XMLElement * getRoot()
Definition: XMLGetter.cpp:25
const char * getFirstChildElementConstChar(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:48
std::string getFirstChildElementString(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:52
bool setRoot(tinyxml2::XMLElement *_root)
Definition: XMLGetter.cpp:20
double getFirstChildElementDouble(tinyxml2::XMLElement *_element, const char *_name)
Definition: XMLGetter.cpp:61
tinyxml2::XMLElement * getElementFromDocPath(const char *_path, tinyxml2::XMLDocument *doc, const char *_name)
Definition: XMLGetter.cpp:30
~XMLGetter()
Definition: XMLGetter.cpp:12
Definition: XMLGetter.h:10
const char * GetRootAttributeConstChar(const char *_name)
Definition: XMLGetter.cpp:137