ezEngine  Milestone 7
ezTypedCVar< Type, CVarType > Class Template Reference

[internal] Helper class to implement ezCVarInt, ezCVarFlag, ezCVarBool and ezCVarString. More...

#include <CVar.h>

Inheritance diagram for ezTypedCVar< Type, CVarType >:

Public Member Functions

 ezTypedCVar (const char *szName, const Type &Value, ezBitflags< ezCVarFlags > Flags, const char *szDescription)
 
 operator const Type & () const
 Returns the 'current' value of the CVar. Same as 'GetValue(ezCVarValue::Current)'.
 
const Type & GetValue (ezCVarValue::Enum val=ezCVarValue::Current) const
 Returns the internal values of the CVar.
 
void operator= (const Type &value)
 Changes the CVar's value and broadcasts the proper events. More...
 
virtual ezCVarType::Enum GetType () const override
 Returns the type of the CVar.
 
virtual void SetToRestartValue () override
 Copies the 'Restart' value into the 'Current' value. More...
 
- Public Member Functions inherited from ezCVar
const char * GetName () const
 Returns the (display) name of the CVar.
 
const char * GetDescription () const
 Returns the description of the CVar.
 
ezBitflags< ezCVarFlagsGetFlags () const
 Returns all the CVar flags.
 
const char * GetPluginName () const
 Returns the name of the plugin which this CVar is declared in.
 

Private Attributes

Type m_Values [ezCVarValue::ENUM_COUNT]
 

Friends

class ezCVar
 

Additional Inherited Members

- Static Public Member Functions inherited from ezCVar
static void SetStorageFolder (const char *szFolder)
 Sets the path (folder) in which all CVar setting files should be stored. More...
 
static ezCVarFindCVarByName (const char *szName)
 Searches all CVars for one with the given name. Returns nullptr if no CVar could be found. The name is case-sensitive.
 
static void SaveCVars ()
 Stores all CVar values in files in the storage folder, that must have been set via 'SetStorageFolder'. More...
 
static void LoadCVars (bool bOnlyNewOnes=true, bool bSetAsCurrentValue=true)
 Loads the CVars from the settings files in the storage folder. More...
 
- Public Attributes inherited from ezCVar
ezEvent< const CVarEvent & > m_CVarEvents
 Code that needs to be execute whenever a cvar is changed can register itself here to be notified of such events.
 
- Static Public Attributes inherited from ezCVar
static ezEvent< const CVarEvent & > s_AllCVarEvents
 Broadcasts changes to ANY CVar. Thus code that needs to update when any one of them changes can use this to be notified.
 
- Protected Member Functions inherited from ezCVar
 ezCVar (const char *szName, ezBitflags< ezCVarFlags > Flags, const char *szDescription)
 
void RegisterCVarTelemetryChangeCB ()
 
- Static Protected Member Functions inherited from ezCVar
static void TelemetryMessage (void *pPassThrough)
 
- Protected Attributes inherited from ezEnumerable< ezCVar >
ezEnumerablem_pNextInstance
 

Detailed Description

template<typename Type, ezCVarType::Enum CVarType>
class ezTypedCVar< Type, CVarType >

[internal] Helper class to implement ezCVarInt, ezCVarFlag, ezCVarBool and ezCVarString.

Member Function Documentation

template<typename Type , ezCVarType::Enum CVarType>
void ezTypedCVar< Type, CVarType >::operator= ( const Type &  value)

Changes the CVar's value and broadcasts the proper events.

Usually the 'Current' value is changed, unless the 'RequiresRestart' flag is set. In that case only the 'Restart' value is modified.

template<typename Type , ezCVarType::Enum CVarType>
void ezTypedCVar< Type, CVarType >::SetToRestartValue ( )
overridevirtual

Copies the 'Restart' value into the 'Current' value.

This change will not trigger a 'restart value changed' event, but it might trigger a 'current value changed' event. Code that uses a CVar that is flagged as 'RequiresRestart' for its initialization (and which is the reason, that that CVar is flagged as such) should always call this BEFORE it uses the CVar value.

Implements ezCVar.


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