File indexing completed on 2024-05-12 16:43:40

0001 /*
0002     SPDX-FileCopyrightText: 2016 Christian Dávid <christian-david@web.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef INTERFACELOADER_H
0007 #define INTERFACELOADER_H
0008 
0009 #include "kmm_plugin_export.h"
0010 
0011 namespace KMyMoneyPlugin {
0012 class AppInterface;
0013 class ImportInterface;
0014 class StatementInterface;
0015 class ViewInterface;
0016 }
0017 class KMyMoneyApp;
0018 
0019 namespace KMyMoneyPlugin
0020 {
0021 
0022 class Plugin;
0023 
0024 /**
0025  * @internal
0026  *
0027  * This class is used as dead drop to communicate between two compile targets which cannot do
0028  * this directly.
0029  * It is only used by the classes which are named friends. To receive an instance of
0030  * this class @ref pluginInterfaces() is used.
0031  */
0032 class InterfaceLoader {
0033     /**
0034      * @{
0035      * This class is owner of these objects. However, the parent is somebody else. They are deleted by destruction of the parent only.
0036      */
0037     KMyMoneyPlugin::AppInterface* appInterface;
0038     KMyMoneyPlugin::ViewInterface* viewInterface;
0039     KMyMoneyPlugin::StatementInterface* statementInterface;
0040     KMyMoneyPlugin::ImportInterface* importInterface;
0041     /** @} */
0042 
0043     friend KMyMoneyApp;
0044     friend KMyMoneyPlugin::Plugin;
0045 };
0046 
0047 /**
0048  * @internal
0049  *
0050  * Returns an instance of @ref InterfaceLoader. It is created if needed.
0051  */
0052 KMM_PLUGIN_EXPORT InterfaceLoader& pluginInterfaces();
0053 
0054 }
0055 
0056 #endif