diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-22 14:55:16 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-22 14:55:16 +0100 |
commit | 7748c2a5c1cc29a8c69ea051174e31b02af4a208 (patch) | |
tree | 80e094dbc83b0fcff3dc7996d5159a349b57ea3f /common/domain/applicationdomaintype.cpp | |
parent | 78a299efd28792364b518e954cc3ae83769e06ab (diff) | |
download | sink-7748c2a5c1cc29a8c69ea051174e31b02af4a208.tar.gz sink-7748c2a5c1cc29a8c69ea051174e31b02af4a208.zip |
Some helper functions to avoid hardcoding collected property names
Diffstat (limited to 'common/domain/applicationdomaintype.cpp')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 2a7f948..ff2990d 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp | |||
@@ -212,6 +212,12 @@ QVariant ApplicationDomainType::getProperty(const QByteArray &key) const | |||
212 | return mAdaptor->getProperty(key); | 212 | return mAdaptor->getProperty(key); |
213 | } | 213 | } |
214 | 214 | ||
215 | QVariantList ApplicationDomainType::getCollectedProperty(const QByteArray &key) const | ||
216 | { | ||
217 | Q_ASSERT(mAdaptor); | ||
218 | return mAdaptor->getProperty(key + "Collected").toList(); | ||
219 | } | ||
220 | |||
215 | void ApplicationDomainType::setProperty(const QByteArray &key, const QVariant &value) | 221 | void ApplicationDomainType::setProperty(const QByteArray &key, const QVariant &value) |
216 | { | 222 | { |
217 | Q_ASSERT(mAdaptor); | 223 | Q_ASSERT(mAdaptor); |
@@ -283,6 +289,11 @@ QVector<QByteArray> &ApplicationDomainType::aggregatedIds() | |||
283 | return mAggreatedIds; | 289 | return mAggreatedIds; |
284 | } | 290 | } |
285 | 291 | ||
292 | int ApplicationDomainType::count() const | ||
293 | { | ||
294 | return qMax(mAggreatedIds.size(), 1); | ||
295 | } | ||
296 | |||
286 | SinkResource::SinkResource(const QByteArray &identifier) | 297 | SinkResource::SinkResource(const QByteArray &identifier) |
287 | : ApplicationDomainType("", identifier, 0, QSharedPointer<BufferAdaptor>(new MemoryBufferAdaptor())) | 298 | : ApplicationDomainType("", identifier, 0, QSharedPointer<BufferAdaptor>(new MemoryBufferAdaptor())) |
288 | { | 299 | { |