1 /* 2 * This file is part of KMyMoney, A Personal Finance Manager by KDE 3 * Copyright (C) 2016 Christian Dávid <christian-david@web.de> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef INTERFACELOADER_H 20 #define INTERFACELOADER_H 21 22 #include "kmm_plugin_export.h" 23 24 namespace KMyMoneyPlugin { class AppInterface; } 25 namespace KMyMoneyPlugin { class ImportInterface; } 26 namespace KMyMoneyPlugin { class StatementInterface; } 27 namespace KMyMoneyPlugin { class ViewInterface; } 28 29 class KMyMoneyApp; 30 31 namespace KMyMoneyPlugin 32 { 33 34 class Plugin; 35 36 /** 37 * @internal 38 * 39 * This class is used as dead drop to communicate between two compile targets which cannot do 40 * this directly. 41 * It is only used by the classes which are named friends. To receive an instance of 42 * this class @ref pluginInterfaces() is used. 43 */ 44 class InterfaceLoader { 45 /** 46 * @{ 47 * This class is owner of these objects. However, the parent is somebody else. They are deleted by destruction of the parent only. 48 */ 49 KMyMoneyPlugin::AppInterface* appInterface; 50 KMyMoneyPlugin::ViewInterface* viewInterface; 51 KMyMoneyPlugin::StatementInterface* statementInterface; 52 KMyMoneyPlugin::ImportInterface* importInterface; 53 /** @} */ 54 55 friend KMyMoneyApp; 56 friend KMyMoneyPlugin::Plugin; 57 }; 58 59 /** 60 * @internal 61 * 62 * Returns an instance of @ref InterfaceLoader. It is created if needed. 63 */ 64 KMM_PLUGIN_EXPORT InterfaceLoader& pluginInterfaces(); 65 66 } 67 68 #endif 69