RigsofRods
Soft-body Physics Simulation
CfgFileManager.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 _Hydrax_CfgFileManager_H_
26 #define _Hydrax_CfgFileManager_H_
27 
28 #include "Prerequisites.h"
29 
30 #include "Help.h"
31 
34 
37 
38 namespace Hydrax
39 {
40  class Hydrax;
41 
45  {
46  public:
49 
53  const bool load(const Ogre::String& File) const;
54 
58  const bool save(const Ogre::String& File, const Ogre::String& Path = "") const;
59 
60  static Ogre::String _getCfgString(const Ogre::String& Name, const int& Value);
61  static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Real& Value);
62  static Ogre::String _getCfgString(const Ogre::String& Name, const bool& Value);
63  static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Vector2& Value);
64  static Ogre::String _getCfgString(const Ogre::String& Name, const Ogre::Vector3& Value);
65  static Ogre::String _getCfgString(const Ogre::String& Name, const Size& Value);
66 
70  static int _getIntValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
71 
75  static Ogre::Real _getFloatValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
76 
80  static bool _getBoolValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
81 
85  static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
86 
90  static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
91 
95  static Size _getSizeValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name);
96 
100  static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find);
101 
102  private:
106  const bool _saveToFile(const Ogre::String& Data, const Ogre::String& File, const Ogre::String& Path) const;
107 
111  const void _loadCfgFile(const Ogre::String& File, std::pair<bool,Ogre::ConfigFile> &Result) const;
112 
116  const Ogre::String _getComponentsCfgString() const;
117 
121  const void _loadComponentsSettings(Ogre::ConfigFile& CfgFile) const;
122 
126  const Ogre::String _getRttCfgString() const;
127 
131  const void _loadRttSettings(Ogre::ConfigFile& CfgFile) const;
132 
136  const Ogre::String _getVersionCfgString() const;
137 
141  const bool _checkVersion(Ogre::ConfigFile& CfgFile) const;
142 
145  };
146 };
147 
150 
151 #endif
Hydrax::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: CfgFileManager.cpp:139
Hydrax::CfgFileManager::_getRttCfgString
const Ogre::String _getRttCfgString() const
Get rtt quality config string.
Definition: CfgFileManager.cpp:382
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::CfgFileManager::_checkVersion
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
Definition: CfgFileManager.cpp:412
Hydrax::Size
Struct wich contains an especific width and height value.
Definition: Help.h:40
Hydrax::CfgFileManager::load
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
Definition: CfgFileManager.cpp:39
Hydrax::CfgFileManager::_loadRttSettings
const void _loadRttSettings(Ogre::ConfigFile &CfgFile) const
Load rtt settings.
Definition: CfgFileManager.cpp:392
Hydrax::CfgFileManager::save
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
Definition: CfgFileManager.cpp:85
Hydrax::CfgFileManager::_getSizeValue
static Size _getSizeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get size value.
Definition: CfgFileManager.cpp:505
Hydrax::CfgFileManager::_getBoolValue
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
Definition: CfgFileManager.cpp:460
Hydrax::CfgFileManager::_getVector3Value
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
Definition: CfgFileManager.cpp:489
Help.h
Hydrax::CfgFileManager::_getComponentsCfgString
const Ogre::String _getComponentsCfgString() const
Get components config string.
Definition: CfgFileManager.cpp:185
Hydrax::CfgFileManager::mHydrax
Hydrax * mHydrax
Hydrax parent pointer.
Definition: CfgFileManager.h:144
Hydrax::CfgFileManager::CfgFileManager
CfgFileManager(Hydrax *h)
Definition: CfgFileManager.cpp:30
Hydrax::CfgFileManager::_loadComponentsSettings
const void _loadComponentsSettings(Ogre::ConfigFile &CfgFile) const
Load components settings.
Definition: CfgFileManager.cpp:292
Hydrax::CfgFileManager::_getCfgString
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
Definition: CfgFileManager.cpp:155
Hydrax::CfgFileManager::_saveToFile
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
Definition: CfgFileManager.cpp:122
Hydrax::CfgFileManager
Class to load/save all Hydrax options from/to a config file.
Definition: CfgFileManager.h:44
Prerequisites.h
Hydrax::CfgFileManager::_getVersionCfgString
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
Definition: CfgFileManager.cpp:401
Hydrax::CfgFileManager::~CfgFileManager
~CfgFileManager()
Definition: CfgFileManager.cpp:35
Hydrax::CfgFileManager::_getIntValue
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
Definition: CfgFileManager.cpp:432
Hydrax::CfgFileManager::_getVector2Value
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.
Definition: CfgFileManager.cpp:474
Hydrax::CfgFileManager::_getFloatValue
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
Definition: CfgFileManager.cpp:446
Hydrax::CfgFileManager::_isStringInList
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
Check is a std::vector<Ogre::String> contains a specified Ogre::String.
Definition: CfgFileManager.cpp:279