Name: | Variable |
Version: | 1.0 |
ID: | ID_VARIABLE |
Status: | Stable |
Category: | Command |
Date: | November 2002 |
Author: | Rocklyte Systems |
Copyright: | Rocklyte Systems (c) 2000-2002. All rights reserved. |
The Variable class is used to create, store and retrieve values during the execution of a script. Essentially it allows you to store any type of data that you like using object compatible methods. It also has its uses in saving program options, desktop settings and other bits of information that may need to be recalled at a later stage.
Data storage and retrieval is achieved through the use of unlisted fields, so a variable object named 'storage' with fields 'x', 'y' and 'z' would be created as follows when using DML:
<variable name="storage" &x="1" &y="2" &z="3"/>
For occasions when data needs to be stored permanently, the Variable class supports file locations for data storage and retrieval. Using our previous example, we can store the x, y and z values in a configuration file, as follows:
[data] x = 1 y = 2 z = 3
To load the data file into a variable object, we would use this DML code:
<variable name="storage" location="data.cfg"/>
When using a file location, bear in mind that the Variable class will save all data back to the file when the Variable object is destroyed.
The Variable class supports the following actions:
GetUnlistedField Retrieves stored field values from a variable object. SetUnlistedField Stores new field values in a variable object.
The Variable class implements the following methods:
StripSlash Strips trailing forward and back slashes from variable fields.
The Variable object consists of the following public fields:
Flags Special flag settings. Location Variables can be loaded from a configuration file if you set this field.
Field: | Flags | |
Short: | Special flag settings. | |
Type: | LONG | |
Prefix: | VF_ | |
Status: | Read/Write | |
|
Field: | Location | |
Short: | Variables can be loaded from a configuration file if you set this field. | |
Type: | STRING | |
Status: | Get/Set | |
|