[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [sink/develop] common: Let the preprocessor repeat the types.
From:       Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date:       2016-12-09 15:45:48
Message-ID: E1cFNMq-0007L1-Ng () code ! kde ! org
[Download RAW message or body]

Git commit 5255876dde678aa7d5af8020d5836b1fc6c58fc7 by Christian Mollekopf.
Committed on 08/12/2016 at 14:24.
Pushed by cmollekopf into branch 'develop'.

Let the preprocessor repeat the types.

M  +12   -0    common/domain/applicationdomaintype.h
M  +4    -6    common/modelresult.cpp
M  +1    -4    common/resourcecontrol.cpp
M  +1    -6    common/store.cpp
M  +0    -5    common/synchronizer.cpp
M  +1    -7    common/test.cpp

https://commits.kde.org/sink/5255876dde678aa7d5af8020d5836b1fc6c58fc7

diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicat=
iondomaintype.h
index 1c0f208..be14513 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -482,6 +482,18 @@ class SINK_EXPORT TypeImplementation;
 #undef SINK_REFERENCE_PROPERTY
 #undef SINK_INDEX_PROPERTY
 =

+/**
+ * This macro can be used to instantiate templates for all domain types.
+ */
+#define SINK_REGISTER_TYPES() \
+    REGISTER_TYPE(Sink::ApplicationDomain::Event); \
+    REGISTER_TYPE(Sink::ApplicationDomain::Mail); \
+    REGISTER_TYPE(Sink::ApplicationDomain::Folder); \
+    REGISTER_TYPE(Sink::ApplicationDomain::SinkResource); \
+    REGISTER_TYPE(Sink::ApplicationDomain::SinkAccount); \
+    REGISTER_TYPE(Sink::ApplicationDomain::Identity); \
+
+
 Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType)
 Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType::Ptr)
 Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity)
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index 16e3857..ed77ebb 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -311,9 +311,7 @@ void ModelResult<T, Ptr>::modify(const Ptr &value)
     emit dataChanged(idx, idx);
 }
 =

-template class ModelResult<Sink::ApplicationDomain::Folder, Sink::Applicat=
ionDomain::Folder::Ptr>;
-template class ModelResult<Sink::ApplicationDomain::Mail, Sink::Applicatio=
nDomain::Mail::Ptr>;
-template class ModelResult<Sink::ApplicationDomain::Event, Sink::Applicati=
onDomain::Event::Ptr>;
-template class ModelResult<Sink::ApplicationDomain::SinkResource, Sink::Ap=
plicationDomain::SinkResource::Ptr>;
-template class ModelResult<Sink::ApplicationDomain::SinkAccount, Sink::App=
licationDomain::SinkAccount::Ptr>;
-template class ModelResult<Sink::ApplicationDomain::Identity, Sink::Applic=
ationDomain::Identity::Ptr>;
+#define REGISTER_TYPE(T) \
+    template class ModelResult<T, T::Ptr>; \
+
+SINK_REGISTER_TYPES()
diff --git a/common/resourcecontrol.cpp b/common/resourcecontrol.cpp
index f885deb..c1fbf06 100644
--- a/common/resourcecontrol.cpp
+++ b/common/resourcecontrol.cpp
@@ -158,9 +158,6 @@ KAsync::Job<void> ResourceControl::inspect(const Inspec=
tion &inspectionCommand)
 =

 #define REGISTER_TYPE(T) template KAsync::Job<void> ResourceControl::inspe=
ct<T>(const Inspection &);
 =

-REGISTER_TYPE(ApplicationDomain::Event);
-REGISTER_TYPE(ApplicationDomain::Mail);
-REGISTER_TYPE(ApplicationDomain::Folder);
-REGISTER_TYPE(ApplicationDomain::SinkResource);
+SINK_REGISTER_TYPES()
 =

 } // namespace Sink
diff --git a/common/store.cpp b/common/store.cpp
index 971cc7f..dd00bfe 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -414,11 +414,6 @@ QList<DomainType> Store::read(const Sink::Query &q)
     template T Store::readOne<T>(const Query &);                          =
        \
     template QList<T> Store::read<T>(const Query &);
 =

-REGISTER_TYPE(ApplicationDomain::Event);
-REGISTER_TYPE(ApplicationDomain::Mail);
-REGISTER_TYPE(ApplicationDomain::Folder);
-REGISTER_TYPE(ApplicationDomain::SinkResource);
-REGISTER_TYPE(ApplicationDomain::SinkAccount);
-REGISTER_TYPE(ApplicationDomain::Identity);
+SINK_REGISTER_TYPES()
 =

 } // namespace Sink
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index fec848f..d94eb43 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -484,10 +484,5 @@ bool Synchronizer::allChangesReplayed()
     template void Synchronizer::createOrModify(const QByteArray &bufferTyp=
e, const QByteArray &remoteId, const T &entity, const QHash<QByteArray, Sin=
k::Query::Comparator> &mergeCriteria); \
     template void Synchronizer::modify(const T &entity, const QByteArray &=
newResource, bool remove);
 =

-#define SINK_REGISTER_TYPES() \
-    REGISTER_TYPE(ApplicationDomain::Event); \
-    REGISTER_TYPE(ApplicationDomain::Mail); \
-    REGISTER_TYPE(ApplicationDomain::Folder); \
-
 SINK_REGISTER_TYPES()
 =

diff --git a/common/test.cpp b/common/test.cpp
index 0c7ba10..dc63afc 100644
--- a/common/test.cpp
+++ b/common/test.cpp
@@ -215,10 +215,4 @@ QList<Sink::ApplicationDomain::ApplicationDomainType::=
Ptr> Sink::Test::TestAccou
     template void Sink::Test::TestAccount::addEntity<T>(const ApplicationD=
omain::ApplicationDomainType::Ptr &);           \
     template typename T::Ptr Sink::Test::TestAccount::createEntity<T>();
 =

-
-REGISTER_TYPE(ApplicationDomain::Event);
-REGISTER_TYPE(ApplicationDomain::Mail);
-REGISTER_TYPE(ApplicationDomain::Folder);
-REGISTER_TYPE(ApplicationDomain::SinkResource);
-REGISTER_TYPE(ApplicationDomain::SinkAccount);
-REGISTER_TYPE(ApplicationDomain::Identity);
+SINK_REGISTER_TYPES()

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic