/src/WasmEdge/include/ast/component/export.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: Copyright The WasmEdge Authors |
3 | | |
4 | | //===-- wasmedge/ast/component/export.h - Export class definition ---------===// |
5 | | // |
6 | | // Part of the WasmEdge Project. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | /// |
10 | | /// \file |
11 | | /// This file contains the declaration of the Export node class. |
12 | | /// |
13 | | //===----------------------------------------------------------------------===// |
14 | | #pragma once |
15 | | |
16 | | #include "ast/component/sort.h" |
17 | | #include "ast/component/type.h" |
18 | | #include "common/span.h" |
19 | | |
20 | | #include <optional> |
21 | | #include <string> |
22 | | #include <vector> |
23 | | |
24 | | namespace WasmEdge { |
25 | | namespace AST { |
26 | | namespace Component { |
27 | | |
28 | | // export ::= na:<nameattributes> si:<sortidx> et?:<externtype>? |
29 | | // => (export na si et?) |
30 | | |
31 | | /// AST Component::Export node. |
32 | | class Export { |
33 | | public: |
34 | 3.08k | std::string &getName() noexcept { return Name; } |
35 | 5.32k | std::string_view getName() const noexcept { return Name; } |
36 | 3.02k | SortIndex &getSortIndex() noexcept { return SortIdx; } |
37 | 7.76k | const SortIndex &getSortIndex() const noexcept { return SortIdx; } |
38 | 2.99k | std::optional<ExternDesc> &getDesc() noexcept { return Desc; } |
39 | 1.63k | const std::optional<ExternDesc> &getDesc() const noexcept { return Desc; } |
40 | 3.08k | std::vector<std::string> &getImplements() noexcept { return Implements; } |
41 | 1.73k | Span<const std::string> getImplements() const noexcept { return Implements; } |
42 | 3.08k | std::vector<std::string> &getExternalIds() noexcept { return ExternalIds; } |
43 | 1.73k | Span<const std::string> getExternalIds() const noexcept { |
44 | 1.73k | return ExternalIds; |
45 | 1.73k | } |
46 | 3.08k | std::vector<std::string> &getVersionSuffixes() noexcept { |
47 | 3.08k | return VersionSuffixes; |
48 | 3.08k | } |
49 | 1.73k | Span<const std::string> getVersionSuffixes() const noexcept { |
50 | 1.73k | return VersionSuffixes; |
51 | 1.73k | } |
52 | | |
53 | | private: |
54 | | std::string Name; |
55 | | SortIndex SortIdx; |
56 | | std::optional<ExternDesc> Desc; |
57 | | std::vector<std::string> Implements; |
58 | | std::vector<std::string> ExternalIds; |
59 | | std::vector<std::string> VersionSuffixes; |
60 | | }; |
61 | | |
62 | | } // namespace Component |
63 | | } // namespace AST |
64 | | } // namespace WasmEdge |