ConfigValue

Description

abstract class Tinman.Core.Config.ConfigValue

Abstract base class for ConfigValue implementations.

Public / Constants

ContextIncludeVirtualFields


public constant ContextIncludeVirtualFields → ("include-virtual-fields":string)

When using ToString1, this context value will be set via Context.Set1 when generating source code.

False


[ShutdownSurvive]
public static readonly attribute False → (ConfigValue)

The boolean value false.

This config value is immutable. Modifying its value will produce undefined behaviour.

Invalid


[ShutdownSurvive]
public static readonly attribute Invalid → (ConfigValue)

An invalid value.

This config value is immutable. Modifying its value will produce undefined behaviour.

Null


[ShutdownSurvive]
public static readonly attribute Null → (ConfigValue)

The null value for ClassType values.

This config value is immutable. Modifying its value will produce undefined behaviour.

One


[ShutdownSurvive]
public static readonly attribute One → (ConfigValue)

The number value 1.

This config value is immutable. Modifying its value will produce undefined behaviour.

True


[ShutdownSurvive]
public static readonly attribute True → (ConfigValue)

The boolean value true.

This config value is immutable. Modifying its value will produce undefined behaviour.

Zero


[ShutdownSurvive]
public static readonly attribute Zero → (ConfigValue)

The number value 0.

This config value is immutable. Modifying its value will produce undefined behaviour.

Public / Constructors

Evaluate


public static method Evaluate → (1)

expression in : string

[not-null]
The config expression.

returns → ConfigValue

The config value.

Parses the given config expression and returns the resulting config value.

ValidatingException

If the given expression in source code is malformed.

ConfigException

If an error has occurred while evaluating the expression (e.g. identifier not found).

New

4 overloads


public static method New1 → (1)

value in : bool

The initial value.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Bool config value object for the the given value.


public static method New2 → (1)

value in : float64

The initial value.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Num config value object for the the given value.


public static method New3 → (1)

value in : Path

The initial value.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Path config value object for the the given value.


public static method New4 → (1)

value in : string

The initial value.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Str config value object for the the given value.

NewArray

4 overloads


public static method NewArray1 → (1)

values in : bool [ ]

The initial values.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Path config value array for the the given values.


public static method NewArray2 → (1)

values in : float64 [ ]

The initial values.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Path config value array for the the given values.


public static method NewArray3 → (1)

values in : string [ ]

The initial values.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Path config value array for the the given values.


public static method NewArray4 → (1)

values in : Path [ ]

The initial values.

returns → ConfigValue

The ConfigValue object.

Creates a new ConfigType.Path config value array for the the given values.

Public / Methods

Cache


[EmptyBody]
public virtual method Cache → (1)

obj in : object

The native object

returns → ConfigValue

this

Caches the given object.

This method can be called after a config value has been constructed for a native object.

Cached


[EmptyBody]
public virtual method Cached → (1)

version in : int32

The config value version.

returns → object

The cached native object or null if not present or outdated.

Returns the cached object.

Configure


[OwnerReturn]
public method Configure → ()

returns → IConfigurable

The created object.

Uses this config value and creates a native object from it.

An IConfiguratorObject instance must have been specified for the ClassType of this value (see ClassTypeBuilder.Configurator).

ConfigException

If this config value specifies malformed configuration data.

IOException

If a temporary I/O error has occurred; the same call might succeed later.

ValidatingException

If the given config value is invalid (see IValidatable.Validate).

GetField


public method GetField → (2)

name in : string

[not-null]
The field name.

notNull opt : bool = false

Call NotNull on field value?

returns → ConfigValue

The field value.

Returns the value of the given field.

ConfigException

If name in is invalid or if the field violates the required nullabililty.

GetFieldBool


public method GetFieldBool → (1)

name in : string

[not-null]
The field name.

returns → bool

The field value.

Returns the value of the given field.

ConfigException

If name in is invalid or if the field has an inconvertible type.

GetFieldDouble


public method GetFieldDouble → (1)

name in : string

[not-null]
The field name.

returns → float64

The field value.

Returns the value of the given field.

ConfigException

If name in is invalid or if the field has an inconvertible type.

GetFieldInt


public method GetFieldInt → (1)

name in : string

[not-null]
The field name.

returns → int32

The field value.

Returns the value of the given field.

ConfigException

If name in is invalid or if the field has an inconvertible type.

GetFieldPath


public method GetFieldPath → (2)

name in : string

[not-null]
The field name.

notNull opt : bool = false

Call NotNull on field value?

returns → Path

The field value.

Returns the value of the given field.

ConfigException

If name in is invalid or if the field has an inconvertible type.

GetFieldStr


public method GetFieldStr → (2)

name in : string

[not-null]
The field name.

notNull opt : bool = false

Call NotNull on field value?

returns → string

The field value.

Returns the value of the given field.

ConfigException

If name in is invalid, if the field has an inconvertible type or if the field violates the required nullabililty.

New

2 overloads


public method New1 → ()

returns → ConfigValue

this

Creates a new instance of this nullable type and sets this value to the resulting value.


public virtual method New2 → (1)

type in : ConfigType

The nullable type to instantiate or null to use the value base type.

returns → ConfigValue

this

Creates a new instance of the given nullable type and sets this value to the resulting value.

ConfigException

If the given type in cannot be instantiated or cannot be assigned to the base type of this config value.

NotNull


public method NotNull → ()

returns → ConfigValue

this

Ensures that this config value is not equal to Null, i.e. IsNull will return false.

ConfigException

If this config value is Null.

Set


public virtual method Set → (1)

value in : ConfigValue

[not-null]
The other value.

returns → ConfigValue

this

Sets the value to the given value.

ConfigException

If value in is not convertible to the type of this config value.

SetField

2 overloads


public method SetField1 → (2)

name in : string

[not-null]
The field name.

value in : ConfigValue

[not-null]
The field value.

returns → ConfigValue

this

Sets the value of the given field.

ConfigException

If name in is invalid or if value in is not convertible to the type of this config value.


public method SetField2 → (2)

name in : string

[not-null]
The field name.

value in : IConfigurable

The field value.

returns → ConfigValue

this

Sets the value of the given field.

ConfigException

If name in is invalid or if value in is not convertible to the type of this config value.

SetFieldBool


public method SetFieldBool → (2)

name in : string

[not-null]
The field name.

value in : bool

The field value.

returns → ConfigValue

this

Sets the value of the given field.

ConfigException

If name in is invalid or if value in is not convertible to the type of this config value.

SetFieldNum


public method SetFieldNum → (2)

name in : string

[not-null]
The field name.

value in : float64

The field value.

returns → ConfigValue

this

Sets the value of the given field.

ConfigException

If name in is invalid or if value in is not convertible to the type of this config value.

SetFieldPath


public method SetFieldPath → (2)

name in : string

[not-null]
The field name.

value in : Path

The field value.

returns → ConfigValue

this

Sets the value of the given field.

ConfigException

If name in is invalid or if value in is not convertible to the type of this config value.

SetFieldStr


public method SetFieldStr → (2)

name in : string

[not-null]
The field name.

value in : string

The field value.

returns → ConfigValue

this

Sets the value of the given field.

ConfigException

If name in is invalid or if value in is not convertible to the type of this config value.

ToString

2 overloads


public method ToString1 → (1)

includeVirtualFields in : bool

Include virtual fields (see ConfigMember.IsVirtual)?

returns → string

The parseable string representation

Returns a parseable string representation of this config value.

ValidateFlush


public virtual method ValidateFlush → ()

Flushes all cached validation results.

Call this method when external changes have taken place, such as file deletions / creations.

Public / Attributes

Bool


public virtual attribute Bool → (get,set)

value : bool

The config value.

Accesses the config value, assuming a conversion to ConfigType.Bool exists.

ConfigException

If no conversion to ConfigType.Bool exists.

CanConfigure


public attribute CanConfigure → (get)

value : bool

true if Configure can be called,
false if not.

Can the Configure method be called on this config value?

Elements


public virtual attribute Elements → (get)

value : ValueArray

[not-null]
The config value.

Accesses the config value, assuming it is an array value.

ConfigException

If this is not an array value.

EvaluatedBy


public attribute EvaluatedBy → (get)

value : ConfigExpression

The config expression or null if not known resp. applicable.

Returns the config expression that has been evaluated to create this config value.

Fields


public virtual attribute Fields → (get)

value : IConfigValueBag

[not-null]
The config value.

Accesses the config value, assuming it is a class value.

ConfigException

If this is not a class value.

IsInvalid


public virtual attribute IsInvalid → (get)

value : bool

true if this config type is Invalid),
false if it is some other valid type.

Checks if this config type is the special invalid type.

IsNull


public virtual attribute IsNull → (get)

value : bool

true if this config type is Null),
false if it is some other non-null type.

Checks if this config type is the special null type.

Num


public virtual attribute Num → (get,set)

value : float64

The config value.

Accesses the config value, assuming a conversion to ConfigType.Num exists.

ConfigException

If no conversion to ConfigType.Num exists.

Path


public virtual attribute Path → (get,set)

value : Path

The config value.

Accesses the config value, assuming a conversion to ConfigType.Path exists.

ConfigException

If no conversion to ConfigType.Path exists.

Str


public virtual attribute Str → (get,set)

value : string

The config value.

Accesses the config value, assuming a conversion to ConfigType.Str exists.

ConfigException

If no conversion to ConfigType.Str exists.

SyntaxWeightCtor


public attribute SyntaxWeightCtor → (get)

value : int32

The syntax weight.

Returns the syntax weight for this config value (for pretty-print only).

Type


public abstract attribute Type → (get)

value : ConfigType

[not-null]
The type of this property value.

Returns the type of this config property value.

Protected / Constructors

ConfigValue


protected constructor ConfigValue → ()

Creates a new instance of ConfigValue.

Protected / Methods

DoEquals


protected abstract method DoEquals → (1)

other in : ConfigValue

The other config value. This will never be null. Also, the types of this config value and the given one are mutually convertible to each other.

returns → bool

true if both config values are equal, false if not.

Compares this config value and the given one for equality.

ConfigException

If an unexpected error has occurred.

DoValidate


[EmptyBody]
protected virtual method DoValidate → (1)

validator in : Validator

The validator to use.

Validates this config value.

ConfigException

If this config value specifies malformed configuration data.

Protected / Attributes

DoSyntaxWeightCtor


protected abstract attribute DoSyntaxWeightCtor → (get)

value : int32

The syntax weight.

Returns the syntax weight for this config value (for pretty-print only).

ConfigException

If an unexpected error has occurred.