diff options
Diffstat (limited to 'common/domain')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 11 | ||||
-rw-r--r-- | common/domain/applicationdomaintype.h | 8 |
2 files changed, 19 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 | { |
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 986dd6d..27a7954 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -257,6 +257,13 @@ public: | |||
257 | bool hasProperty(const QByteArray &key) const; | 257 | bool hasProperty(const QByteArray &key) const; |
258 | 258 | ||
259 | QVariant getProperty(const QByteArray &key) const; | 259 | QVariant getProperty(const QByteArray &key) const; |
260 | QVariantList getCollectedProperty(const QByteArray &key) const; | ||
261 | |||
262 | template <typename Property> | ||
263 | QVariantList getCollectedProperty() const | ||
264 | { | ||
265 | return getCollectedProperty(Property::name); | ||
266 | } | ||
260 | 267 | ||
261 | /** | 268 | /** |
262 | * Set a property and record a changed property | 269 | * Set a property and record a changed property |
@@ -281,6 +288,7 @@ public: | |||
281 | bool isAggregate() const; | 288 | bool isAggregate() const; |
282 | QVector<QByteArray> aggregatedIds() const; | 289 | QVector<QByteArray> aggregatedIds() const; |
283 | QVector<QByteArray> &aggregatedIds(); | 290 | QVector<QByteArray> &aggregatedIds(); |
291 | int count() const; | ||
284 | 292 | ||
285 | private: | 293 | private: |
286 | friend QDebug operator<<(QDebug, const ApplicationDomainType &); | 294 | friend QDebug operator<<(QDebug, const ApplicationDomainType &); |