XmlFile.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef XML_FILE_H
  2. #define XML_FILE_H
  3. #include <OgreColourValue.h>
  4. #include <OgreMatrix4.h>
  5. #include <OgreString.h>
  6. #include <OgreVector2.h>
  7. #include <OgreVector3.h>
  8. #include <OgreVector4.h>
  9. #include <OgreUTFString.h>
  10. #include <tinyxml/tinyxml.h>
  11. class XmlFile
  12. {
  13. public:
  14. XmlFile( const Ogre::String& file );
  15. virtual ~XmlFile();
  16. bool GetBool( TiXmlNode* node, const Ogre::String& tag, bool def = false ) const;
  17. int GetInt( TiXmlNode* node, const Ogre::String& tag, int def = 0 ) const;
  18. float GetFloat( TiXmlNode* node, const Ogre::String& tag, float def = 0.0f ) const;
  19. const Ogre::String GetString( TiXmlNode* node, const Ogre::String& tag, const Ogre::String& def = "" ) const;
  20. const Ogre::UTFString GetUTFString( TiXmlNode* node, const Ogre::String& tag, const Ogre::UTFString& def = "" ) const;
  21. const Ogre::Vector2 GetVector2( TiXmlNode* node, const Ogre::String& tag, const Ogre::Vector2& def = Ogre::Vector2::ZERO ) const;
  22. const Ogre::Vector3 GetVector3( TiXmlNode* node, const Ogre::String& tag, const Ogre::Vector3& def = Ogre::Vector3::ZERO ) const;
  23. const Ogre::Vector4 GetVector4( TiXmlNode* node, const Ogre::String& tag, const Ogre::Vector4& def = Ogre::Vector4::ZERO ) const;
  24. const Ogre::Matrix4 GetMatrix4( TiXmlNode* node, const Ogre::String& tag, const Ogre::Matrix4& def = Ogre::Matrix4::IDENTITY ) const;
  25. const Ogre::Quaternion GetQuaternion( TiXmlNode* node, const Ogre::String& tag, const Ogre::Quaternion& def = Ogre::Quaternion::IDENTITY ) const;
  26. const Ogre::ColourValue GetColourValue( TiXmlNode* node, const Ogre::String& tag, const Ogre::ColourValue& def = Ogre::ColourValue::ZERO ) const;
  27. protected:
  28. bool m_NormalFile;
  29. TiXmlDocument m_File;
  30. };
  31. #endif // XML_FILE_H