File indexing completed on 2024-05-26 05:27:32
0001 /* 0002 * Copyright (C) 2015 Christian Mollekopf <chrigi_1@fastmail.fm> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation; either version 2 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program; if not, write to the 0016 * Free Software Foundation, Inc., 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 0018 */ 0019 #pragma once 0020 0021 #include "sink_export.h" 0022 #include "applicationdomaintype.h" 0023 0024 #include "mail_generated.h" 0025 #include "folder_generated.h" 0026 #include "event_generated.h" 0027 #include "todo_generated.h" 0028 #include "calendar_generated.h" 0029 #include "contact_generated.h" 0030 #include "addressbook_generated.h" 0031 0032 class PropertyMapper; 0033 class IndexPropertyMapper; 0034 0035 class TypeIndex; 0036 0037 /** 0038 * Implements all type-specific code such as updating and querying indexes. 0039 * 0040 * These are type specifiy default implementations. Theoretically a resource could implement it's own implementation. 0041 */ 0042 namespace Sink { 0043 namespace ApplicationDomain { 0044 0045 template<> 0046 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Mail> { 0047 public: 0048 typedef Sink::ApplicationDomain::Buffer::Mail Buffer; 0049 typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder; 0050 static void configure(TypeIndex &index); 0051 static void configure(PropertyMapper &propertyMapper); 0052 static void configure(IndexPropertyMapper &indexPropertyMapper); 0053 static QMap<QByteArray, int> typeDatabases(); 0054 }; 0055 0056 template<> 0057 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Folder> { 0058 public: 0059 typedef Sink::ApplicationDomain::Buffer::Folder Buffer; 0060 typedef Sink::ApplicationDomain::Buffer::FolderBuilder BufferBuilder; 0061 static void configure(TypeIndex &); 0062 static void configure(PropertyMapper &); 0063 static void configure(IndexPropertyMapper &indexPropertyMapper); 0064 static QMap<QByteArray, int> typeDatabases(); 0065 }; 0066 0067 template<> 0068 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Contact> { 0069 public: 0070 typedef Sink::ApplicationDomain::Buffer::Contact Buffer; 0071 typedef Sink::ApplicationDomain::Buffer::ContactBuilder BufferBuilder; 0072 static void configure(TypeIndex &); 0073 static void configure(PropertyMapper &); 0074 static void configure(IndexPropertyMapper &indexPropertyMapper); 0075 static QMap<QByteArray, int> typeDatabases(); 0076 }; 0077 0078 template<> 0079 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Addressbook> { 0080 public: 0081 typedef Sink::ApplicationDomain::Buffer::Addressbook Buffer; 0082 typedef Sink::ApplicationDomain::Buffer::AddressbookBuilder BufferBuilder; 0083 static void configure(TypeIndex &); 0084 static void configure(PropertyMapper &); 0085 static void configure(IndexPropertyMapper &indexPropertyMapper); 0086 static QMap<QByteArray, int> typeDatabases(); 0087 }; 0088 0089 template<> 0090 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Event> { 0091 public: 0092 typedef Sink::ApplicationDomain::Buffer::Event Buffer; 0093 typedef Sink::ApplicationDomain::Buffer::EventBuilder BufferBuilder; 0094 static void configure(TypeIndex &); 0095 static void configure(PropertyMapper &); 0096 static void configure(IndexPropertyMapper &indexPropertyMapper); 0097 static QMap<QByteArray, int> typeDatabases(); 0098 }; 0099 0100 template<> 0101 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Todo> { 0102 public: 0103 typedef Sink::ApplicationDomain::Buffer::Todo Buffer; 0104 typedef Sink::ApplicationDomain::Buffer::TodoBuilder BufferBuilder; 0105 static void configure(TypeIndex &); 0106 static void configure(PropertyMapper &); 0107 static void configure(IndexPropertyMapper &indexPropertyMapper); 0108 static QMap<QByteArray, int> typeDatabases(); 0109 }; 0110 0111 template<> 0112 class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Calendar> { 0113 public: 0114 typedef Sink::ApplicationDomain::Buffer::Calendar Buffer; 0115 typedef Sink::ApplicationDomain::Buffer::CalendarBuilder BufferBuilder; 0116 static void configure(TypeIndex &); 0117 static void configure(PropertyMapper &); 0118 static void configure(IndexPropertyMapper &indexPropertyMapper); 0119 static QMap<QByteArray, int> typeDatabases(); 0120 }; 0121 0122 } 0123 }