File indexing completed on 2024-06-09 05:03:46

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 SKGIMPORTPLUGINIIF_H
0007 #define SKGIMPORTPLUGINIIF_H
0008 /** @file
0009 * This file is Skrooge plugin for IIF import / export.
0010 *
0011 * @author Stephane MANKOWSKI / Guillaume DE BURE
0012 */
0013 #include "skgaccountobject.h"
0014 #include "skgcategoryobject.h"
0015 #include "skgimportplugin.h"
0016 #include "skgpayeeobject.h"
0017 
0018 /**
0019  * This file is Skrooge plugin for IIF import / export.
0020  */
0021 class SKGImportPluginIif : public SKGImportPlugin
0022 {
0023     Q_OBJECT
0024     Q_INTERFACES(SKGImportPlugin)
0025 
0026 public:
0027     /**
0028      * Default constructor
0029      * @param iImporter the parent importer
0030      * @param iArg arguments
0031      */
0032     explicit SKGImportPluginIif(QObject* iImporter, const QVariantList& iArg);
0033 
0034     /**
0035      * Default Destructor
0036      */
0037     ~SKGImportPluginIif() override;
0038 
0039     /**
0040      * To know if import is possible with this plugin
0041      */
0042     bool isImportPossible() override;
0043 
0044     /**
0045      * Import a file
0046      * @return an object managing the error.
0047      *   @see SKGError
0048      */
0049     SKGError importFile() override;
0050 
0051     /**
0052      * To know if export is possible with this plugin
0053      * @return true or false
0054      */
0055     bool isExportPossible() override;
0056 
0057     /**
0058      * Export a file
0059      * @return an object managing the error.
0060      *   @see SKGError
0061      */
0062     SKGError exportFile() override;
0063 
0064     /**
0065      * Return the mime type filter
0066      * @return the mime type filter. Example: "*.csv|CSV file"
0067      */
0068     QString getMimeTypeFilter() const override;
0069 
0070 
0071 private:
0072     Q_DISABLE_COPY(SKGImportPluginIif)
0073 
0074     QString getVal(const QStringList& iVals, const QString& iAttribute) const;
0075 
0076     QMap<QString, QStringList> m_headers;
0077     QMap<QString, SKGAccountObject> m_accounts;
0078     QMap<QString, SKGCategoryObject> m_categories;
0079     QMap<QString, SKGPayeeObject> m_payees;
0080 };
0081 
0082 #endif  // SKGIMPORTPLUGINIIF_H