1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef LANGUAGEGENERATOR_H |
6 | #define LANGUAGEGENERATOR_H |
7 | |
8 | #include "common/common.h" |
9 | #include "dap/protocol.h" |
10 | #include "services/project/projectinfo.h" |
11 | |
12 | namespace dpfservice { |
13 | |
14 | struct RunCommandInfo { |
15 | QString program; |
16 | QStringList arguments; |
17 | QString workingDir; |
18 | }; |
19 | |
20 | class LanguageGenerator : public Generator |
21 | { |
22 | Q_OBJECT |
23 | public: |
24 | LanguageGenerator(){} |
25 | virtual ~LanguageGenerator(){} |
26 | |
27 | virtual bool isNeedBuild() { |
28 | return false; |
29 | } |
30 | |
31 | virtual bool isTargetReady() { |
32 | return false; |
33 | } |
34 | |
35 | virtual bool isAnsyPrepareDebug() { |
36 | return false; |
37 | } |
38 | |
39 | virtual QString debugger() = 0; |
40 | virtual bool prepareDebug(const QMap<QString, QVariant> ¶m, QString &retMsg) = 0; |
41 | virtual bool requestDAPPort(const QString &uuid, const QMap<QString, QVariant> ¶m, QString &retMsg) = 0; |
42 | virtual bool isLaunchNotAttach() = 0; |
43 | |
44 | virtual dap::LaunchRequest launchDAP(const QMap<QString, QVariant> ¶m) { |
45 | Q_UNUSED(param) |
46 | return dap::LaunchRequest(); |
47 | } |
48 | |
49 | virtual dap::AttachRequest attachDAP(int port, const QMap<QString, QVariant> ¶m) { |
50 | Q_UNUSED(port) |
51 | Q_UNUSED(param) |
52 | return dap::AttachRequest(); |
53 | } |
54 | |
55 | virtual bool isRestartDAPManually() { |
56 | return false; |
57 | } |
58 | |
59 | virtual bool isStopDAPManually() { |
60 | return false; |
61 | } |
62 | |
63 | virtual QString build(const QString& projectPath) { |
64 | Q_UNUSED(projectPath) |
65 | return QString(); |
66 | } |
67 | |
68 | virtual QString getProjectFile(const QString& projectPath) { |
69 | return projectPath; |
70 | } |
71 | |
72 | virtual QMap<QString, QVariant> getDebugArguments(const dpfservice::ProjectInfo &projectInfo, |
73 | const QString ¤tFile) { |
74 | Q_UNUSED(projectInfo) |
75 | Q_UNUSED(currentFile) |
76 | return QMap<QString, QVariant>(); |
77 | } |
78 | |
79 | virtual RunCommandInfo getRunArguments(const dpfservice::ProjectInfo &projectInfo, |
80 | const QString ¤tFile) { |
81 | Q_UNUSED(projectInfo) |
82 | Q_UNUSED(currentFile) |
83 | return {}; |
84 | } |
85 | }; |
86 | |
87 | } // namespace dpfservice |
88 | |
89 | #endif // LANGUAGEGENERATOR_H |
90 | |