gmSCRegistryClass
- Mark Juras
Owned by Mark Juras
The Registry Service Class
The service class Registry maintains a directory which stores named settings and options for a running application. It contains a simple hierarchical set of name-value pairs stored under the root symbol IMSLIB.Registry. The use and content of these name-value pairs is entirely up to the applications. The Registry class is introduced to tidy up the profusion of application specific startup-files and own-coded runtime options that tend to propagate in language processing applications. Though the design of the registry is based on the "Windows registry" its content consists simply of string and text stream types. It has no internal value types and has no system defined content beyond the value of its root symbol which is defined privately within the class implementation. Any storage area may contain registry information. Its intent is to simplify the design of complex applications without itself introducing new complexity or extensive machinery. A "location" in the registry is a nonterminal-node in the storage area of that contains a list of unique names each of which is assigned a non-empty string or text stream value. Note that at given level in the tree, a location may well have a value associated with it thus, being both a pair and the parent of a list of pairs.The method Registry_Declare
Prototypeint Registry_Declare(CONST char* location,char* name,char* value);
Parameter | Description |
ocation | Contains the full identifier of the location of the name-value pair. This identifier consists of the names of nonterminal nodes above the pair, separated by periods. The node identifiers themselves should be simple identifiers beginning with a letter and containing only letters and numbers. |
name | Contains the name of the pair to be posted to the terminal location node. It may have any content. If a given pair is intended to be unique within a given location, then its name must be unique within that location only. If the registry, or the location, or the name do not yet exist, in the storage area then they are created. If they do all exist, then the previous value associated with the name is lost. |
value | Contains the value string to be associated with the name. It may be NULL which indicates that this name is to have a text stream as its associated value. |
If all goes well, the method returns root offset in storage of the name-value pair; else it returns zero.
The method Registry_GetLocation
Prototypeint Registry_GetLocation(CONST char* identifier);
Parameter | Description |
identifier | Contains the full identifier of the location of a name-value pair. This identifier consists of the names of nonterminal nodes above the pair, separated by periods. The node identifiers themselves should be simple identifiers beginning with a letter and containing only letters and numbers. |
If the specified location does not exist, then a zero is returned; else the root offset of the location is returned. Note that the pairs are then simply the children of this location.
The method Registry_GetNameRoot
Prototypeint Registry_GetNameRoot(CONST char* location,char* name);
Parameter | Description |
location | Contains the full identifier of the location of the name pair. This identifier consists of the names of nonterminal nodes above the pair, separated by periods. The node identifiers themselves should be simple identifiers beginning with a letter and containing only letters and numbers. |
name | Contains the name to be found. |
If the name is not defined at the specified location a zero is returned; else its root offset is returned. Note that this is the same value as returned by Registry_Declare() when the name was first declared.
The method Registry_GetNameValue
Prototypeint Registry_GetNameValue(CONST char* location,char* name,char* value);
Parameter | Description |
location | Contains the full identifier of the location of the name value pair. This identifier consists of the names of nonterminal nodes above the pair, separated by periods. The node identifiers themselves should be simple identifiers beginning with a letter and containing only letters and numbers. |
name | Contains the name of the pair. It may have any content. |
value | Receives the value of the pair in null-terminated form. If the specified pair was not found or if that pair has no value associated with it, then the entry content of this parameter is not changed. |
If there is no value associated with the pair either because the pair does not exist or because it has no value, then a zero is returned. If there is a string value associated with the pair, then its content is stored in the value property and its length is the return value. If there is a text stream associated with the name, then the negative of its root offset is returned.
The method Registry_GetTextValue
Prototypeint Registry_GetTextValue(int pairRoot);
Parameter | Description |
pairRoot | Specifies the root offset of the pair as returned by the method Registry_Declare. |
The method returns the root offset of the text stream associated with the pair.
The method Registry_RuntimeGuid
Prototypeint Registry_RuntimeGuid(char* guidName,char* buffer);
Parameter | Description |
guidName | Contains the source name for the guid. It may be NULL. |
buffer | Receives the guid associated with the specified source name. |
This method attempts to find a Guid type entry whose source matches guidName. If found, the target value is the guid to be used. If not found a new guid is generated via the operating system and returned.
The method Registry_SetTextValue
Prototypevoid Registry_SetTextValue(int pairRoot,int textRoot);
Parameter | Description |
pairRoot | Specifies the root offset of the pair as returned by the method Registry_Declare. |
textRoot | Specifies the root offset of the text stream to be associated with the pair. |
Table of Contents