RigsofRods
Soft-body Physics Simulation
SCfgFileManager.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of Hydrax.
4 Visit ---
5 
6 Copyright (C) 2008 Xavier Verguín González <xavierverguin@hotmail.com>
7  <xavyiy@gmail.com>
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 version.
13 
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License along with
19 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21 http://www.gnu.org/copyleft/lesser.txt.
22 --------------------------------------------------------------------------------
23 */
24 
25 #ifndef _SkyX_CfgFileManager_H_
26 #define _SkyX_CfgFileManager_H_
27 
28 #include "Prerequisites.h"
29 
30 #include "Help.h"
31 
32 namespace SkyX
33 {
34  class SkyX;
35  class BasicController;
36 
41  {
42  public:
46  CfgFileManager(SkyX *s, BasicController *c, Ogre::Camera* d);
47 
51 
56  const bool load(const Ogre::String& File) const;
57 
63  const bool save(const Ogre::String& File, const Ogre::String& Path = "") const;
64 
65  static Ogre::String _getCfgString(const Ogre::String& Name, const int& Value);
66  static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Real& Value);
67  static Ogre::String _getCfgString(const Ogre::String& Name, const bool& Value);
68  static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Vector2& Value);
69  static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Vector3& Value);
70  static Ogre::String _getCfgString(const Ogre::String &Name, const Ogre::Vector4 &Value);
71  static Ogre::String _getCfgString(const Ogre::String &Name, const Ogre::Degree &Value);
72 
76  static int _getIntValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
77 
81  static Ogre::Real _getFloatValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
82 
86  static bool _getBoolValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
87 
91  static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
92 
96  static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
97 
98  static Ogre::Vector4 _getVector4Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
99 
100  static Ogre::Degree _getDegreeValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
101 
102  static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find);
103 
104  private:
108  const bool _saveToFile(const Ogre::String& Data, const Ogre::String& File, const Ogre::String& Path) const;
109 
114  const void _loadCfgFile(const Ogre::String& File, std::pair<bool,Ogre::ConfigFile> &Result) const;
115 
119  const Ogre::String _getVersionCfgString() const;
120 
125  const bool _checkVersion(Ogre::ConfigFile& CfgFile) const;
126 
130  Ogre::Camera *mCamera;
131  };
132 };
133 
134 #endif
SkyX::CfgFileManager::mController
BasicController * mController
Definition: SCfgFileManager.h:129
SkyX::BasicController
Basic controller class
Definition: BasicController.h:35
SkyX::CfgFileManager::_isStringInList
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
Definition: SCfgFileManager.cpp:206
Prerequisites.h
SkyX::CfgFileManager::_getBoolValue
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
Definition: SCfgFileManager.cpp:278
SkyX::CfgFileManager::_saveToFile
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
Definition: SCfgFileManager.cpp:138
SkyX::CfgFileManager::_getVector4Value
static Ogre::Vector4 _getVector4Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Definition: SCfgFileManager.cpp:323
SkyX
Definition: AtmosphereManager.cpp:30
SkyX::CfgFileManager::_getVector2Value
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.
Definition: SCfgFileManager.cpp:292
Help.h
SkyX::CfgFileManager::_getFloatValue
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
Definition: SCfgFileManager.cpp:264
SkyX::CfgFileManager::load
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
Definition: SCfgFileManager.cpp:39
SkyX::CfgFileManager::_getVector3Value
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
Definition: SCfgFileManager.cpp:307
SkyX::CfgFileManager::mCamera
Ogre::Camera * mCamera
Definition: SCfgFileManager.h:130
SkyX::CfgFileManager::_loadCfgFile
const void _loadCfgFile(const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
Load a cfg file in an Ogre::ConfigFile.
Definition: SCfgFileManager.cpp:155
SkyX::CfgFileManager::CfgFileManager
CfgFileManager(SkyX *s, BasicController *c, Ogre::Camera *d)
Constructor.
Definition: SCfgFileManager.cpp:30
SkyX::CfgFileManager::_getVersionCfgString
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
Definition: SCfgFileManager.cpp:219
SkyX::CfgFileManager::_getCfgString
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
Definition: SCfgFileManager.cpp:171
SkyX::CfgFileManager::_checkVersion
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
Definition: SCfgFileManager.cpp:230
SkyX::CfgFileManager::_getDegreeValue
static Ogre::Degree _getDegreeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Definition: SCfgFileManager.cpp:342
SkyX::CfgFileManager::mSkyX
SkyX * mSkyX
Hydrax parent pointer.
Definition: SCfgFileManager.h:128
SkyX::CfgFileManager::~CfgFileManager
~CfgFileManager()
Destructor.
Definition: SCfgFileManager.cpp:35
SkyX::CfgFileManager::_getIntValue
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
Definition: SCfgFileManager.cpp:250
SkyX::CfgFileManager::save
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
Definition: SCfgFileManager.cpp:127
SkyX::CfgFileManager
Config file manager.
Definition: SCfgFileManager.h:40