Drag[en]gine Script Module DragonScript  1.23
Dragengine.Utils.ParameterTree Class Reference

Nested tree of parameters. More...

Inheritance diagram for Dragengine.Utils.ParameterTree:

Public Member Functions

void forEach (Block ablock)
 Visit parameters with block with arguments path(String) and value(Object). More...
 
Array getArrayAt (String path, Array default)
 Array value of parameter or default value if absent. More...
 
FloatRectArea getAt (String path, FloatRectArea default)
 FloatRectArea value of parameter or default value if absent. More...
 
Object getAt (String path, Object default)
 Value of parameter or default value if absent. More...
 
bool getBoolAt (String path, bool default)
 Boolean value of parameter or default value if absent. More...
 
BorderSize getBorderSizeAt (String path, BorderSize default)
 BorderSize value of parameter or default value if absent. More...
 
Color getColorAt (String path, Color default)
 Color value of parameter or default value if absent. More...
 
float getFloatAt (String path, float default)
 Floating point value of parameter or default value if absent. More...
 
int getIntAt (String path, int default)
 Integer value of parameter or default value if absent. More...
 
Array getKeys (String path)
 Parameter keys under path as Array of String using '/' separator. More...
 
Array getKeys (String path, byte separator)
 Parameter keys under path as Array of String. More...
 
Array getPathList ()
 Parameter path list as Array of String. More...
 
Point3 getPoint3At (String path, Point3 default)
 Point3 value of parameter or default value if absent. More...
 
Point getPointAt (String path, Point default)
 Point value of parameter or default value if absent. More...
 
RectArea getRectAreaAt (String path, RectArea default)
 RectArea value of parameter or default value if absent. More...
 
String getStringAt (String path, String default)
 String value of parameter or default value if absent. More...
 
ParameterTree getTreeAt (String path, ParameterTree default)
 Tree value of parameter or default value if absent. More...
 
Vector2 getVector2At (String path, Vector2 default)
 Vector2 value of parameter or default value if absent. More...
 
Vector getVectorAt (String path, Vector default)
 Vector value of parameter or default value if absent. More...
 
void log (Console console, String name)
 Print parameters to console. More...
 
ParameterTree new ()
 Create parameter tree. More...
 
ParameterTree new (ParameterTree tree)
 Create copy of parameter tree. More...
 
void remove (String path)
 Remove value if set. More...
 
void removeAll ()
 Remove all values. More...
 
void setAt (String path, Object value)
 Set value of parameter. More...
 

Public Attributes

Dictionary pParameters
 

Detailed Description

Nested tree of parameters.

Parameters are retrieved using a path. The value of parameters can be primitive types like string or floating point as well as some basic game engine classes like point or vectors and arrays thereof. Parameter trees can be loaded from and written to XML files. This class is best used to load parameters from XML files without the need to write specific XML loaders and complex parameter storing classes. A typical use case is prototyping, storing small lists of parameters or storing information with structure not known at build time.

This class itself does not enforce a specific path separator. The LoadParameterTree class thought uses '/' as path separator. It is encouraged to use '/' as path separator.

Member Function Documentation

◆ forEach()

void Dragengine.Utils.ParameterTree.forEach ( Block  ablock)

Visit parameters with block with arguments path(String) and value(Object).

◆ getArrayAt()

Array Dragengine.Utils.ParameterTree.getArrayAt ( String  path,
Array  default 
)

Array value of parameter or default value if absent.

◆ getAt() [1/2]

FloatRectArea Dragengine.Utils.ParameterTree.getAt ( String  path,
FloatRectArea  default 
)

FloatRectArea value of parameter or default value if absent.

◆ getAt() [2/2]

Object Dragengine.Utils.ParameterTree.getAt ( String  path,
Object  default 
)

Value of parameter or default value if absent.

◆ getBoolAt()

bool Dragengine.Utils.ParameterTree.getBoolAt ( String  path,
bool  default 
)

Boolean value of parameter or default value if absent.

◆ getBorderSizeAt()

BorderSize Dragengine.Utils.ParameterTree.getBorderSizeAt ( String  path,
BorderSize  default 
)

BorderSize value of parameter or default value if absent.

◆ getColorAt()

Color Dragengine.Utils.ParameterTree.getColorAt ( String  path,
Color  default 
)

Color value of parameter or default value if absent.

◆ getFloatAt()

float Dragengine.Utils.ParameterTree.getFloatAt ( String  path,
float  default 
)

Floating point value of parameter or default value if absent.

◆ getIntAt()

int Dragengine.Utils.ParameterTree.getIntAt ( String  path,
int  default 
)

Integer value of parameter or default value if absent.

◆ getKeys() [1/2]

Array Dragengine.Utils.ParameterTree.getKeys ( String  path)

Parameter keys under path as Array of String using '/' separator.

◆ getKeys() [2/2]

Array Dragengine.Utils.ParameterTree.getKeys ( String  path,
byte  separator 
)

Parameter keys under path as Array of String.

◆ getPathList()

Array Dragengine.Utils.ParameterTree.getPathList ( )

Parameter path list as Array of String.

◆ getPoint3At()

Point3 Dragengine.Utils.ParameterTree.getPoint3At ( String  path,
Point3  default 
)

Point3 value of parameter or default value if absent.

◆ getPointAt()

Point Dragengine.Utils.ParameterTree.getPointAt ( String  path,
Point  default 
)

Point value of parameter or default value if absent.

◆ getRectAreaAt()

RectArea Dragengine.Utils.ParameterTree.getRectAreaAt ( String  path,
RectArea  default 
)

RectArea value of parameter or default value if absent.

◆ getStringAt()

String Dragengine.Utils.ParameterTree.getStringAt ( String  path,
String  default 
)

String value of parameter or default value if absent.

◆ getTreeAt()

ParameterTree Dragengine.Utils.ParameterTree.getTreeAt ( String  path,
ParameterTree  default 
)

Tree value of parameter or default value if absent.

◆ getVector2At()

Vector2 Dragengine.Utils.ParameterTree.getVector2At ( String  path,
Vector2  default 
)

Vector2 value of parameter or default value if absent.

◆ getVectorAt()

Vector Dragengine.Utils.ParameterTree.getVectorAt ( String  path,
Vector  default 
)

Vector value of parameter or default value if absent.

◆ log()

void Dragengine.Utils.ParameterTree.log ( Console  console,
String  name 
)

Print parameters to console.

◆ new() [1/2]

ParameterTree Dragengine.Utils.ParameterTree.new ( )

Create parameter tree.

◆ new() [2/2]

ParameterTree Dragengine.Utils.ParameterTree.new ( ParameterTree  tree)

Create copy of parameter tree.

Arrays are duplicated but no value inside since all values stored in the parameter tree are considered immutable.

◆ remove()

void Dragengine.Utils.ParameterTree.remove ( String  path)

Remove value if set.

◆ removeAll()

void Dragengine.Utils.ParameterTree.removeAll ( )

Remove all values.

◆ setAt()

void Dragengine.Utils.ParameterTree.setAt ( String  path,
Object  value 
)

Set value of parameter.

Member Data Documentation

◆ pParameters

Dictionary Dragengine.Utils.ParameterTree.pParameters

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