Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
SCfgFileManager.h
Go to the documentation of this file.
1/*
2--------------------------------------------------------------------------------
3This source file is part of Hydrax.
4Visit ---
5
6Copyright (C) 2008 Xavier Vergu�n Gonz�lez <xavierverguin@hotmail.com>
7 <xavyiy@gmail.com>
8
9This program is free software; you can redistribute it and/or modify it under
10the terms of the GNU Lesser General Public License as published by the Free Software
11Foundation; either version 2 of the License, or (at your option) any later
12version.
13
14This program is distributed in the hope that it will be useful, but WITHOUT
15ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17
18You should have received a copy of the GNU Lesser General Public License along with
19this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21http://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
32namespace 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
Basic controller class
Config file manager.
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
BasicController * mController
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
const void _loadCfgFile(const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
Load a cfg file in an Ogre::ConfigFile.
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
SkyX * mSkyX
Hydrax parent pointer.
static Ogre::Degree _getDegreeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
static Ogre::Vector4 _getVector4Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.