1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef ENVIRONMENT_H |
6 | #define ENVIRONMENT_H |
7 | |
8 | #include <common/type/menuext.h> |
9 | #include <QProcessEnvironment> |
10 | #include <optional> |
11 | |
12 | namespace environment { |
13 | namespace language { |
14 | |
15 | enum Category{User,System}; |
16 | enum Kit{Python}; |
17 | |
18 | struct Version final |
19 | { |
20 | std::optional<int> major; |
21 | std::optional<int> minor; |
22 | std::optional<int> revision; |
23 | std::optional<int> build; |
24 | Version(); |
25 | Version(int major); |
26 | Version(const Version &version); |
27 | Version &operator = (const Version &version); |
28 | }; |
29 | |
30 | struct Program final |
31 | { |
32 | std::optional<QString> path; |
33 | Version version; |
34 | std::optional<QString> binsPath; |
35 | std::optional<QString> pkgsPath; |
36 | }; |
37 | |
38 | Version completion(Category category, Kit kit, const Version &version); |
39 | Program search(Category category, Kit kit, const Version& version); |
40 | QProcessEnvironment get(Category category, Kit kit, const Version& version); |
41 | }namespace lang = language; |
42 | |
43 | namespace package { |
44 | enum_def(Category, QString) |
45 | { |
46 | enum_exp clangd = "clangd"; |
47 | enum_exp jdtls = "jdt-language-server"; |
48 | }; |
49 | namespace native { |
50 | QString path(const Category::type_value &category = ""); |
51 | bool installed(); |
52 | } // native |
53 | } namespace pkg = package; |
54 | |
55 | }namespace env = environment; |
56 | |
57 | |
58 | #endif // ENVIRONMENT_H |
59 |