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 class does not provide further logic.
Public Fields | |
String | category |
AString | categoryFallback |
String | comments |
String | defaultValue |
char | delim |
String | formatAttrAlignment |
int | formatHints |
String | name |
Public Methods | |
VariableDecl (AString categoryFallback, String category, String name, String defaultValue, char delim, String formatAttrAlignment, int formatHints, String comments) | |
VariableDecl | ( | AString | categoryFallback, |
String | category, | ||
String | name, | ||
String | defaultValue, | ||
char | delim, | ||
String | formatAttrAlignment, | ||
int | formatHints, | ||
String | comments | ||
) |
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 com.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.
int formatHints |
Hints for formatting textual configuration files. (Used by class IniFile and potentially by custom plug-ins.
String name |
The name of the variable.