GameKit  0.0.1a
C++ gamedev tools
XMLFile.hpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: XMLFile.hpp
5  *
6  * Description:
7  *
8  * Created: 17/01/2018 19:21:52
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
14 #ifndef GK_XMLFILE_HPP_
15 #define GK_XMLFILE_HPP_
16 
17 #include <string>
18 
19 #include <tinyxml2.h>
20 
21 namespace gk {
22 
23 class XMLFile {
24  public:
25  XMLFile() = default;
26  XMLFile(const std::string &filename);
27 
28  void load(const std::string &filename);
29 
30  tinyxml2::XMLHandle FirstChildElement(const char *element) { return m_doc.FirstChildElement(element); }
31 
32  private:
33  tinyxml2::XMLDocument m_xml;
34  tinyxml2::XMLHandle m_doc{m_xml};
35 };
36 
37 } // namespace gk
38 
39 #endif // GK_XMLFILE_HPP_
tinyxml2::XMLHandle FirstChildElement(const char *element)
Definition: XMLFile.hpp:30
tinyxml2::XMLHandle m_doc
Definition: XMLFile.hpp:34
XMLFile()=default
tinyxml2::XMLDocument m_xml
Definition: XMLFile.hpp:33
void load(const std::string &filename)
Definition: XMLFile.cpp:23