BPS C++ API  2.24.4
BpsSettings Class Reference

Query and edit settings. More...

#include <bpssettings.h>

+ Inheritance diagram for BpsSettings:

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. More...
 
QStringList allKeys (Scopes aSearchedScopes=(Scopes) AllScopes) const
 Find all keys within the currently opened path. More...
 
 BpsSettings (BpsDatastore *aDatastore, Scope aScope=BpsSettings::LocalUserScope, QObject *aParent=nullptr)
 Constructor for the BpsSettings objects. More...
 
 BpsSettings (Scope aScope=BpsSettings::LocalUserScope, QObject *aParent=nullptr)
 Constructor for the BpsSettings objects. More...
 
void close ()
 Close the latest opened path.
 
void closeAll ()
 Close all currently opened paths. More...
 
QVariant findValue (const QString &aKey, const QVariant &aDefValue=QVariant(), Scopes aSearchedScopes=(Scopes) AllScopes) const
 Find a value within the currently opened path. More...
 
bool groupExists (const QString &aGroup) const
 Check if the group exists in the current scope. More...
 
QStringList groups () const
 Query a list of all existing groups within the currently opened path. More...
 
Scope groupScope (const QString &aName, Scopes aSearchedScopes=(Scopes) AllScopes) const
 Find the first scope of a group within the currently opened path. More...
 
bool keyExists (const QString &aKey) const
 Check if the key exists in the current scope. More...
 
QStringList keys () const
 Query a list of all existing keys in the currently opened group. More...
 
void open (const QString &aPath)
 Open a new path. More...
 
void removeGroup (const QString &aName)
 Remove a group from the currently opened path. More...
 
void removeKey (const QString &aKey)
 Remove a key. More...
 
QString root () const
 Get the current root. More...
 
Scope scope () const
 
void setRoot (const QString &aRoot)
 Set a new root. More...
 
void setScope (Scope aScope)
 Change the current scope. More...
 
void setValue (const QString &aKey, const QVariant &aValue)
 Set a value within the currently opened path. More...
 
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. More...
 
QVariant value (const QString &aKey, const QVariant &aDefValue=QVariant()) const
 Get a value within the currently opened path. More...
 
QVariantMap valueMap (Scopes aSearchedScopes=(Scopes) AllScopes) const
 Find all keys and values within the currently opened path. More...
 
- Public Member Functions inherited from QObject
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
 QObject (QObject *parent)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Query and edit settings.

Member Enumeration Documentation

◆ 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).

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

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.

Constructor & Destructor Documentation

◆ BpsSettings() [1/2]

BpsSettings::BpsSettings ( BpsDatastore aDatastore,
Scope  aScope = BpsSettings::LocalUserScope,
QObject aParent = nullptr 
)

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().

Parameters
aDatastoreThe opened database connection.
aScopeThe scope to operate on.
aParentPointer to parent object.

◆ BpsSettings() [2/2]

BpsSettings::BpsSettings ( Scope  aScope = BpsSettings::LocalUserScope,
QObject aParent = nullptr 
)

Constructor for the BpsSettings objects.

Use this constructor when accessing local setting only.

Parameters
aScopeThe scope to operate on.
aParentPointer to parent object.

Member Function Documentation

◆ allGroups()

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.

Parameters
aSearchedScopesMask of scopes that shall be included in the search.
Returns
A list of the found group names.

◆ allKeys()

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.

Parameters
aSearchedScopesMask of scopes that shall be included in the search.
Returns
A list of the found key names.

◆ closeAll()

void BpsSettings::closeAll ( )

Close all currently opened paths.

The current location is set back to the root.

◆ findValue()

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.

Parameters
aKeyThe key of the value.
aDefValueDefault value to return in case the key does not exist.
aSearchedScopesMask of scopes that shall be included in the search.
Returns
The keys value, or the provided default value in case the key does not exist.

◆ groupExists()

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).

Parameters
aGroupThe group to check.
Returns
True if the group exists, false if not.

◆ groups()

QStringList BpsSettings::groups ( ) const

Query a list of all existing groups within the currently opened path.

Returns
All child groups at the currently opened path.

◆ groupScope()

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.

Parameters
aSearchedScopesMask of scopes that shall be included in the search.
aNameThe name of the group. Name compare is case-insensitive.
Returns
Scope of the first group found, or NoScope if no such group found.

◆ keyExists()

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).

Parameters
aKeyThe key to check.
Returns
True if the key exists, false if not.

◆ keys()

QStringList BpsSettings::keys ( ) const

Query a list of all existing keys in the currently opened group.

Returns
All keys within the currently opened path.

◆ open()

void BpsSettings::open ( const QString aPath)

Open a new path.

Parameters
aPathThe path to open, relative to the currently opened path.

◆ removeGroup()

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.

Parameters
aNameThe name of the group. Name compare is case-insensitive.

◆ removeKey()

void BpsSettings::removeKey ( const QString aKey)

Remove a key.

Parameters
aKeyName of the key to remove. Key names are case insensitive.

◆ root()

QString BpsSettings::root ( ) const

Get the current root.

The root is prepended to all paths. Initially the root is empty.

Returns
The current root.

◆ scope()

Scope BpsSettings::scope ( ) const
Returns
The current scope.

◆ setRoot()

void BpsSettings::setRoot ( const QString aRoot)

Set a new root.

The root is prepended to all paths. Initially the root is empty.

Parameters
aRootThe new root to set.

◆ setScope()

void BpsSettings::setScope ( Scope  aScope)

Change the current scope.

Parameters
aScopeThe new scope to be set.

◆ setValue()

void BpsSettings::setValue ( const QString aKey,
const QVariant aValue 
)

Set a value within the currently opened path.

Parameters
aKeyThe key for the value.
aValueThe value to save under this key.

◆ setValueMap()

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.

Parameters
aMapThe map of key/value pairs to set.

◆ value()

QVariant BpsSettings::value ( const QString aKey,
const QVariant aDefValue = QVariant() 
) const

Get a value within the currently opened path.

Parameters
aKeyThe key of the value.
aDefValueDefault value to return in case the key does not exist.
Returns
The keys value, or the provided default value in case the key does not exist.

◆ valueMap()

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().

Parameters
aSearchedScopesMask of scopes that shall be included in the search.
Returns
A map of all key/value pairs in the currently opened path.

The documentation for this class was generated from the following file: