![]() |
XII Release 0.1.0
|
Stores the valid values and names for 'dynamic' enums. More...
#include <DynamicStringEnum.h>
Public Member Functions | |
const xiiHybridArray< xiiString, 16 > & | GetAllValidValues () const |
Returns all enum values and current names. | |
void | Clear () |
Resets the internal data. | |
void | AddValidValue (xiiStringView sValue, bool bSortValues=false) |
Sets the name for the given enum value. | |
void | RemoveValue (xiiStringView sValue) |
Removes a certain enum value, if it exists. | |
bool | IsValueValid (xiiStringView sValue) const |
Returns whether a certain value is known. | |
void | SortValues () |
Sorts existing values alphabetically. | |
void | SetStorageFile (xiiStringView 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. | |
xiiStringView | GetStorageFile () const |
The file where values will be stored. | |
void | SetEditCommand (xiiStringView sCmd, const xiiVariant &value) |
If specified, the widget shows an "edit" option, which will run xiiActionManager::ExecuteAction(sCmd, value). | |
xiiStringView | GetEditCommand () const |
const xiiVariant & | GetEditCommandValue () const |
void | ReadFromStorage () |
void | SaveToStorage () |
Static Public Member Functions | |
static xiiDynamicStringEnum & | GetDynamicEnum (xiiStringView sEnumName) |
Returns a xiiDynamicEnum under the given name. Creates a new one, if the name has not been used before. | |
static xiiDynamicStringEnum & | CreateDynamicEnum (xiiStringView sEnumName) |
static void | RemoveEnum (xiiStringView sEnumName) |
Removes the entire enum with the given name. | |
Static Public Attributes | |
static xiiDelegate< void(xiiStringView sEnumName, xiiDynamicStringEnum &e)> | s_RequestUnknownCallback |
Invoked by GetDynamicEnum() for enums that are unkonwn at that time. | |
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 xiiDynamicEnum for a specific type.
|
static |
Returns a xiiDynamicEnum 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.
void xiiDynamicStringEnum::SetEditCommand | ( | xiiStringView | sCmd, |
const xiiVariant & | value ) |
If specified, the widget shows an "edit" option, which will run xiiActionManager::ExecuteAction(sCmd, value).
This is meant to be used to open existing config dialogs. There is currently no way to report back a selection, so after making changes, the user has to make another selection.
|
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.
|
static |
Invoked by GetDynamicEnum() for enums that are unkonwn at that time.
Can be used to on-demand load those values, before GetDynamicEnum() returns.