V-Gears 0
Free Final Fantasy VII engine.
XmlFile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreColourValue.h>
19#include <OgreMatrix4.h>
20#include <OgreString.h>
21#include <Ogre.h>
22#include <Overlay/OgreUTFString.h>
23#include <tinyxml.h>
24
28class XmlFile{
29
30
31 public:
32
38 XmlFile(const Ogre::String& file);
39
43 virtual ~XmlFile();
44
54 bool GetBool(TiXmlNode* node, const Ogre::String& tag, bool def = false) const;
55
65 int GetInt(TiXmlNode* node, const Ogre::String& tag, int def = 0) const;
66
76 float GetFloat(TiXmlNode* node, const Ogre::String& tag, float def = 0.0f) const;
77
87 TiXmlNode* node, const Ogre::String& tag, const Ogre::String& def = ""
88 ) const;
89
98 const Ogre::UTFString GetUTFString(
99 TiXmlNode* node, const Ogre::String& tag, const Ogre::UTFString& def = ""
100 ) const;
101
110 const Ogre::Vector2 GetVector2(
111 TiXmlNode* node, const Ogre::String& tag, const Ogre::Vector2& def = Ogre::Vector2::ZERO
112 ) const;
113
122 const Ogre::Vector3 GetVector3(
123 TiXmlNode* node, const Ogre::String& tag, const Ogre::Vector3& def = Ogre::Vector3::ZERO
124 ) const;
125
134 const Ogre::Vector4 GetVector4(
135 TiXmlNode* node, const Ogre::String& tag, const Ogre::Vector4& def = Ogre::Vector4::ZERO
136 ) const;
137
146 const Ogre::Matrix4 GetMatrix4(
147 TiXmlNode* node, const Ogre::String& tag,
148 const Ogre::Matrix4& def = Ogre::Matrix4::IDENTITY
149 ) const;
150
159 const Ogre::Quaternion GetQuaternion(
160 TiXmlNode* node, const Ogre::String& tag,
161 const Ogre::Quaternion& def = Ogre::Quaternion::IDENTITY
162 ) const;
163
172 const Ogre::ColourValue GetColourValue(
173 TiXmlNode* node, const Ogre::String& tag,
174 const Ogre::ColourValue& def = Ogre::ColourValue::ZERO
175 ) const;
176
177 protected:
178
185
189 TiXmlDocument file_;
190};
Handles XML files.
Definition: XmlFile.h:28
const Ogre::Quaternion GetQuaternion(TiXmlNode *node, const Ogre::String &tag, const Ogre::Quaternion &def=Ogre::Quaternion::IDENTITY) const
Retrieves a quaternion from an XMl tag.
Definition: XmlFile.cpp:122
const Ogre::String GetString(TiXmlNode *node, const Ogre::String &tag, const Ogre::String &def="") const
Retrieves a string from an XMl tag.
Definition: XmlFile.cpp:56
float GetFloat(TiXmlNode *node, const Ogre::String &tag, float def=0.0f) const
Retrieves a defcimal from an XMl tag.
Definition: XmlFile.cpp:47
int GetInt(TiXmlNode *node, const Ogre::String &tag, int def=0) const
Retrieves an integer from an XMl tag.
Definition: XmlFile.cpp:38
const Ogre::Vector3 GetVector3(TiXmlNode *node, const Ogre::String &tag, const Ogre::Vector3 &def=Ogre::Vector3::ZERO) const
Retrieves a 3-dimensional vector from an XMl tag.
Definition: XmlFile.cpp:89
const Ogre::UTFString GetUTFString(TiXmlNode *node, const Ogre::String &tag, const Ogre::UTFString &def="") const
Retrieves a string from an XMl tag.
Definition: XmlFile.cpp:67
const Ogre::Vector4 GetVector4(TiXmlNode *node, const Ogre::String &tag, const Ogre::Vector4 &def=Ogre::Vector4::ZERO) const
Retrieves a 4-dimensional vector from an XMl tag.
Definition: XmlFile.cpp:100
const Ogre::Vector2 GetVector2(TiXmlNode *node, const Ogre::String &tag, const Ogre::Vector2 &def=Ogre::Vector2::ZERO) const
Retrieves a 2-dimensional vector from an XMl tag.
Definition: XmlFile.cpp:78
bool GetBool(TiXmlNode *node, const Ogre::String &tag, bool def=false) const
Retrieves a boolean from an XMl tag.
Definition: XmlFile.cpp:29
XmlFile(const Ogre::String &file)
Constructor.
Definition: XmlFile.cpp:20
virtual ~XmlFile()
Destructor.
Definition: XmlFile.cpp:27
TiXmlDocument file_
The XML file.
Definition: XmlFile.h:189
const Ogre::Matrix4 GetMatrix4(TiXmlNode *node, const Ogre::String &tag, const Ogre::Matrix4 &def=Ogre::Matrix4::IDENTITY) const
Retrieves a 4-dimensional matrix from an XMl tag.
Definition: XmlFile.cpp:111
const Ogre::ColourValue GetColourValue(TiXmlNode *node, const Ogre::String &tag, const Ogre::ColourValue &def=Ogre::ColourValue::ZERO) const
Retrieves a colour from an XMl tag.
Definition: XmlFile.cpp:134
bool normal_file_
Indicates if the file is a normal file.
Definition: XmlFile.h:184
Ogre::String String
Definition: TypeDefine.h:37