Debian Codegraph @

Source/Control/Interface/CommandLine/COWLLinkFileComandLinePreparationTranslator.cpp

raw
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 #include "COWLLinkFileComandLinePreparationTranslator.h"
22
23
24 namespace Konclude {
25
26 namespace Control {
27
28 namespace Interface {
29
30 namespace CommandLine {
31
32 COWLLinkFileComandLinePreparationTranslator::COWLLinkFileComandLinePreparationTranslator(CLoaderFactory *loaderFactory) : CCommandLinePreparationTranslator(loaderFactory) {
33 mInterfaceTypeString = QString("OWLlink");
34 mMinNecessaryArguments = true;
35 mFirstArgumentTranslation = false;
36 }
37
38
39 COWLLinkFileComandLinePreparationTranslator::~COWLLinkFileComandLinePreparationTranslator() {
40 }
41
42 QStringList COWLLinkFileComandLinePreparationTranslator::combineTranslatedArguments() {
43 QStringList translatedArgList;
44
45 if (!mFirstArgumentTranslation) {
46 mMinNecessaryArguments = false;
47 }
48
49 if (!mRequestFileTranslated) {
50 LOG(ERROR,getLogDomain(),logTr("OWLlink request file not specified."),this);
51 mMinNecessaryArguments = false;
52 }
53
54 if (!mMinNecessaryArguments) {
55 LOG(ERROR,getLogDomain(),logTr("Execution with inadequate command line arguments."),this);
56 mHelpRequested = true;
57 }
58
59 if (!mHelpRequested) {
60 if (mLogConfList.isEmpty()) {
61 mLogConfList.append(QString("-ConfigurableCoutLogObserverLoader -LoggerConfigurationLoader"));
62 }
63 translatedArgList += mLogConfList;
64 translatedArgList += mGeneralConfList;
65
66 translatedArgList += QString("-DefaultReasonerLoader ");
67 translatedArgList += mReasonerConfList;
68 translatedArgList += mGeneralConfList;
69
70 if (!mConfigConfList.isEmpty()) {
71 translatedArgList += QString("-%1BatchFileLoader +=Konclude.%1.CloseAfterProcessedRequest=false +=Konclude.%1.BlockUntilProcessedRequest=true").arg(mInterfaceTypeString);
72 translatedArgList += mConfigConfList;
73 }
74
75 translatedArgList += QString("-%1BatchFileLoader +=Konclude.%1.CloseAfterProcessedRequest=true").arg(mInterfaceTypeString);
76 if (mExtendendLogging) {
77 translatedArgList += QString("+=Konclude.%1.LoggingExtendedProcessingTimes=true").arg(mInterfaceTypeString);
78 }
79 translatedArgList += mRequestConfList;
80
81 translatedArgList += mMiscellaneousList;
82 } else {
83 translatedArgList += QString("-ConfigurableCoutLogObserverLoader -CommandLineTranlatorHelpLoader");
84 }
85 return translatedArgList;
86 }
87
88 bool COWLLinkFileComandLinePreparationTranslator::translate(const QString& argumentText, QStringList& remainingArgList) {
89
90 bool argumentTranslated = false;
91
92
93 QString modArgText = argumentText.trimmed();
94 if (!mSkipTranslation) {
95 if (CCommandLinePreparationTranslator::translate(argumentText,remainingArgList)) {
96 argumentTranslated = true;
97 } else {
98 if (modArgText.indexOf("-") == 0) {
99 } else if (modArgText == "owllinkfile" || modArgText == "file") {
100 argumentTranslated = true;
101 mFirstArgumentTranslation = true;
102 }
103 }
104 }
105 return argumentTranslated;
106 }
107
108 bool COWLLinkFileComandLinePreparationTranslator::canTranslate(const QString& string) {
109 if (QString::compare(string,"owllinkfile",Qt::CaseInsensitive) == 0 || QString::compare(string,"file",Qt::CaseInsensitive) == 0) {
110 return true;
111 }
112 return false;
113 }
114
115
116 }; // end namespace CommandLine
117
118 }; // end namespace Interface
119
120 }; // end namespace Control
121
122 }; // end namespace Konclude