| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef KONCLUDE_Control_LOADER_CCOMMANDLINELOADER_H |
| 22 |
#define KONCLUDE_Control_LOADER_CCOMMANDLINELOADER_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QString> |
| 26 |
#include <QRegExp> |
| 27 |
|
| 28 |
// Namespace includes |
| 29 |
#include "CLoader.h" |
| 30 |
|
| 31 |
// Other includes |
| 32 |
#include "Concurrent/CThread.h" |
| 33 |
|
| 34 |
#include "Utilities/CSingletonProvider.hpp" |
| 35 |
|
| 36 |
// Logger includes |
| 37 |
#include "Logger/CLogger.h" |
| 38 |
|
| 39 |
|
| 40 |
namespace Konclude { |
| 41 |
|
| 42 |
using namespace Logger; |
| 43 |
using namespace Concurrent; |
| 44 |
using namespace Utilities; |
| 45 |
|
| 46 |
namespace Control { |
| 47 |
|
| 48 |
namespace Loader { |
| 49 |
|
| 50 |
/*! |
| 51 |
* |
| 52 |
* \class CCommandLineLoader |
| 53 |
* \author Andreas Steigmiller |
| 54 |
* \version 0.1 |
| 55 |
* \brief TODO |
| 56 |
* |
| 57 |
*/ |
| 58 |
class CCommandLineLoader : public CLoader, public CThread { |
| 59 |
// public methods |
| 60 |
public: |
| 61 |
//! Constructor |
| 62 |
CCommandLineLoader(const QStringList &argList, bool qtGUIApplication); |
| 63 |
CCommandLineLoader(int argc, char *argv[], bool qtGUIApplication); |
| 64 |
CCommandLineLoader(); |
| 65 |
|
| 66 |
//! Destructor |
| 67 |
virtual ~CCommandLineLoader(); |
| 68 |
|
| 69 |
|
| 70 |
static QStringList getEncodedArguments(int argc, char *argv[], bool skipFirst = true, bool encodeSpaces = true); |
| 71 |
static QString getDecodedArgument(const QString& string); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
virtual CLoader *init(CLoaderFactory *loaderFactory = 0, CConfiguration *config = 0); |
| 76 |
virtual CLoader *load(); |
| 77 |
virtual CLoader *exit(); |
| 78 |
|
| 79 |
|
| 80 |
// protected methods |
| 81 |
protected: |
| 82 |
virtual CCommandLineLoader *setConfiguration(const QString &configString, CConfiguration *configuration, bool equalsConfSet = false); |
| 83 |
|
| 84 |
virtual void threadStarted(); |
| 85 |
virtual void threadStopped(); |
| 86 |
|
| 87 |
virtual QStringList getMatchesFromPattern(const QString &pattern, const QString &text); |
| 88 |
virtual QStringList getMatchesFromPattern(const QString &pattern, const QString &text, qint64 maxPosition); |
| 89 |
virtual qint64 getFirstTextOccur(const QString &text, const QString &textOccur, qint64 beginSearchPos = 0); |
| 90 |
|
| 91 |
// protected variables |
| 92 |
protected: |
| 93 |
QStringList commandLineParameters; |
| 94 |
|
| 95 |
CConfiguration *configuration; |
| 96 |
bool qtGuiUsable; |
| 97 |
|
| 98 |
QString loadingText; |
| 99 |
|
| 100 |
CLoaderFactory *lFactory; |
| 101 |
QLinkedList<CLoader *> loaderContainer; |
| 102 |
QLinkedList<CConfiguration *> configContainer; |
| 103 |
|
| 104 |
QMutex containerSync; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
// private methods |
| 109 |
private: |
| 110 |
|
| 111 |
// private variables |
| 112 |
private: |
| 113 |
|
| 114 |
}; |
| 115 |
|
| 116 |
}; // end namespace Loader |
| 117 |
|
| 118 |
}; // end namespace Control |
| 119 |
|
| 120 |
}; // end namespace Konclude |
| 121 |
|
| 122 |
#endif // KONCLUDE_Control_LOADER_CCOMMANDLINELOADER_H |