refs #659 Read-only versions of cache value access classes.

This commit is contained in:
Mathew Sutcliffe
2016-06-05 17:10:26 +01:00
parent a2b0602c53
commit aefef81cd7
2 changed files with 42 additions and 0 deletions

View File

@@ -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.
*/