Query and edit settings. More...
#include <bpssettings.h>
Public Types | |
| enum | Scope { NoScope = 0x00000000, LocalUserScope = 0x00000001, LocalInstallScope = 0x00000002, LocalSystemScope = 0x00000004, CentralUserScope = 0x00000010, CentralSystemScope = 0x00000020, LocalScopes = LocalUserScope | LocalInstallScope | LocalSystemScope, CentralScopes = CentralUserScope | CentralSystemScope, AllScopes = LocalScopes | CentralScopes } |
| Scope under which the settings are located. More... | |
Public Member Functions | |
| QStringList | allGroups (Scopes aSearchedScopes=(Scopes) AllScopes) const |
| Find all groups within the currently opened path. | |
| QStringList | allKeys (Scopes aSearchedScopes=(Scopes) AllScopes) const |
| Find all keys within the currently opened path. | |
| BpsSettings (BpsDatastore *aDatastore, Scope aScope=BpsSettings::LocalUserScope, QObject *aParent=0) | |
| Constructor for the BpsSettings objects. | |
| BpsSettings (Scope aScope=BpsSettings::LocalUserScope, QObject *aParent=0) | |
| Constructor for the BpsSettings objects. | |
| void | close () |
| Close the latest opened path. | |
| void | closeAll () |
| Close all currently opened paths. | |
| QVariant | findValue (const QString &aKey, const QVariant &aDefValue=QVariant(), Scopes aSearchedScopes=(Scopes) AllScopes) const |
| Find a value within the currently opened path. | |
| bool | groupExists (const QString &aGroup) const |
| Check if the group exists in the current scope. | |
| QStringList | groups () const |
| Query a list of all existing groups within the currently opened path. | |
| Scope | groupScope (const QString &aName, Scopes aSearchedScopes=(Scopes) AllScopes) const |
| Find the first scope of a group within the currently opened path. | |
| bool | keyExists (const QString &aKey) const |
| Check if the key exists in the current scope. | |
| QStringList | keys () const |
| Query a list of all existing keys in the currently opened group. | |
| void | open (const QString &aPath) |
| Open a new path. | |
| void | removeGroup (const QString &aName) |
| Remove a group from the currently opened path. | |
| void | removeKey (const QString &aKey) |
| Remove a key. | |
| QString | root () const |
| Get the current root. | |
| Scope | scope () const |
| void | setRoot (const QString &aRoot) |
| Set a new root. | |
| void | setScope (Scope aScope) |
| Change the current scope. | |
| void | setValue (const QString &aKey, const QVariant &aValue) |
| Set a value within the currently opened path. | |
| void | setValueMap (const QVariantMap &aMap) |
| Removes any previously existing keys from the currently opened path and scope, and adds the values in the given map instead. | |
| QVariant | value (const QString &aKey, const QVariant &aDefValue=QVariant()) const |
| Get a value within the currently opened path. | |
| QVariantMap | valueMap (Scopes aSearchedScopes=(Scopes) AllScopes) const |
| Find all keys and values within the currently opened path. | |
Query and edit settings.
| enum BpsSettings::Scope |
Scope under which the settings are located.
The term "local machine" refers to the user workstation in fat client environments, however in terminal server environments it is the terminal server (citrix for example).
| 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 |
| CentralUserScope |
Central settings for the current bps user. The settings are located in the database table t_usersettings. |
| CentralSystemScope |
Central settings for all bps users. The settings are located in the database table t_settings. |
| LocalScopes |
All local scopes. Use only for parameters of type Scopes. |
| CentralScopes |
All central scopes. Use only for parameters of type Scopes. |
| AllScopes |
All scopes. Use only for parameters of type Scopes. |
| BpsSettings::BpsSettings | ( | BpsDatastore * | aDatastore, |
| Scope | aScope = BpsSettings::LocalUserScope, |
||
| QObject * | aParent = 0 |
||
| ) |
Constructor for the BpsSettings objects.
Use this constructor when directly accessing central settings, or the settings chain shall be searched up to CentralSystemScope by findValue().
| [in] | aDatastore | The opened database connection. |
| [in] | aScope | The scope to operate on. |
| [in] | aParent | Pointer to parent object. |
| BpsSettings::BpsSettings | ( | Scope | aScope = BpsSettings::LocalUserScope, |
| QObject * | aParent = 0 |
||
| ) |
Constructor for the BpsSettings objects.
Use this constructor when accessing local setting only.
| [in] | aScope | The scope to operate on. |
| [in] | aParent | Pointer to parent object. |
| QStringList BpsSettings::allGroups | ( | Scopes | aSearchedScopes = (Scopes) AllScopes | ) | const |
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.
| [in] | aSearchedScopes | Mask of scopes that shall be included in the search. |
| QStringList BpsSettings::allKeys | ( | Scopes | aSearchedScopes = (Scopes) AllScopes | ) | const |
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.
| [in] | aSearchedScopes | Mask of scopes that shall be included in the search. |
| void BpsSettings::closeAll | ( | ) |
Close all currently opened paths.
The current location is set back to the root.
| QVariant BpsSettings::findValue | ( | const QString & | aKey, |
| const QVariant & | aDefValue = QVariant(), |
||
| Scopes | aSearchedScopes = (Scopes) AllScopes |
||
| ) | const |
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.
| [in] | aKey | The key of the value. |
| [in] | aDefValue | Default value to return in case the key does not exist. |
| [in] | aSearchedScopes | Mask of scopes that shall be included in the search. |
| bool BpsSettings::groupExists | ( | const QString & | aGroup | ) | const |
Check if the group exists in the current scope.
The group name compare is done case-insensitive, so the method is equivalent to groups().contains(aGroup, Qt::CaseInsensitive).
| [in] | aGroup | The group to check. |
| QStringList BpsSettings::groups | ( | ) | const |
Query a list of all existing groups within the currently opened path.
| Scope BpsSettings::groupScope | ( | const QString & | aName, |
| Scopes | aSearchedScopes = (Scopes) AllScopes |
||
| ) | const |
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. |
| bool BpsSettings::keyExists | ( | const QString & | aKey | ) | const |
Check if the key exists in the current scope.
The key name compare is done case-insensitive, so the method is equivalent to keys().contains(aKey, Qt::CaseInsensitive).
| [in] | aKey | The key to check. |
| QStringList BpsSettings::keys | ( | ) | const |
Query a list of all existing keys in the currently opened group.
| void BpsSettings::open | ( | const QString & | aPath | ) |
Open a new path.
| [in] | aPath | The path to open, relative to the currently opened path. |
| void BpsSettings::removeGroup | ( | const QString & | aName | ) |
Remove a group from the currently opened path.
In case no group of the given name exists, nothing happens.
| [in] | aName | The name of the group. Name compare is case-insensitive. |
| void BpsSettings::removeKey | ( | const QString & | aKey | ) |
Remove a key.
| [in] | aKey | Name of the key to remove. Key names are case insensitive. |
| QString BpsSettings::root | ( | ) | const |
Get the current root.
The root is prepended to all paths. Initially the root is empty.
| Scope BpsSettings::scope | ( | ) | const |
| void BpsSettings::setRoot | ( | const QString & | aRoot | ) |
Set a new root.
The root is prepended to all paths. Initially the root is empty.
| [in] | aRoot | The new root to set. |
| void BpsSettings::setScope | ( | Scope | aScope | ) |
Change the current scope.
| [in] | aScope | The new scope to be set. |
| void BpsSettings::setValue | ( | const QString & | aKey, |
| const QVariant & | aValue | ||
| ) |
Set a value within the currently opened path.
| [in] | aKey | The key for the value. |
| [in] | aValue | The value to save under this key. |
| void BpsSettings::setValueMap | ( | const QVariantMap & | aMap | ) |
Removes any previously existing keys from the currently opened path and scope, and adds the values in the given map instead.
| [in] | aMap | The map of key/value pairs to set. |
| QVariant BpsSettings::value | ( | const QString & | aKey, |
| const QVariant & | aDefValue = QVariant() |
||
| ) | const |
Get a value within the currently opened path.
| [in] | aKey | The key of the value. |
| [in] | aDefValue | Default value to return in case the key does not exist. |
| QVariantMap BpsSettings::valueMap | ( | Scopes | aSearchedScopes = (Scopes) AllScopes | ) | const |
Find all keys and values within the currently opened path.
The scope chain is searched up to CentralSystemScope for values. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope. This map contains basically all tha key/value pairs addressed by allKeys().
| [in] | aSearchedScopes | Mask of scopes that shall be included in the search. |