mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
refs #659 Read-only versions of cache value access classes.
This commit is contained in:
@@ -356,6 +356,26 @@ namespace BlackMisc
|
||||
CStatusMessage save() = delete;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Class template for read-only access to a specific value in the CDataCache.
|
||||
* \tparam Trait A subclass of BlackMisc::CDataTrait that identifies the value's key and other metadata.
|
||||
*/
|
||||
template <typename Trait>
|
||||
class CDataReadOnly : public BlackMisc::CData<Trait>
|
||||
{
|
||||
public:
|
||||
//! Inherited constructor.
|
||||
using CData<Trait>::CData;
|
||||
|
||||
//! Deleted mutators.
|
||||
//! @{
|
||||
CStatusMessage set(const typename Trait::type &value, qint64 timestamp = 0) = delete;
|
||||
CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete;
|
||||
CStatusMessage setDefault() = delete;
|
||||
void renewTimestamp(qint64 timestamp) = delete;
|
||||
//! @}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Base class for traits to be used as template argument to BlackMisc::CData.
|
||||
*/
|
||||
|
||||
@@ -86,6 +86,28 @@ namespace BlackMisc
|
||||
QString getFilename() const { return CSettingsCache::filenameForKey(this->getKey()); }
|
||||
};
|
||||
|
||||
/*!
|
||||
* Class template for accessing a specific value in the CSettingsCache.
|
||||
* \tparam Trait A subclass of BlackMisc::CSettingTrait that identifies the value's key and other metadata.
|
||||
*/
|
||||
template <typename Trait>
|
||||
class CSettingReadOnly : public BlackMisc::CSetting<Trait>
|
||||
{
|
||||
public:
|
||||
//! Inherited constructor.
|
||||
using CSetting<Trait>::CSetting;
|
||||
|
||||
//! Deleted mutators.
|
||||
//! @{
|
||||
CStatusMessage set(const typename Trait::type &value, qint64 timestamp = 0) = delete;
|
||||
CStatusMessage setAndSave(const typename Trait::type &value, qint64 timestamp = 0) = delete;
|
||||
CStatusMessage save() = delete;
|
||||
CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete;
|
||||
CStatusMessage setAndSaveProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete;
|
||||
CStatusMessage setDefault() = delete;
|
||||
//! @}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Base class for traits to be used as template argument to BlackMisc::CSetting.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user