Configuration files - general information
ASPC uses configuration files in the default format supported
by the Jacked-Objects C++ library. Internally configuration was
kept in a standard classes that are known for all Jacked
components. The trees of these objects are used to transfer
information between components, to save/restore components state
automatically over the tree defined by the configuration
(mechanism often called persistence). You don't need to know
details on how the data is used in order to be able to manage the
configuration files - the important syntax rules are listed below:
- Comments - any line with first non-blank
character ";" is ignored and can be
used for comments. Currently any incorrect line is ignored but
this behavior may change in the future thus use only lines
beginning with ";" for comments.
- Section. Section is a container of the
other data units and may contain subsections. Section may have
bundled class. If so the application is able to automatically
create object of the class initialized with the content of the
section. General section syntax is:
{ Section_Name: (Bundled_class_name)
; Some content
} Section_Name;
Section name - There must be at least one
blank character between "{" and the section name.
Name can contain spaces and any other character except ":<cr><lf>".
Name ends with the ":" character. after the
":" bundled class can be specified but it is
optional.
Bundled class - If present name must be
closed in a "( )" brackets. The name of the class
can contain spaces and strict format is not defined but
recommended format is (GeneralPurpose.VendorName.Name[.Subname]).
Class name usage depends on the application - its
documentation should include information about the classes
their applicability, functionality and so on.
- Record - record is a collection of the
record entries with the same name found in a particular
section.
- Record entry - is a line as:
(int)Record1=5
or
(string)Record10=Some string value
Every record entry defines a single value for the
record. Thus the following lines define a record MyRecord
with 3 values:
(int)MyRecord=1
(string)MyRecord=A string
(float)MyRecord=3.14
Value defined by the record entry can have a value
name:
(int)MyRecord[value_name]=3
This syntax is rarely used and if the part in the "[
]" brackets is omitted defined value is unnamed.
Record values defined by the record entries
have strict type specification defined in the "(
)" brackets placed before the name. There is no
default type thus every record entry must have a type
specified.
General record entry syntax can be generally described as:
(type_name)Record_name[Value_name]=Value
Where:
- type_name can
be one of the following type names:
int - 32-bit signed integer value
float - 32 bit floating point value
double - 64 bit floating point value
string - string - can not contain new
line or line feed characters
int64 - 64 bit signed integer value
More types are available (binary blocks for example)
but are not used in configuration files.
- Record_name -
Assigns the record entry to the record with the name
given. May contain any characters except
"=[]", new line and line feed.
- Value_name -
optional. If present must be closed in "[ ]"
brackets. May contain the same characters as the
Record_name. Defines a name for the value - meaningful
only if the component using the record expects it.
- Value - Value
defined with the record entry. Syntax depends on the
type of the entry.
There are several extended syntax forms
not described here because they are not used in the configuration
files. Below two samples are listed. They do not apply to any
product but demonstrate the configurations syntax:
Sample 1:
{ First section:
(int)User=1
(string)User=Smith
{ Logon: (LogonScreen.ACME.SimpleLogon)
(int)top=100
(int)left=200
} Logon;
} First section;
Suppose this section defines settings for some authentication
procedure. Logon subsection is used to define what component will
display the "Logon" dialog and contains values used by
the component to determine the position of the dialog. External
section - First Section contains two record entries for the record
"User". Suppose that the integer value is used to
determine if the password will be kept in some cache and the
string value defines the user name.
Sample 2:
{ Object101: (Shape.ACME.Rectangle)
(int)width=100
(int)height=200
(string)Text=Shape 101
{ Brush: (Brushe.ACME.OneColor)
(int)Red=255
(int)Green=255
(int)Blue=0
} Brush;
{ Pen: (Pen.ACME.Solid)
(int)thickness=6
(int)Red=80
(int)Green=128
(int)Blue=64
} Pen;
{ TextSettings: (TextWriter.ACME.Default)
(int)Size=10
(int)Bold=1
(int)Italic=0
(string)Face=Arial
(string)Face=Times
} TextSettings;
} Object101;
Imagine this section represents a graphic object in a graphical
application. Every subsection defines component responsible for a
particular actions as frame drawing or filling and holds the
settings required by the component. For example TextSettings
section may represent the component that displays the text in the
drawing object. It has two Face record entries. Thus there is a
record named Face with list of the fonts that can be used in the
preferred order.
The order of the entries can be important depending on the way
the application uses them. Entries (Sections, records, values)
appear in memory in the order they are found in the file.
|