From daf96f7efec0538e161eab8e906a291015842e1e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 21 Mar 2017 14:12:14 +0100 Subject: Default domain adaptor --- common/domain/typeimplementations.cpp | 6 ---- common/domain/typeimplementations.h | 31 +++--------------- common/domainadaptor.h | 12 +++++++ examples/davresource/CMakeLists.txt | 2 +- examples/davresource/davresource.cpp | 4 +-- examples/davresource/domainadaptor.cpp | 35 -------------------- examples/davresource/domainadaptor.h | 38 ---------------------- examples/imapresource/CMakeLists.txt | 2 +- examples/imapresource/domainadaptor.cpp | 35 -------------------- examples/imapresource/domainadaptor.h | 38 ---------------------- examples/imapresource/imapresource.cpp | 4 +-- examples/maildirresource/CMakeLists.txt | 2 +- examples/maildirresource/domainadaptor.cpp | 35 -------------------- examples/maildirresource/domainadaptor.h | 38 ---------------------- examples/maildirresource/maildirresource.cpp | 4 +-- .../mailtransportresource.cpp | 1 - 16 files changed, 26 insertions(+), 261 deletions(-) delete mode 100644 examples/davresource/domainadaptor.cpp delete mode 100644 examples/davresource/domainadaptor.h delete mode 100644 examples/imapresource/domainadaptor.cpp delete mode 100644 examples/imapresource/domainadaptor.h delete mode 100644 examples/maildirresource/domainadaptor.cpp delete mode 100644 examples/maildirresource/domainadaptor.h diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp index 38422f4..2bb630c 100644 --- a/common/domain/typeimplementations.cpp +++ b/common/domain/typeimplementations.cpp @@ -29,12 +29,6 @@ #include "mail/threadindexer.h" #include "domainadaptor.h" -#include "mail_generated.h" -#include "folder_generated.h" -#include "event_generated.h" -#include "contact_generated.h" -#include "addressbook_generated.h" - using namespace Sink; using namespace Sink::ApplicationDomain; diff --git a/common/domain/typeimplementations.h b/common/domain/typeimplementations.h index cb63949..37d6ca9 100644 --- a/common/domain/typeimplementations.h +++ b/common/domain/typeimplementations.h @@ -20,7 +20,11 @@ #include "applicationdomaintype.h" -class QByteArray; +#include "mail_generated.h" +#include "folder_generated.h" +#include "event_generated.h" +#include "contact_generated.h" +#include "addressbook_generated.h" template class ReadPropertyMapper; @@ -38,11 +42,6 @@ class TypeIndex; namespace Sink { namespace ApplicationDomain { -namespace Buffer { - struct Mail; - struct MailBuilder; -} - template<> class TypeImplementation { public: @@ -54,11 +53,6 @@ public: static void configure(IndexPropertyMapper &indexPropertyMapper); }; -namespace Buffer { - struct Folder; - struct FolderBuilder; -} - template<> class TypeImplementation { public: @@ -70,11 +64,6 @@ public: static void configure(IndexPropertyMapper &indexPropertyMapper); }; -namespace Buffer { - struct Contact; - struct ContactBuilder; -} - template<> class TypeImplementation { public: @@ -86,11 +75,6 @@ public: static void configure(IndexPropertyMapper &indexPropertyMapper); }; -namespace Buffer { - struct Addressbook; - struct AddressbookBuilder; -} - template<> class TypeImplementation { public: @@ -102,11 +86,6 @@ public: static void configure(IndexPropertyMapper &indexPropertyMapper); }; -namespace Buffer { - struct Event; - struct EventBuilder; -} - template<> class TypeImplementation { public: diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 54aa53e..af5d5fc 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h @@ -242,3 +242,15 @@ protected: QSharedPointer> mResourceWriteMapper; QSharedPointer mIndexMapper; }; + +/** + * A default adaptorfactory implemenation that simply instantiates a generic resource + */ +template +class DefaultAdaptorFactory : public DomainTypeAdaptorFactory +{ +public: + DefaultAdaptorFactory() : DomainTypeAdaptorFactory() {} + virtual ~DefaultAdaptorFactory(){} +}; + diff --git a/examples/davresource/CMakeLists.txt b/examples/davresource/CMakeLists.txt index 9f134c2..28829d5 100644 --- a/examples/davresource/CMakeLists.txt +++ b/examples/davresource/CMakeLists.txt @@ -5,7 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) find_package(KPimKDAV REQUIRED) -add_library(${PROJECT_NAME} SHARED davresource.cpp domainadaptor.cpp) +add_library(${PROJECT_NAME} SHARED davresource.cpp) qt5_use_modules(${PROJECT_NAME} Core Network) target_link_libraries(${PROJECT_NAME} sink KPim::KDAV) diff --git a/examples/davresource/davresource.cpp b/examples/davresource/davresource.cpp index d116397..d7254b4 100644 --- a/examples/davresource/davresource.cpp +++ b/examples/davresource/davresource.cpp @@ -277,8 +277,8 @@ void DavResourceFactory::registerFacades(const QByteArray &name, Sink::FacadeFac void DavResourceFactory::registerAdaptorFactories(const QByteArray &name, Sink::AdaptorFactoryRegistry ®istry) { - registry.registerFactory(name); - registry.registerFactory(name); + registry.registerFactory>(name); + registry.registerFactory>(name); } void DavResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) diff --git a/examples/davresource/domainadaptor.cpp b/examples/davresource/domainadaptor.cpp deleted file mode 100644 index 861a10e..0000000 --- a/examples/davresource/domainadaptor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2015 Christian Mollekopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "domainadaptor.h" - -using namespace flatbuffers; - -ContactAdaptorFactory::ContactAdaptorFactory() - : DomainTypeAdaptorFactory() -{ - -} - -AddressbookAdaptorFactory::AddressbookAdaptorFactory() - : DomainTypeAdaptorFactory() -{ - -} - diff --git a/examples/davresource/domainadaptor.h b/examples/davresource/domainadaptor.h deleted file mode 100644 index 7e3c723..0000000 --- a/examples/davresource/domainadaptor.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015 Christian Mollekopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#pragma once - -#include -#include "contact_generated.h" -#include "folder_generated.h" -#include "dummy_generated.h" - -class ContactAdaptorFactory : public DomainTypeAdaptorFactory -{ -public: - ContactAdaptorFactory(); - virtual ~ContactAdaptorFactory() {}; -}; - -class AddressbookAdaptorFactory : public DomainTypeAdaptorFactory -{ -public: - AddressbookAdaptorFactory(); - virtual ~AddressbookAdaptorFactory() {}; -}; diff --git a/examples/imapresource/CMakeLists.txt b/examples/imapresource/CMakeLists.txt index 61680cd..46a8b08 100644 --- a/examples/imapresource/CMakeLists.txt +++ b/examples/imapresource/CMakeLists.txt @@ -8,7 +8,7 @@ find_package(KIMAP2 0.0.1 REQUIRED) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -add_library(${PROJECT_NAME} SHARED imapresource.cpp domainadaptor.cpp imapserverproxy.cpp) +add_library(${PROJECT_NAME} SHARED imapresource.cpp imapserverproxy.cpp) qt5_use_modules(${PROJECT_NAME} Core Network) target_link_libraries(${PROJECT_NAME} sink KF5::Mime KIMAP2) diff --git a/examples/imapresource/domainadaptor.cpp b/examples/imapresource/domainadaptor.cpp deleted file mode 100644 index 4e74ad2..0000000 --- a/examples/imapresource/domainadaptor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2015 Christian Mollekopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "domainadaptor.h" - -using namespace flatbuffers; - -ImapMailAdaptorFactory::ImapMailAdaptorFactory() - : DomainTypeAdaptorFactory() -{ - -} - -ImapFolderAdaptorFactory::ImapFolderAdaptorFactory() - : DomainTypeAdaptorFactory() -{ - -} - diff --git a/examples/imapresource/domainadaptor.h b/examples/imapresource/domainadaptor.h deleted file mode 100644 index 06a513c..0000000 --- a/examples/imapresource/domainadaptor.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015 Christian Mollekopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#pragma once - -#include -#include "mail_generated.h" -#include "folder_generated.h" -#include "dummy_generated.h" - -class ImapMailAdaptorFactory : public DomainTypeAdaptorFactory -{ -public: - ImapMailAdaptorFactory(); - virtual ~ImapMailAdaptorFactory() {}; -}; - -class ImapFolderAdaptorFactory : public DomainTypeAdaptorFactory -{ -public: - ImapFolderAdaptorFactory(); - virtual ~ImapFolderAdaptorFactory() {}; -}; diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 4f6f748..535a35c 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp @@ -955,8 +955,8 @@ void ImapResourceFactory::registerFacades(const QByteArray &name, Sink::FacadeFa void ImapResourceFactory::registerAdaptorFactories(const QByteArray &name, Sink::AdaptorFactoryRegistry ®istry) { - registry.registerFactory(name); - registry.registerFactory(name); + registry.registerFactory>(name); + registry.registerFactory>(name); } void ImapResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) diff --git a/examples/maildirresource/CMakeLists.txt b/examples/maildirresource/CMakeLists.txt index b96c50f..a8f0359 100644 --- a/examples/maildirresource/CMakeLists.txt +++ b/examples/maildirresource/CMakeLists.txt @@ -5,7 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) find_package(KF5 COMPONENTS REQUIRED Mime) -add_library(${PROJECT_NAME} SHARED facade.cpp maildirresource.cpp domainadaptor.cpp libmaildir/maildir.cpp libmaildir/keycache.cpp) +add_library(${PROJECT_NAME} SHARED facade.cpp maildirresource.cpp libmaildir/maildir.cpp libmaildir/keycache.cpp) qt5_use_modules(${PROJECT_NAME} Core Network) target_link_libraries(${PROJECT_NAME} sink KF5::Mime) diff --git a/examples/maildirresource/domainadaptor.cpp b/examples/maildirresource/domainadaptor.cpp deleted file mode 100644 index 71b2354..0000000 --- a/examples/maildirresource/domainadaptor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2015 Christian Mollekopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "domainadaptor.h" - -using namespace flatbuffers; - -MaildirMailAdaptorFactory::MaildirMailAdaptorFactory() - : DomainTypeAdaptorFactory() -{ - -} - -MaildirFolderAdaptorFactory::MaildirFolderAdaptorFactory() - : DomainTypeAdaptorFactory() -{ - -} - diff --git a/examples/maildirresource/domainadaptor.h b/examples/maildirresource/domainadaptor.h deleted file mode 100644 index 700d2e5..0000000 --- a/examples/maildirresource/domainadaptor.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015 Christian Mollekopf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#pragma once - -#include -#include "mail_generated.h" -#include "folder_generated.h" -#include "dummy_generated.h" - -class MaildirMailAdaptorFactory : public DomainTypeAdaptorFactory -{ -public: - MaildirMailAdaptorFactory(); - virtual ~MaildirMailAdaptorFactory() {}; -}; - -class MaildirFolderAdaptorFactory : public DomainTypeAdaptorFactory -{ -public: - MaildirFolderAdaptorFactory(); - virtual ~MaildirFolderAdaptorFactory() {}; -}; diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index f80b799..a2a2f05 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp @@ -596,8 +596,8 @@ void MaildirResourceFactory::registerFacades(const QByteArray &name, Sink::Facad void MaildirResourceFactory::registerAdaptorFactories(const QByteArray &name, Sink::AdaptorFactoryRegistry ®istry) { - registry.registerFactory(name); - registry.registerFactory(name); + registry.registerFactory>(name); + registry.registerFactory>(name); } void MaildirResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 6beb4e8..673fae4 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -30,7 +30,6 @@ #include #include "mailtransport.h" -#include "mail_generated.h" #include "inspection.h" #include #include -- cgit v1.2.3