File indexing completed on 2024-05-12 09:09:42
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGIMPORTPLUGIN_H 0007 #define SKGIMPORTPLUGIN_H 0008 /** @file 0009 * This file is a plugin interface definition. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 #include "skgbankmodeler_export.h" 0014 #include "skgerror.h" 0015 #include "skgimportexportmanager.h" 0016 0017 /** 0018 * This file is a plugin interface definition. 0019 */ 0020 class SKGBANKMODELER_EXPORT SKGImportPlugin: public QObject 0021 { 0022 Q_OBJECT 0023 public: 0024 /** 0025 * Default constructor 0026 * @param iImporter the parent importer 0027 */ 0028 explicit SKGImportPlugin(QObject* iImporter = nullptr); 0029 0030 /** 0031 * Default destructor 0032 */ 0033 ~SKGImportPlugin() override; 0034 0035 /** 0036 * Get parameters for Import 0037 * @return the parameters 0038 */ 0039 virtual inline QMap<QString, QString> getImportParameters() 0040 { 0041 return m_importParameters; 0042 } 0043 0044 /** 0045 * Set parameters for Import 0046 * @param iParameters the parameters 0047 */ 0048 virtual inline void setImportParameters(const QMap<QString, QString>& iParameters) 0049 { 0050 m_importParameters = iParameters; 0051 } 0052 0053 /** 0054 * Get parameters for Export 0055 * @return the parameters 0056 */ 0057 virtual inline QMap<QString, QString> getExportParameters() 0058 { 0059 return m_exportParameters; 0060 } 0061 0062 /** 0063 * Set parameters for Export 0064 * @param iParameters the parameters 0065 */ 0066 virtual inline void setExportParameters(const QMap<QString, QString>& iParameters) 0067 { 0068 m_exportParameters = iParameters; 0069 } 0070 0071 /** 0072 * To know if import is possible with this plugin 0073 * @return true or false 0074 */ 0075 virtual inline bool isImportPossible() 0076 { 0077 return false; 0078 } 0079 0080 /** 0081 * Import a file 0082 * @return an object managing the error. 0083 * @see SKGError 0084 */ 0085 virtual inline SKGError importFile() 0086 { 0087 return SKGError(ERR_NOTIMPL, QLatin1String("")); 0088 } 0089 0090 /** 0091 * To know if export is possible with this plugin 0092 * @return true or false 0093 */ 0094 virtual inline bool isExportPossible() 0095 { 0096 return false; 0097 } 0098 0099 /** 0100 * Export a file 0101 * @return an object managing the error. 0102 * @see SKGError 0103 */ 0104 virtual inline SKGError exportFile() 0105 { 0106 return SKGError(ERR_NOTIMPL, QLatin1String("")); 0107 } 0108 0109 /** 0110 * Return the mime type filter 0111 * @return the mime type filter. Example: "*.csv|CSV file" 0112 */ 0113 virtual QString getMimeTypeFilter() const 0114 { 0115 return QLatin1String(""); 0116 } 0117 0118 private: 0119 Q_DISABLE_COPY(SKGImportPlugin) 0120 0121 protected: 0122 SKGImportExportManager* m_importer; 0123 QMap<QString, QString> m_importParameters; 0124 QMap<QString, QString> m_exportParameters; 0125 }; 0126 0127 /** 0128 * This plugin interface definition. 0129 */ 0130 Q_DECLARE_INTERFACE(SKGImportPlugin, "skrooge.com.SKGImportPlugin/1.0") 0131 0132 #endif // SKGIMPORTPLUGIN_H