PixelLightAPI  .
Public Member Functions
PLCore::Config Class Reference

Configuration class. More...

#include <Config.h>

Inheritance diagram for PLCore::Config:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLCORE_API Config ()
 Constructor.
virtual PLCORE_API ~Config ()
 Destructor.
PLCORE_API String GetVar (const String &sClass, const String &sVariable)
 Returns the value of a configuration class variable.
PLCORE_API int GetVarInt (const String &sClass, const String &sVariable)
 Returns the value of a configuration class variable.
PLCORE_API bool SetVar (const String &sClass, const String &sVariable, const String &sValue="")
 Set the value of a configuration class variable.
PLCORE_API bool SetDefault (const String &sClass="", const String &sVariable="")
 Set default configuration settings.
uint32 GetNumOfClasses () const
 Returns the number of configuration class instances.
ConfigGroupGetClassByIndex (uint32 nIndex) const
 Returns a configuration class instance by index.
PLCORE_API ConfigGroupGetClass (const String &sName)
 Returns a configuration class instance.
virtual PLCORE_API String GetLoadableTypeName () const override
 Returns the loadable type name.

Detailed Description

Configuration class.

Remarks:
Configuration class. If this configuration class is created it will register all RTTI classes which are in the group "PLCore::ConfigGroup" automatically to it's configuration system.

Usage example:

*    // Somewhere deep within your custom configuration class header...
*    class ConfigTest : public ConfigGroup {
*      pl_class(ConfigTest, "PLCore", PLCore::ConfigGroup, "Test config class")
*        pl_constructor_0(DefaultConstructor, "Default constructor", "")
*        pl_attribute(Detail, float, 1.0f, ReadWrite, DirectValue, "Detail description text", "")
*      pl_class_end
*    };
*    // Somewhere in your custom configuration class source code
*    pl_implement_class(ConfigTest)
*    // Set ConfigTest variable value
*    cConfig.SetVar("ConfigTest", "Detail", "2.0");
*    // Get ConfigTest variable value
*    float fDetail = cConfig.GetVar("ConfigTest", "Detail").GetFloat();
*  

Constructor & Destructor Documentation

PLCORE_API PLCore::Config::Config ( )
virtual PLCORE_API PLCore::Config::~Config ( ) [virtual]

Destructor.


Member Function Documentation

PLCORE_API String PLCore::Config::GetVar ( const String sClass,
const String sVariable 
)

Returns the value of a configuration class variable.

Parameters:
[in]sClassConfiguration class name (no empty string)
[in]sVariableName of the variable (no empty string)
Returns:
Configuration variable value, empty string on error so this pointer is never a null pointer!
PLCORE_API int PLCore::Config::GetVarInt ( const String sClass,
const String sVariable 
)

Returns the value of a configuration class variable.

Parameters:
[in]sClassConfiguration class name (no empty string)
[in]sVariableName of the variable (no empty string)
Returns:
Configuration variable value
Note:
  • If the variable type is PL_VAR_FLAGS, the flags will be read out
  • If the variable type is PL_VAR_ENUM, the enum value will be read out
PLCORE_API bool PLCore::Config::SetVar ( const String sClass,
const String sVariable,
const String sValue = "" 
)

Set the value of a configuration class variable.

Parameters:
[in]sClassConfiguration class name (no empty string)
[in]sVariableName of the variable (no empty string)
[in]sValueVariable value
Returns:
'true' if all went fine, else 'false'
PLCORE_API bool PLCore::Config::SetDefault ( const String sClass = "",
const String sVariable = "" 
)

Set default configuration settings.

Parameters:
[in]sClassConfiguration class name, if empty string, set ALL settings to default values
[in]sVariableName of the variable, if empty string, set all variables of the given configuration class to default values
Returns:
'true' if all went fine, else 'false'
uint32 PLCore::Config::GetNumOfClasses ( ) const [inline]

Returns the number of configuration class instances.

Returns:
The number of configuration class instances
ConfigGroup * PLCore::Config::GetClassByIndex ( uint32  nIndex) const [inline]

Returns a configuration class instance by index.

Parameters:
[in]nIndexIndex of the configuration class instance to return
Returns:
The requested configuration class instance, a null pointer on error
PLCORE_API ConfigGroup* PLCore::Config::GetClass ( const String sName)

Returns a configuration class instance.

Parameters:
[in]sNameConfiguration class name
Returns:
The requested configuration class instance, a null pointer if the class wasn't found
Remarks:
You can use
List<Class*> lstClasses;
System::GetInstance()->GetClassList(&lstClasses, "PLConfig");
to get a list of all configuration plugins.
virtual PLCORE_API String PLCore::Config::GetLoadableTypeName ( ) const [override, virtual]

Returns the loadable type name.

Returns:
The loadable type name

Reimplemented from PLCore::Loadable.


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:24
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported