refs #684 Added parametrised cache value key strings.

This commit is contained in:
Mathew Sutcliffe
2016-09-09 23:21:00 +01:00
committed by Roland Winklmeier
parent aeb15ea7be
commit 898b8e4078
3 changed files with 35 additions and 7 deletions

View File

@@ -433,6 +433,27 @@ namespace BlackMisc
Private::CValuePage::Element &m_element; //!< \private
};
/*!
* Helper class for generating cache key variations from a key template.
*/
class BLACKMISC_EXPORT CValueCacheCategory : public QObject
{
Q_OBJECT
public:
//! Constructor.
CValueCacheCategory(QObject *parent, const QString &category) : QObject(parent), m_category(category)
{
Q_ASSERT_X(parent->findChildren<CValueCacheCategory *>().size() == 1, Q_FUNC_INFO, "Only one CValueCacheCategory per object allowed");
}
//! Get category string.
const QString &getCategory() const { return m_category; }
private:
const QString m_category;
};
/*!
* RAII object returned by CValueCache::batchChanges. Applies deferred changes when it is destroyed.
*/