Create and query settings on the local maching and in the central datastore. More...
Public Types | |
enum | Scope { NoScope = 0x00000000 , LocalUserScope = 0x00000001 , LocalInstallScope = 0x00000002 , LocalSystemScope = 0x00000004 , LocalScopes = 0x00000007 , CentralUserScope = 0x00000010 , CentralSystemScope = 0x00000020 , CentralScopes = 0x00000030 , AllScopes = 0x00000037 } |
Operating scope. More... | |
Public Member Functions | |
Array | allGroups (Scope aSearchedScopes=AllScopes) |
Find all groups within the currently opened path. More... | |
Array | allKeys (Scope aSearchedScopes=AllScopes) |
Find all keys within the currently opened path. More... | |
void | close () |
Close the latest opened path. More... | |
void | closeAll () |
Close all currently opened paths. More... | |
Mixed | findValue (String aKey, Mixed aDefValue, Scope aSearchedScopes=AllScopes) |
Find a value within the currently opened path. More... | |
Boolean | groupExists (String aGroup) |
Check if the group exists in the current scope. More... | |
Array | groups () |
Query a list of all existing groups within the currently opened path. More... | |
Scope | groupScope (String aName, Scope aSearchedScopes=AllScopes) |
Find the first scope of a group within the currently opened path. More... | |
Boolean | keyExists (String aKey) |
Check if the key exists in the current scope. More... | |
Array | keys () |
Query a list of all existing keys in the currently opened group. More... | |
void | open (String aPath) |
Open a new path. More... | |
void | removeGroup (String aName) |
Remove a group from the currently opened path. More... | |
void | removeKey (String aKey) |
Remove a key. More... | |
Settings (Datastore aDatastore, Scope aScope=LocalScope) | |
Constructor for the Settings objects. More... | |
Settings (Scope aScope=LocalScope) | |
Overloaded constructor for local only access at scopes LocalUserScope, LocalInstallScope, LocalSystemScope. More... | |
void | setValue (String aKey, Mixed aValue) |
Set a value within the currently opened path. More... | |
Mixed | value (String aKey, Mixed aDefValue) |
Get a value within the currently opened path. More... | |
Properties | |
String | root |
The current root. More... | |
Scope | scope |
The current scope. More... | |
Create and query settings on the local maching and in the central datastore.
enum bps::Settings::Scope |
Operating scope.
Enumerator | |
---|---|
NoScope | No valid scope. Used for example as result by groupScope(). |
LocalUserScope | Settings of the current operating system user on the local machine. On windows this is in the registry under HKCU/Software/IBK Software AG/BPS2 |
LocalInstallScope | Settings of the software installation on the locale machine. On windows this is the file bps.conf in the same directory as the executed program. For example when the currently executed program is located in C:\Programs\IBK Software AG\BPS2\bin, the settings are in file C:\Programs\IBK Software AG\BPS2\bin\bps.conf |
LocalSystemScope | Settings valid for all users on the local machine. On windows this is in the registry under HKLM/Software/IBK Software AG/BPS2 |
LocalScopes | All local scopes. |
CentralUserScope | Central settings for the current bps user. The settings are located in the database table t_settings. |
CentralSystemScope | Central settings for all bps users. The settings are located in the database table t_settings. |
CentralScopes | All central scopes. |
AllScopes | All scopes. |
Constructor for the Settings objects.
When the constructor is called with a first argument of type bps.Datastore, the object can access both the settings in the central datastore as well as those on the local machine. When no Datastore parameter is passed, only settings on the local machine can be accessed.
The scope is used absolutely in most methods, however in findValue(), allGroups() and allKeys() it is used as the starting scope to search through the following chain bottom up:
LocalUserScope, LocalInstallScope, LocalSystemScope, CentralUserScope, CentralSystemScope.
aDatastore | A open database connection. |
aScope | The scope to operate on. |
bps::Settings::Settings | ( | Scope | aScope = LocalScope | ) |
Overloaded constructor for local only access at scopes LocalUserScope, LocalInstallScope, LocalSystemScope.
aScope | The scope to operate on. |
Find all groups within the currently opened path.
Search begins at the current scope and goes up to CentralSystemScope. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope. Group names found at multiple scopes are merged into one entry.
aSearchedScopes | Mask of scopes that shall be included in the search. |
Find all keys within the currently opened path.
Search begins at the current scope and goes up to CentralSystemScope. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope. Key names found at multiple scopes are merged into one entry.
aSearchedScopes | Mask of scopes that shall be included in the search. |
void bps::Settings::close | ( | ) |
Close the latest opened path.
void bps::Settings::closeAll | ( | ) |
Close all currently opened paths.
The current location is set back to the root.
Find a value within the currently opened path.
If the value is not found in the current scope, the scope chain is searched up to CentralSystemScope for such a value. When still not found, the default will be returned. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope.
aKey | The key of the value. |
aDefValue | Default value to return in case the key does not exist. |
aSearchedScopes | Mask of scopes that shall be included in the search. |
Boolean bps::Settings::groupExists | ( | String | aGroup | ) |
Check if the group exists in the current scope.
The group name compare is done case-insensitive.
[in] | aGroup | The group to check. |
Array bps::Settings::groups | ( | ) |
Query a list of all existing groups within the currently opened path.
Find the first scope of a group within the currently opened path.
Search begins at the current scope and goes up to CentralSystemScope. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope.
[in] | aSearchedScopes | Mask of scopes that shall be included in the search. |
[in] | aName | The name of the group. Name compare is case-insensitive. |
Boolean bps::Settings::keyExists | ( | String | aKey | ) |
Check if the key exists in the current scope.
The key name compare is done case-insensitive.
[in] | aKey | The key to check. |
Array bps::Settings::keys | ( | ) |
Query a list of all existing keys in the currently opened group.
void bps::Settings::open | ( | String | aPath | ) |
void bps::Settings::removeGroup | ( | String | aName | ) |
Remove a group from the currently opened path.
In case no group of the given name exists, nothing happens.
aName | The name of the group. Name comparisation is case-insensitive. |
void bps::Settings::removeKey | ( | String | aKey | ) |
Remove a key.
aKey | Name of the key to remove. Key names are case insensitive. |
void bps::Settings::setValue | ( | String | aKey, |
Mixed | aValue | ||
) |
Set a value within the currently opened path.
aKey | The key for the value. |
aValue | The value to save under this key. |
Mixed bps::Settings::value | ( | String | aKey, |
Mixed | aDefValue | ||
) |
Get a value within the currently opened path.
aKey | The key of the value. |
aDefValue | Default value to return in case the key does not exist. |
|
readwrite |
The current root.
The root is prepended to all paths. Initially the root is empty.
|
readwrite |
The current scope.
Must be one of LocalUserScope, LocalInstallScope, LocalSystemScope, CentralUserScope or CentralSystemScope.