Base class for IConfigurator implementations that configure enumerations.
sealed class
|
ConfiguratorEnum
|
with
|
<T>
|
||
extends
|
ConfiguratorBase<T>
|
||||
implements
|
IConfiguratorEnum<T>
|
Returns the configuration type of this configurator.
public
override
property
|
Type
{
get
}
|
||
type
|
ConfigType
|
||
value
|
|
The configuration type. | |
implements
|
ConfiguratorBase.Type
|
Creates a new instance of ConfiguratorEnum.
public
static
method
|
Build
(string name,
TinmanModule module,
ConfiguratorEnumDelegate<T> deferred = null,
bool codeGen = false)
|
||
type
|
IConfiguratorEnum<T>
|
||
params
|
name
|
[not-empty]
|
Name of type to build. |
module
|
[not-null]
|
The owning module. | |
deferred
|
Optional
deferred
configurator
delegate.
Defaults
to
null .
|
||
codeGen
|
Called from code generator? | ||
returns
|
|
The configurator object. |
Adds an enum item as the default item.
public
method
|
DefaultItem
(string name,
T value,
string tag = null)
|
||
params
|
name
|
[not-empty]
|
The enum item name. |
value
|
The enum item value. | ||
tag
|
Optional
enum
item
string
tag.
Defaults
to
null . |
||
implements
|
IConfiguratorEnum.DefaultItem
|
Finishes building of this enum configurator.
public
method
|
Finish
(bool sort = false,
bool defaultFirst = false)
|
||
type
|
IConfiguratorEnum<T>
|
||
params
|
sort
|
Sort enum items by their name? | |
defaultFirst
|
Place default item first? | ||
returns
|
|
this | |
implements
|
IConfiguratorEnum.Finish
|
Applies the given flag semantic to this configurator.
public
method
|
Flags
(IFlags<T> handler)
|
||
type
|
IConfigurator<T>
|
||
params
|
handler
|
[not-null]
|
The flag semantic. |
returns
|
|
The resulting configurator. | |
implements
|
IConfiguratorEnum.Flags
|
Remarks:
This configurator must be finished first.
Creates a new instance from a field of the given configuration value.
[OwnerReturn]
|
||||
public
method
|
FromField
(ConfigValue config,
string field)
|
|||
type
|
T
|
|||
params
|
config
|
[not-null]
|
The configuration value. | |
field
|
[not-null]
|
Field name. | ||
returns
|
|
The created instance. | ||
inherited
|
ConfiguratorBase.FromField
|
Creates a new instance from the given configuration entity.
[OwnerReturn]
|
||||
public
method
|
FromScript
(ConfigScript script,
string name)
|
|||
type
|
T
|
|||
params
|
script
|
[not-null]
|
The config script. | |
name
|
[not-null]
|
Name of the entity. | ||
returns
|
|
The created instance. | ||
inherited
|
ConfiguratorBase.FromScript
|
Creates a new instance from the given configuration value.
[OwnerReturn]
|
||||
public
virtual
method
|
FromValue
(ConfigValue config)
|
|||
type
|
T
|
|||
params
|
config
|
[not-null]
|
The configuration value. | |
returns
|
|
The created instance. | ||
inherited
|
ConfiguratorBase.FromValue
|
Creates an array of instances from the given configuration value.
[OwnerReturn]
|
||||
public
method
|
FromValueArray
(ConfigValue config)
|
|||
type
|
T[]
|
|||
params
|
config
|
[not-null]
|
The configuration value. | |
returns
|
The
resulting
array
or
null
if
config
contains
zero
elements.
|
|||
inherited
|
ConfiguratorBase.FromValueArray
|
Creates an array of instances from the given configuration value.
[OwnerReturn]
|
||||
public
method
|
FromValueList
(ConfigValue config)
|
|||
type
|
IVector<T>
|
|||
params
|
config
|
[not-null]
|
The configuration value. | |
returns
|
The
resulting
array
or
null
if
config
contains
zero
elements.
|
|||
inherited
|
ConfiguratorBase.FromValueList
|
Adds an enum item.
public
method
|
Item
(string name,
T value,
string tag = null)
|
||
params
|
name
|
[not-empty]
|
The enum item name. |
value
|
The enum item value. | ||
tag
|
Optional
enum
item
string
tag.
Defaults
to
null . |
||
implements
|
IConfiguratorEnum.Item
|
This is a no-op method that forces the compiler / linker to include this type in the resulting binary.
public
method
|
PleaseIncludeInBinaryThanks
()
|
||
inherited
|
ConfiguratorBase.PleaseIncludeInBinaryThanks
|
Remarks:
Calling this stub method makes sure that all lazy constructor calls have been made.
To initialize everything, an application needs to call this method on its root module(s) (see TinmanModule), followed by a call to PleaseIncludeInBinaryThanksAll.
Returns the configuration value that describes the given object.
public
override
method
|
ToValue
(T instance)
|
||
type
|
ConfigValue
|
||
params
|
instance
|
The object. | |
returns
|
|
The configuration value. | |
implements
|
ConfiguratorBase.ToValue
|
Remarks:
The returned value may be of type Invalid, which means that the given object in its current state cannot be described with the configuration API.
Returns the configuration value that describes the given objects.
public
method
|
ToValueArray
(T[] instances)
|
||
type
|
ConfigValue
|
||
params
|
instances
|
The object. | |
returns
|
|
The configuration array value. | |
inherited
|
ConfiguratorBase.ToValueArray
|
Remarks:
The returned value may be of type Invalid, which means that the given object in its current state cannot be described with the configuration API.
Returns the configuration value that describes the given objects.
public
method
|
ToValueList
(IVectorConst<T> instances)
|
||
type
|
ConfigValue
|
||
params
|
instances
|
The object. | |
returns
|
|
The configuration array value. | |
inherited
|
ConfiguratorBase.ToValueList
|
Remarks:
The returned value may be of type Invalid, which means that the given object in its current state cannot be described with the configuration API.