Plasma Engine  2.0
Loading...
Searching...
No Matches
plDynamicStringEnum Class Reference

Stores the valid values and names for 'dynamic' enums. More...

#include <DynamicStringEnum.h>

Public Member Functions

const plHybridArray< plString, 16 > & GetAllValidValues () const
 Returns all enum values and current names.
 
void Clear ()
 Resets the internal data.
 
void AddValidValue (plStringView sValue, bool bSortValues=false)
 Sets the name for the given enum value.
 
void RemoveValue (plStringView sValue)
 Removes a certain enum value, if it exists.
 
bool IsValueValid (plStringView sValue) const
 Returns whether a certain value is known.
 
void SortValues ()
 Sorts existing values alphabetically.
 
void SetStorageFile (plStringView sFile)
 If set to non-empty, the user can easily edit this enum through a simple dialog and the values will be saved in this file.
 
plStringView GetStorageFile () const
 The file where values will be stored.
 
void ReadFromStorage ()
 
void SaveToStorage ()
 

Static Public Member Functions

static plDynamicStringEnumGetDynamicEnum (plStringView sEnumName)
 Returns a plDynamicEnum under the given name. Creates a new one, if the name has not been used before.
 
static plDynamicStringEnumCreateDynamicEnum (plStringView sEnumName)
 
static void RemoveEnum (plStringView sEnumName)
 Removes the entire enum with the given name.
 

Static Public Attributes

static plDelegate< void(plStringView sEnumName, plDynamicStringEnum &e)> s_RequestUnknownCallback
 Invoked by GetDynamicEnum() for enums that are unkonwn at that time.
 

Detailed Description

Stores the valid values and names for 'dynamic' enums.

The names and valid values for dynamic enums may change due to user configuration changes. The UI should show these user specified names without restarting the tool.

Call the static function GetDynamicEnum() to create or get the plDynamicEnum for a specific type.

Member Function Documentation

◆ GetDynamicEnum()

plDynamicStringEnum & plDynamicStringEnum::GetDynamicEnum ( plStringView sEnumName)
static

Returns a plDynamicEnum under the given name. Creates a new one, if the name has not been used before.

Calls s_RequestUnknownCallback, if the requested enum is not known yet, which will try to load the data.

◆ SetStorageFile()

void plDynamicStringEnum::SetStorageFile ( plStringView sFile)
inline

If set to non-empty, the user can easily edit this enum through a simple dialog and the values will be saved in this file.

Empty by default, as most dynamic enums need to be set up according to other criteria.

Member Data Documentation

◆ s_RequestUnknownCallback

plDelegate< void(plStringView sEnumName, plDynamicStringEnum &e)> plDynamicStringEnum::s_RequestUnknownCallback
static

Invoked by GetDynamicEnum() for enums that are unkonwn at that time.

Can be used to on-demand load those values, before GetDynamicEnum() returns.


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