TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class ConfigType in Tinman.Core.Config

Abstract base class for ConfigType implementations.

abstract class ConfigType extends ConfigNode
  implements IEquatable<ConfigType>
  base of ArrayType
  ClassType
  EnumType

Private / Methods

Begin

[Internal]
public method Begin ()
inherited ConfigNode.Begin

End

[Internal]
public method End ()
inherited ConfigNode.End

Private / Attributes

HasBegun

The balance between calls to Begin and End greater than zero?

[Internal]
public property HasBegun { get }
type bool
value true if the balance is greater than zero,
false if it is not.
inherited ConfigNode.HasBegun

Public / Constants

Bool

Boolean type.

[ShutdownSurvive]
public static readonly field Bool
type ConfigType

Invalid

Void type (i.e. no value).

[ShutdownSurvive]
public static readonly field Invalid
type ConfigType

Num

Decimal number type.

[ShutdownSurvive]
public static readonly field Num
type ConfigType

Path

File path type.

[ShutdownSurvive]
public static readonly field Path
type ConfigType

Str

String type.

[ShutdownSurvive]
public static readonly field Str
type ConfigType

Public / Attributes

All

Returns all known config types, sorted by Name.

public static property All { get }
type ConfigType[]
value [not-null] Array of all known config types.

CanBeNull

Can instances of this config type be null?

public abstract property CanBeNull { get }
type bool
value true if instances of this type can have the value null, false if not.

Documentation

Returns the documentation of this config type.

public property Documentation { get }
type TypeDocNode
value The documentation or null if not found.

IsAbstract

Is this an abstract type?

public virtual property IsAbstract { get }
type bool
value true if this is an abstract type, false if not.

Remarks:

Abstract types cannot be instantiated via New.

IsArray

Is this an array type?

public virtual property IsArray { get }
type bool
value true if this is an array type, false if not.

See also:

ArrayType

IsBoolean

Is this the type boolean?

public virtual property IsBoolean { get }
type bool
value true if this is the type boolean, false if not.

See also:

ConfigType

IsClass

Is this a class type?

public virtual property IsClass { get }
type bool
value true if this is a class type, false if not.

See also:

ClassType

IsEnum

Is this an enum type?

public virtual property IsEnum { get }
type bool
value true if this is an enum type, false if not.

See also:

EnumType

IsInvalid

Is this type invalid?

public virtual property IsInvalid { get }
type bool
value true if this type is invalid, false if not.

IsLazy

Is this config type lazy?

public virtual property IsLazy { get }
type bool
value true if this is a lazy config type, false if it is a regular one.

Remarks:

Lazy config types are created by calling Lazy; they refer to a config type by its fully-qualified name. Lazy config types are not present in the global config type registry (see Get). A lazy type can be converted into a regular type by calling ResolveLazy.

IsNumber

Is this the type number?

public virtual property IsNumber { get }
type bool
value true if this is the type number, false if not.

See also:

ConfigType

IsPath

Is this the type path?

public virtual property IsPath { get }
type bool
value true if this is the type string, false if not.

See also:

ConfigType

IsSimple

Is this a simple type?

public property IsSimple { get }
type bool
value true if this is a simple type, false if not.

See also:

Bool
Num
Path
Str

IsString

Is this the type string?

public virtual property IsString { get }
type bool
value true if this is the type string, false if not.

See also:

ConfigType

IsStruct

Is this a structure type?

public virtual property IsStruct { get }
type bool
value true if this is a structure type, false if not.

Remarks:

A struct is a non-abstract class type that has no subclasses and no super class.

IsValid

Is this type valid?

public property IsValid { get }
type bool
value true if this type is valid, false if not.

Members

Returns the type members.

[EmptyBody]
public virtual property Members { get }
type ConfigMember[]
value [not-null] The type members.

Module

The module that owns this config type.

public property Module { get }
type TinmanModule
value [not-null] The module.

Name

The human-readable name of this config type.

public abstract property Name { get }
type string
value [not-null] The type name.

Range

Returns source code range of this object.

public property Range { get }
type RangeI
value The source code character range or Inv if none.
inherited ConfigNode.Range

Public / Methods

AsArray

Casts this config type to ArrayType.

public virtual method AsArray ()
type ArrayType
returns [not-null] The cast type.

See also:

IsArray

Exceptions:

AsClass

Casts this config type to ClassType.

public virtual method AsClass ()
type ClassType
returns [not-null] The cast type.

See also:

IsClass

Exceptions:

AsEnum

Casts this config type to EnumType.

public virtual method AsEnum ()
type EnumType
returns [not-null] The cast type.

See also:

IsEnum

Exceptions:

ClearRange

Clears the source code range.

public method ClearRange ()
inherited ConfigNode.ClearRange

See also:

ConfigNode.Range

Coalesce

Returns the invalid type if type is null.

public static method Coalesce (ConfigType type = null)
type ConfigType
params type The type or null. Defaults to null.
returns [not-null] The resulting type.

Equals

Compares this object with the given one.

[Pure]
public method Equals (ConfigType other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.
implements IEquatable.Equals

FindAt

Finds all config nodes which code range (see Range) contains the given range (see Contains).

public virtual method FindAt (RangeI range, ICollector<ConfigNode> nodes)
params range The code range to intersect with.
  nodes [not-null] The output nodes.
inherited ConfigNode.FindAt

FindUsages

Returns all ConfigMember s in all known ConfigType s that use the given config type in their member value type (including nested array types).

public static method FindUsages (ConfigType type)
type ConfigMember[]
params type [not-null] The type for which to return usages.
returns [not-null] The usages.

FixTry

Tries to fix the given expression.

public method FixTry (ConfigExpression expr)
type ConfigExpression
params expr [not-null] The expression to fix.
returns [not-null] The fixed expression or expr if fixing is not possible.

Remarks:

This class type is used as the expected type. The method tries to find a distinct sequence of syntactic fixes so that the expression type becomes convertible to this class type.


Checks if the given config value can be fixed so that its type becomes convertible to this config type.

public method FixTry (ConfigValue value, ConfigType superType = null)
type bool
params value [not-null] The config value to fix.
  superType Optional super type to which the fixed value must be assignable to. Defaults to null.
returns true if value can be fixed, false if not.

Get

Returns a config type by its name.

public static method Get (string name)
type ConfigType
params name [not-null] The type name.
returns [not-null] The ConfigType object.

Exceptions:

GetNull

Returns a config type by its name.

public static method GetNull (string name, IVectorConst<string> prefixes = null, ClassType superClass = null)
type ConfigType
params name The type name.
  prefixes Optional list of type name prefixes to use for resolving short names. Defaults to null.
  superClass Optional super class to use for determining the set of possible config types. Defaults to null.
returns The ConfigType object or null if not found.

IsAssignableTo

Checks if this config type is assignable to the given type.

public virtual method IsAssignableTo (ConfigType other)
type bool
params other [not-null] The other type.
returns true if this type is assignable to the given one, false if not.

Remarks:

Equal types are always assignable to each other (see Equals). Additionally, a type A is assignable to a type B if one of these conditions are met:

IsConvertibleTo

Checks if this config type is convertible to the given type (i.e. possibly failing, possibly lossy implicit conversion).

[EmptyBody]
public virtual method IsConvertibleTo (ConfigType other, bool always = false)
type bool
params other [not-null] The other config type.
  always When set to true, the method will return true iff this type is always convertible to other. When set to false, this method will return true even if a conversion might fail at runtime, causing a ConfigException to be thrown (e.g. invalid string to number). Defaults to false.
returns true if this type is convertible to the given one, false if not.

Remarks:

The following table shows the types A that are convertible to the types B:

A \ B | Array |  Bool | Class |  Enum |  Num  |  Path |  Str  |
------+-------+-------+-------+-------+-------+-------+-------+
Array |  (1)  |  (2)  |       |       |       |       |  (3)  |
------+-------+-------+-------+-------+-------+-------+-------+
Bool  |       | (17)  |       |       |  (4)  |       |  (5)  |
------+-------+-------+-------+-------+-------+-------+-------+
Class |       |  (2)  | (17)  |       |       |       |       |
------+-------+-------+-------+-------+-------+-------+-------+
Enum  |       |       |       | (17)  |  (6)  |       |  (7)  |
------+-------+-------+-------+-------+-------+-------+-------+
Num   |       |  (8)  |       |  (9)  | (17)  |       | (10)  |
------+-------+-------+-------+-------+-------+-------+-------+
Path  |       | (11)  |       |       |       | (17)  | (12)  |
------+-------+-------+-------+-------+-------+-------+-------+
Str   |       | (13)  |       | (14)  | (15)  | (16)  | (17)  |
Two types that are assignable will always be convertible. A failed conversion attempt will yield Invalid values.
The conversions outlined above are explained here:
  1. An array type A is convertible to an array type B iff the element type of A is convertible to the element type of B.
  2. The negated result of IsNull is used as the converted value.
  3. Each array element is converted to Str and the resulting tokens are concatenated using ',' as the glue. If one or more array elements cannot be converted, the result will be Invalid.
  4. true =>1, false =>0
  5. true =>'true', false =>'false'
  6. The ordinal value of the enum item (see GetItemOrdinal) is used.
  7. The tag value of the enum item (see Tag) is used.
  8. 0 =>false, all other values yield true.
  9. The number is used as the enum item ordinal value (see GetItem ). Will result in Invalid if the number lies outside of the range of valid ordinal values.
  10. The number is formatted as a string (using NumberFormat with round-trip precision):
    123.45 =>'123.45'.
  11. Will be true iff the path value refers to an existing file or directory (depending on IsTrailing).
  12. The path value is used for the assignment (see ToString).
  13. Will be false if the string is null, empty or consists only of whitespaces (see IsEmptyOrWhitespace).
  14. If the string value is equal to the tag of an enum item (see Tag), that enum item will be used. Will be Invalid if not found.
  15. The string value is parsed as a number (see NumberParse). Will be Invalid for unparseable string values.
  16. The string value is converted to a Path (see From). Will be Invalid for bad path strings.
  17. Assignable types (see IsAssignableTo) are always convertible.
When a conversion fails and the result is Invalid, a ConfigException will be thrown, unless the conversion took place during evaluation of a config expression (see Evaluate).

Lazy

Returns a config type lazily.

public static method Lazy (string name)
type ConfigType
params name [not-empty] The config type name.
returns [not-null] The lazy config type reference.

Remarks:

When this method is called, the referred config type does not need to exist. It must have been created by the time the returned ConfigType is actually used, though.

See also:

IsLazy

NewArray

Creates an empty array value using this ConfigType as element type.

[Pure]
public method NewArray ()
type ConfigValue
returns [not-null] The empty array value.

Remarks:

This method just calls ToArray, Value and New in sequence.

Resolve

Resolves all references in this PSI node.

public override sealed method Resolve ()
type ResolveResult
returns The result of the resolver cycle.
implements ConfigNode.Resolve

ResolveLazy

Resolves this config type into a non-lazy one.

public virtual method ResolveLazy ()
type ConfigType
returns [not-null] The non-lazy config type.

SetParseInfo

Provides additional information about the parsing process.

public method SetParseInfo (RangeI range)
params range The source code range.
inherited ConfigNode.SetParseInfo

ShortName

Returns the shortest non-ambiguous name for this config type.

public virtual method ShortName (IVectorConst<string> prefixes = null, ClassType superClass = null)
type string
params prefixes The name prefixes or null.
  superClass The class hierarchy root to use for finding name clashes.
returns [not-null] The short name.

ToArray

Uses this type as the element type and returns the corresponding array type.

[Pure]
public virtual method ToArray ()
type ArrayType
returns [not-null] The array type.

ToString

[Pure]
public override method ToString ()
type string
overrides ConfigNode.ToString

Validate

Validates the state of this object.

public override method Validate (Validator validator)
params validator [not-null] The validator object.
implements ConfigNode.Validate

Value

Creates a new value object for this config property type.

public abstract method Value ()
type ConfigValue
returns [not-null] The created value object.

Remarks:

The returned value object will have the default value for its type. A class type value must be initialized to a concrete type before its fields can be accessed. This is done by calling New.

WriteSourceCode

Produces source code by feeding the given source code writer.

public abstract method WriteSourceCode (SourceCodeWriter writer, Context context)
params writer [not-null] The source code writer to use.
  context [not-null] Context information.
inherited ConfigNode.WriteSourceCode

Exceptions:

Protected / Attributes

range

The source code range of this PSI node.

protected field range
type RangeI
inherited ConfigNode.range

Protected / Constructors

ConfigType

protected constructor ConfigType ()