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
CfgFileManager.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 _Hydrax_CfgFileManager_H_
26#define _Hydrax_CfgFileManager_H_
27
28#include "Prerequisites.h"
29
30#include "Help.h"
31
34
37
38namespace 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
Class to load/save all Hydrax options from/to a config file.
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
static Size _getSizeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get size value.
const void _loadRttSettings(Ogre::ConfigFile &CfgFile) const
Load rtt settings.
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
Check is a std::vector<Ogre::String> contains a specified Ogre::String.
const Ogre::String _getRttCfgString() const
Get rtt quality config string.
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
const Ogre::String _getComponentsCfgString() const
Get components config string.
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
const void _loadComponentsSettings(Ogre::ConfigFile &CfgFile) const
Load components settings.
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.
const void _loadCfgFile(const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
Load a cfg file in an Ogre::ConfigFile.
Hydrax * mHydrax
Hydrax parent pointer.
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
Struct wich contains an especific width and height value.
Definition Help.h:41