RigsofRods
Soft-body Physics Simulation
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Hydrax::CfgFileManager Class Reference

Class to load/save all Hydrax options from/to a config file. More...

#include <CfgFileManager.h>

+ Collaboration diagram for Hydrax::CfgFileManager:

Public Member Functions

 CfgFileManager (Hydrax *h)
 
 ~CfgFileManager ()
 
const bool load (const Ogre::String &File) const
 Load hydrax cfg file. More...
 
const bool save (const Ogre::String &File, const Ogre::String &Path="") const
 Save current hydrax config to a file. More...
 

Static Public Member Functions

static Ogre::String _getCfgString (const Ogre::String &Name, const int &Value)
 
static Ogre::String _getCfgString (const Ogre::String &Name, const Ogre::Real &Value)
 
static Ogre::String _getCfgString (const Ogre::String &Name, const bool &Value)
 
static Ogre::String _getCfgString (const Ogre::String &Name, const Ogre::Vector2 &Value)
 
static Ogre::String _getCfgString (const Ogre::String &Name, const Ogre::Vector3 &Value)
 
static Ogre::String _getCfgString (const Ogre::String &Name, const Size &Value)
 
static int _getIntValue (Ogre::ConfigFile &CfgFile, const Ogre::String Name)
 Get int value. More...
 
static Ogre::Real _getFloatValue (Ogre::ConfigFile &CfgFile, const Ogre::String Name)
 Get float value. More...
 
static bool _getBoolValue (Ogre::ConfigFile &CfgFile, const Ogre::String Name)
 Get bool value. More...
 
static Ogre::Vector2 _getVector2Value (Ogre::ConfigFile &CfgFile, const Ogre::String Name)
 Get vector2 value. More...
 
static Ogre::Vector3 _getVector3Value (Ogre::ConfigFile &CfgFile, const Ogre::String Name)
 Get vector3 value. More...
 
static Size _getSizeValue (Ogre::ConfigFile &CfgFile, const Ogre::String Name)
 Get size value. More...
 
static bool _isStringInList (const Ogre::StringVector &List, const Ogre::String &Find)
 Check is a std::vector<Ogre::String> contains a specified Ogre::String. More...
 

Private Member Functions

const bool _saveToFile (const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
 Save a string in file. More...
 
const void _loadCfgFile (const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
 Load a cfg file in an Ogre::ConfigFile. More...
 
const Ogre::String _getComponentsCfgString () const
 Get components config string. More...
 
const void _loadComponentsSettings (Ogre::ConfigFile &CfgFile) const
 Load components settings. More...
 
const Ogre::String _getRttCfgString () const
 Get rtt quality config string. More...
 
const void _loadRttSettings (Ogre::ConfigFile &CfgFile) const
 Load rtt settings. More...
 
const Ogre::String _getVersionCfgString () const
 Get hydrax version cfg string. More...
 
const bool _checkVersion (Ogre::ConfigFile &CfgFile) const
 Check hydrax version cfg file. More...
 

Private Attributes

HydraxmHydrax
 Hydrax parent pointer. More...
 

Detailed Description

Class to load/save all Hydrax options from/to a config file.

Definition at line 44 of file CfgFileManager.h.

Constructor & Destructor Documentation

◆ CfgFileManager()

Hydrax::CfgFileManager::CfgFileManager ( Hydrax h)

Definition at line 30 of file CfgFileManager.cpp.

◆ ~CfgFileManager()

Hydrax::CfgFileManager::~CfgFileManager ( )

Definition at line 35 of file CfgFileManager.cpp.

Member Function Documentation

◆ _checkVersion()

const bool Hydrax::CfgFileManager::_checkVersion ( Ogre::ConfigFile &  CfgFile) const
private

Check hydrax version cfg file.

Returns
true if it's the same version, false if not.

Definition at line 412 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getBoolValue()

bool Hydrax::CfgFileManager::_getBoolValue ( Ogre::ConfigFile &  CfgFile,
const Ogre::String  Name 
)
static

Get bool value.

Remarks
if the parameter isn't found or the data type is not a bool value, return false as default

Definition at line 460 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getCfgString() [1/6]

Ogre::String Hydrax::CfgFileManager::_getCfgString ( const Ogre::String &  Name,
const bool &  Value 
)
static

Definition at line 165 of file CfgFileManager.cpp.

◆ _getCfgString() [2/6]

Ogre::String Hydrax::CfgFileManager::_getCfgString ( const Ogre::String &  Name,
const int &  Value 
)
static

Definition at line 155 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getCfgString() [3/6]

Ogre::String Hydrax::CfgFileManager::_getCfgString ( const Ogre::String &  Name,
const Ogre::Real &  Value 
)
static

Definition at line 160 of file CfgFileManager.cpp.

◆ _getCfgString() [4/6]

Ogre::String Hydrax::CfgFileManager::_getCfgString ( const Ogre::String &  Name,
const Ogre::Vector2 &  Value 
)
static

Definition at line 170 of file CfgFileManager.cpp.

◆ _getCfgString() [5/6]

Ogre::String Hydrax::CfgFileManager::_getCfgString ( const Ogre::String &  Name,
const Ogre::Vector3 &  Value 
)
static

Definition at line 175 of file CfgFileManager.cpp.

◆ _getCfgString() [6/6]

Ogre::String Hydrax::CfgFileManager::_getCfgString ( const Ogre::String &  Name,
const Size Value 
)
static

Definition at line 180 of file CfgFileManager.cpp.

◆ _getComponentsCfgString()

const Ogre::String Hydrax::CfgFileManager::_getComponentsCfgString ( ) const
private

Get components config string.

Returns
Components cfg string

Definition at line 185 of file CfgFileManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFloatValue()

Ogre::Real Hydrax::CfgFileManager::_getFloatValue ( Ogre::ConfigFile &  CfgFile,
const Ogre::String  Name 
)
static

Get float value.

Remarks
if the parameter isn't found or the data type is not a float value, return 0 as default

Definition at line 446 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getIntValue()

int Hydrax::CfgFileManager::_getIntValue ( Ogre::ConfigFile &  CfgFile,
const Ogre::String  Name 
)
static

Get int value.

Remarks
if the parameter isn't found or the data type is not an int value, return 0 as default

Definition at line 432 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getRttCfgString()

const Ogre::String Hydrax::CfgFileManager::_getRttCfgString ( ) const
private

Get rtt quality config string.

Returns
Rtt quality cfg string

Definition at line 382 of file CfgFileManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSizeValue()

Size Hydrax::CfgFileManager::_getSizeValue ( Ogre::ConfigFile &  CfgFile,
const Ogre::String  Name 
)
static

Get size value.

Remarks
if the parameter isn't found or the data type is not an int value, returns (0,0) as default

Definition at line 505 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getVector2Value()

Ogre::Vector2 Hydrax::CfgFileManager::_getVector2Value ( Ogre::ConfigFile &  CfgFile,
const Ogre::String  Name 
)
static

Get vector2 value.

Remarks
if the parameter isn't found or the data type is not an int value, returns (0,0) as default

Definition at line 474 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getVector3Value()

Ogre::Vector3 Hydrax::CfgFileManager::_getVector3Value ( Ogre::ConfigFile &  CfgFile,
const Ogre::String  Name 
)
static

Get vector3 value.

Remarks
if the parameter isn't found or the data type is not an int value, returns (0,0,0) as default

Definition at line 489 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _getVersionCfgString()

const Ogre::String Hydrax::CfgFileManager::_getVersionCfgString ( ) const
private

Get hydrax version cfg string.

Returns
Hydrax version cfg string

Definition at line 401 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _isStringInList()

bool Hydrax::CfgFileManager::_isStringInList ( const Ogre::StringVector &  List,
const Ogre::String &  Find 
)
static

Check is a std::vector<Ogre::String> contains a specified Ogre::String.

Returns
true if it's contained, false if not

Definition at line 279 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _loadCfgFile()

const void Hydrax::CfgFileManager::_loadCfgFile ( const Ogre::String &  File,
std::pair< bool, Ogre::ConfigFile > &  Result 
) const
private

Load a cfg file in an Ogre::ConfigFile.

Parameters
Result,FirstFalse if the file isn't in the Hydrax resource group, Second: Ogre::ConfigFile

Definition at line 139 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ _loadComponentsSettings()

const void Hydrax::CfgFileManager::_loadComponentsSettings ( Ogre::ConfigFile &  CfgFile) const
private

Load components settings.

Parameters
CfgFileConfig file

Definition at line 292 of file CfgFileManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _loadRttSettings()

const void Hydrax::CfgFileManager::_loadRttSettings ( Ogre::ConfigFile &  CfgFile) const
private

Load rtt settings.

Parameters
CfgFileConfig file

Definition at line 392 of file CfgFileManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveToFile()

const bool Hydrax::CfgFileManager::_saveToFile ( const Ogre::String &  Data,
const Ogre::String &  File,
const Ogre::String &  Path 
) const
private

Save a string in file.

Returns
false if an error has ocurred

Definition at line 122 of file CfgFileManager.cpp.

+ Here is the caller graph for this function:

◆ load()

const bool Hydrax::CfgFileManager::load ( const Ogre::String &  File) const

Load hydrax cfg file.

Returns
false if an error has been ocurred(Check the log file in this case).

Definition at line 39 of file CfgFileManager.cpp.

+ Here is the call graph for this function:

◆ save()

const bool Hydrax::CfgFileManager::save ( const Ogre::String &  File,
const Ogre::String &  Path = "" 
) const

Save current hydrax config to a file.

Returns
false if an error has been ocurred(Check the log file in this case).

Definition at line 85 of file CfgFileManager.cpp.

+ Here is the call graph for this function:

Field Documentation

◆ mHydrax

Hydrax* Hydrax::CfgFileManager::mHydrax
private

Hydrax parent pointer.

Definition at line 144 of file CfgFileManager.h.


The documentation for this class was generated from the following files: