A data record used to declare an ALib Configuration Variable. While variables can also be declared by setting their attributes individually, it is recommended to declare all external configuration variables in a central place, using statically or dynamically allocated objects of this type.
Objects of class Variable can be constructed and existing objects can be reused by invoking Variable.Declare. Both, construction and re-declaration of variables, use objects of this type.
All fields (except Delim) support placeholders "%1"
, "%2"
... "%N"
, which are replaced with the constructor of class Variable and method Variable.Declare. This allows to define a series of variables whose category, name, description and value is dependent on runtime information.
Besides the use for passing parameters into objects of type Variable, this struct does not provide further logic.
Public Fields | |
String | Category |
AString | CategoryFallback |
String | Comments |
String | DefaultValue |
char | Delim |
String | FormatAttrAlignment |
Variable.FormatHint | FormatHints |
String | Name |
Public Methods | |
VariableDecl (AString categoryFallback, String category, String name, String defaultValue, char delim, String formatAttrAlignment, Variable.FormatHint formatHints, String comments) | |
|
inline |
Simple constructor copying values
categoryFallback | Value for field CategoryFallback (treated as reference, value not copied) |
category | Value for field Category |
name | Value for field Name |
defaultValue | Value for field DefaultValue |
delim | Value for field Delim |
formatAttrAlignment | Value for field FormatAttrAlignment |
formatHints | Value for field FormatHints |
comments | Value for field Comments |
String Category |
The category for this value. May be left nulled in which case field CategoryFallback is applied.
AString CategoryFallback |
Reference to a category string which is used as fallback if field Category is nulled. This is useful as usually most variables share one general application specific category. With the combination of fields CategoryFallback and Category, the user (of a library) is be entitled to change single variables or all at once. In the latter case, field Category is left nulled, while this field is set to a global default value (which also can be changed, therefore a pointer).
String Comments |
Comments for the variable. Some plug-ins allow to store comments along with the variable (e.g. class cs.aworx.lib.config.IniFile).
String DefaultValue |
The default value. If this is null
, no variable will be created with method Configuration.Load.
char Delim |
The (preferred) delimiter of values when represented in external strings.
String FormatAttrAlignment |
If set, attributes written in multi-lines are vertically aligned by this character or string. Use cases are "=", ":" or "->".
Used by IniFile and potentially by custom plug-ins.
Variable.FormatHint FormatHints |
Hints for formatting textual configuration files. (Used by class IniFile and potentially by custom plug-ins.
String Name |
The name of the variable.