1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef SYMBOLPARSER_H |
6 | #define SYMBOLPARSER_H |
7 | |
8 | #include <QProcess> |
9 | |
10 | struct SymbolParseArgs |
11 | { |
12 | QString workspace; |
13 | QString language; |
14 | QString storage; |
15 | SymbolParseArgs(); |
16 | SymbolParseArgs(const QString &workspace, const QString &language, const QString &storage); |
17 | SymbolParseArgs(const SymbolParseArgs &as); |
18 | SymbolParseArgs &operator=(const SymbolParseArgs &as); |
19 | }; |
20 | |
21 | class SymbolParser : public QProcess |
22 | { |
23 | Q_OBJECT |
24 | public: |
25 | explicit SymbolParser(QObject *parent = nullptr); |
26 | |
27 | void setArgs(const SymbolParseArgs& args); |
28 | SymbolParseArgs args() const; |
29 | |
30 | void setStorage(const QString &storage); |
31 | QString getStorage() const; |
32 | |
33 | void setWorkspace(const QString &workspace); |
34 | QString getWorkspace() const; |
35 | |
36 | void setLanguage(const QString &language); |
37 | QString getLanguage() const; |
38 | |
39 | void start(); |
40 | |
41 | signals: |
42 | void parseDone(bool result); |
43 | |
44 | private slots: |
45 | void errorOccurred(QProcess::ProcessError err); |
46 | void finished(int exitCode, QProcess::ExitStatus status); |
47 | void redirectOut(); |
48 | void redirectErr(); |
49 | |
50 | private: |
51 | QString getPython(); |
52 | |
53 | SymbolParseArgs processArgs; |
54 | QString pythonCmd; |
55 | }; |
56 | |
57 | #endif // SYMBOLPARSER_H |
58 |