diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-15 17:54:58 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-16 10:39:59 +0100 |
commit | 0ecabf708cd56e0312392cca6d85aa8c3f2e7ccc (patch) | |
tree | 178a689a3be37e513ac9f7d1a2117b802f8ec17c /common | |
parent | f7a42de9bfd6e34f1dc46da433d3f45976b1cd0e (diff) | |
download | sink-0ecabf708cd56e0312392cca6d85aa8c3f2e7ccc.tar.gz sink-0ecabf708cd56e0312392cca6d85aa8c3f2e7ccc.zip |
Use SINK_REGISTER_TYPES to avoid repeating the types
Diffstat (limited to 'common')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 12 | ||||
-rw-r--r-- | common/domain/applicationdomaintype.h | 34 |
2 files changed, 17 insertions, 29 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 49bfb5f..530056d 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp | |||
@@ -384,14 +384,10 @@ QByteArrayList getTypeNames() | |||
384 | { | 384 | { |
385 | static QByteArrayList types; | 385 | static QByteArrayList types; |
386 | if (types.isEmpty()) { | 386 | if (types.isEmpty()) { |
387 | types << ApplicationDomain::getTypeName<SinkResource>(); | 387 | #define REGISTER_TYPE(TYPE) \ |
388 | types << ApplicationDomain::getTypeName<SinkAccount>(); | 388 | types << ApplicationDomain::getTypeName<TYPE>(); |
389 | types << ApplicationDomain::getTypeName<Identity>(); | 389 | SINK_REGISTER_TYPES() |
390 | types << ApplicationDomain::getTypeName<Mail>(); | 390 | #undef REGISTER_TYPE |
391 | types << ApplicationDomain::getTypeName<Folder>(); | ||
392 | types << ApplicationDomain::getTypeName<Event>(); | ||
393 | types << ApplicationDomain::getTypeName<Todo>(); | ||
394 | types << ApplicationDomain::getTypeName<Contact>(); | ||
395 | } | 391 | } |
396 | return types; | 392 | return types; |
397 | } | 393 | } |
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index c822895..98b7de7 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -519,35 +519,27 @@ class SINK_EXPORT TypeImplementation; | |||
519 | * This macro can be used to instantiate templates for all domain types. | 519 | * This macro can be used to instantiate templates for all domain types. |
520 | */ | 520 | */ |
521 | #define SINK_REGISTER_TYPES() \ | 521 | #define SINK_REGISTER_TYPES() \ |
522 | REGISTER_TYPE(Sink::ApplicationDomain::Contact); \ | 522 | REGISTER_TYPE(Sink::ApplicationDomain::Contact) \ |
523 | REGISTER_TYPE(Sink::ApplicationDomain::Event); \ | 523 | REGISTER_TYPE(Sink::ApplicationDomain::Event) \ |
524 | REGISTER_TYPE(Sink::ApplicationDomain::Mail); \ | 524 | REGISTER_TYPE(Sink::ApplicationDomain::Mail) \ |
525 | REGISTER_TYPE(Sink::ApplicationDomain::Folder); \ | 525 | REGISTER_TYPE(Sink::ApplicationDomain::Folder) \ |
526 | REGISTER_TYPE(Sink::ApplicationDomain::SinkResource); \ | 526 | REGISTER_TYPE(Sink::ApplicationDomain::SinkResource) \ |
527 | REGISTER_TYPE(Sink::ApplicationDomain::SinkAccount); \ | 527 | REGISTER_TYPE(Sink::ApplicationDomain::SinkAccount) \ |
528 | REGISTER_TYPE(Sink::ApplicationDomain::Identity); \ | 528 | REGISTER_TYPE(Sink::ApplicationDomain::Identity) \ |
529 | 529 | ||
530 | SINK_EXPORT QDataStream &operator<<(QDataStream &out, const Sink::ApplicationDomain::Reference &reference); | 530 | SINK_EXPORT QDataStream &operator<<(QDataStream &out, const Sink::ApplicationDomain::Reference &reference); |
531 | SINK_EXPORT QDataStream &operator>>(QDataStream &in, Sink::ApplicationDomain::Reference &reference); | 531 | SINK_EXPORT QDataStream &operator>>(QDataStream &in, Sink::ApplicationDomain::Reference &reference); |
532 | 532 | ||
533 | #define REGISTER_TYPE(TYPE) \ | ||
534 | Q_DECLARE_METATYPE(TYPE) \ | ||
535 | Q_DECLARE_METATYPE(TYPE::Ptr) | ||
536 | SINK_REGISTER_TYPES() | ||
537 | #undef REGISTER_TYPE | ||
538 | |||
533 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType) | 539 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType) |
534 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType::Ptr) | 540 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType::Ptr) |
535 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity) | 541 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity) |
536 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity::Ptr) | 542 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity::Ptr) |
537 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Contact) | ||
538 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Contact::Ptr) | ||
539 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Event) | ||
540 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Event::Ptr) | ||
541 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail) | ||
542 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Ptr) | ||
543 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Folder) | ||
544 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Folder::Ptr) | ||
545 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::SinkResource) | ||
546 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::SinkResource::Ptr) | ||
547 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::SinkAccount) | ||
548 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::SinkAccount::Ptr) | ||
549 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Identity) | ||
550 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Identity::Ptr) | ||
551 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Contact) | 543 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Contact) |
552 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Error) | 544 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Error) |
553 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Progress) | 545 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Progress) |