|
swift
|
Class template for accessing a specific value in the CSettingsCache. More...
#include <settingscache.h>
Public Member Functions | |
| template<typename T> | |
| CSetting (T *owner) | |
| Constructor. | |
| template<typename T, typename F> | |
| CSetting (T *owner, F slot) | |
| Constructor. | |
| CStatusMessage | setDefault () |
| Reset the setting to its default value. | |
| auto | getDefault () const |
| Gets the default value. | |
| bool | isDefault () const |
| Is default value? | |
| QString | getFilename () const |
| Return the file that is used for persistence for this value. | |
| Public Member Functions inherited from swift::misc::CCached< Trait::type > | |
| CCached (CValueCache *cache, const QString &key, const QString &name, U *owner) | |
| Constructor. | |
| void | setNotifySlot (F slot) |
| Set a callback to be called when the value is changed by another source. | |
| const Trait::type & | getThreadLocal () const |
| Read the current value. | |
| Trait::type | get () const |
| Get a copy of the current value. | |
| CStatusMessage | set (const Trait::type &value, qint64 timestamp=0) |
| Write a new value. Must be called from the thread in which the owner lives. | |
| CStatusMessage | setAndSave (const Trait::type &value, qint64 timestamp=0) |
| Write and save in the same step. Must be called from the thread in which the owner lives. | |
| CStatusMessage | save () |
| Save using the currently set value. Must be called from the thread in which the owner lives. | |
| CStatusMessage | setProperty (CPropertyIndexRef index, const CVariant &value, qint64 timestamp=0) |
| Write a property of the value. Must be called from the thread in which the owner lives. | |
| CStatusMessage | setAndSaveProperty (CPropertyIndexRef index, const CVariant &value, qint64 timestamp=0) |
| Write a property and save in the same step. Must be called from the thread in which the owner lives. | |
| bool | isOwnerThread () const |
| Is current thread the owner thread, so CCached::set is safe. | |
| const QString & | getKey () const |
| Get the key string of this value. | |
| QDateTime | getTimestamp () const |
| Return the time when this value was updated. | |
| qint64 | getTimestampMsSinceEpoch () const |
| Return the time when this value was updated. | |
| qint64 | lastUpdatedAge () const |
| How old is that cache (ms)? | |
| bool | isSaved () const |
| Return true if this value was already saved. | |
| bool | isSaving () const |
| Return true if this value is currently saving. | |
| bool | isInitialized () const |
| Can be false if key contains OwnerName% and owner's objectName was empty. | |
| CCached & | operator= (const CCached &)=delete |
| Deleted copy assignment operator. | |
Class template for accessing a specific value in the CSettingsCache.
| Trait | A subclass of swift::misc::TSettingTrait that identifies the value's key and other metadata. |
Definition at line 67 of file settingscache.h.
|
inline |
Constructor.
| owner | Will be the parent of the internal QObject used to access the value. |
Definition at line 73 of file settingscache.h.
|
inline |
Constructor.
| owner | Will be the parent of the internal QObject used to access the value. |
| slot | Slot to call when the value is modified by another object. Must be a void, non-const member function of the owner. |
Definition at line 88 of file settingscache.h.
|
inline |
Gets the default value.
Definition at line 97 of file settingscache.h.
|
inline |
Return the file that is used for persistence for this value.
Definition at line 103 of file settingscache.h.
|
inline |
Is default value?
Definition at line 100 of file settingscache.h.
|
inline |
Reset the setting to its default value.
Definition at line 94 of file settingscache.h.