1 /*************************************************************************** 2 * SPDX-FileCopyrightText: 2021 S. MANKOWSKI stephane@mankowski.fr 3 * SPDX-FileCopyrightText: 2021 G. DE BURE support@mankowski.fr 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 ***************************************************************************/ 6 #ifndef SKGDOCUMENTPRIVATE_H 7 #define SKGDOCUMENTPRIVATE_H 8 /** @file 9 * This file defines classes SKGDocumentPrivate. 10 * 11 * @author Stephane MANKOWSKI / Guillaume DE BURE 12 */ 13 14 #include <qfuturewatcher.h> 15 #include <qhash.h> 16 #include <qsqldatabase.h> 17 #include <qstringlist.h> 18 19 #include <functional> 20 21 #include "skgdefine.h" 22 #include "skgerror.h" 23 #include "skgservices.h" 24 25 using FuncProgress = std::function<int(int, qint64, const QString&, void*)>; 26 using checksFunction = SKGError(*)(SKGDocument*); 27 28 /** 29 * This class manages skg documents 30 */ 31 class SKGDocumentPrivate 32 { 33 public: 34 /** 35 * Constructor 36 */ 37 explicit SKGDocumentPrivate(); 38 39 /** 40 * Destructor 41 */ 42 virtual ~SKGDocumentPrivate(); 43 44 static SKGError m_lastCallbackError; 45 46 static int m_databaseUniqueIdentifier; 47 48 int m_lastSavedTransaction{0}; 49 FuncProgress m_progressFunction{nullptr}; 50 QList<checksFunction> m_checkFunctions; 51 void* m_progressData{nullptr}; 52 QString m_currentFileName; 53 QString m_databaseIdentifier; 54 QSqlDatabase m_currentDatabase; 55 SKGIntList m_nbStepForTransaction; 56 SKGIntList m_posStepForTransaction; 57 QStringList m_nameForTransaction; 58 int m_inundoRedoTransaction{0}; 59 int m_currentTransaction{0}; 60 qint64 m_timeBeginTransaction{0}; 61 QString m_temporaryFile; 62 QString m_uniqueIdentifier; 63 // SKGMessageList m_unTransactionnalMessages; 64 QMap<QString, QStringList> m_ImpactedViews; 65 QMap<QString, QStringList> m_MaterializedViews; 66 67 QHash<QString, QString> m_cache; 68 QHash<QString, SKGStringListList>* m_cacheSql; 69 bool m_inProgress{false}; 70 QString m_backupPrefix; 71 QString m_backupSuffix; 72 bool m_directAccessDb{false}; 73 bool m_modeReadOnly{false}; 74 bool m_modeSQLCipher{false}; 75 QList<QFutureWatcher<SKGStringListList>*> m_watchers; 76 77 bool m_blockEmits{false}; 78 QMutex m_mutex; 79 QString m_password; 80 bool m_password_got{false}; 81 }; 82 #endif 83