LeviLamina
Loading...
Searching...
No Matches
ExpressionNode.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/util/molang/MolangParseConfig.h"
5
6// auto generated inclusion list
7#include "mc/molang/MolangVersion.h"
8#include "mc/platform/brstd/flat_set.h"
9#include "mc/util/MolangCompileResult.h"
10#include "mc/util/MolangQueryFunctionReturnType.h"
11#include "mc/util/molang/ExpressionOp.h"
12
13// auto generated forward declare list
14// clang-format off
15class Block;
16class BlockPos;
17class BlockSource;
18class HashedString;
19class RenderParams;
22struct MolangScriptArg;
23namespace Json { class Value; }
24namespace Molang::details { class IComplexExpression; }
25namespace Molang::details { class SourceTree; }
26namespace mce { class Color; }
27// clang-format on
28
30public:
31 // ExpressionNode inner types declare
32 // clang-format off
33 struct ResourceReference;
34 // clang-format on
35
36 // ExpressionNode inner types define
38 public:
39 // member variables
40 // NOLINTBEGIN
44 // NOLINTEND
45
46 public:
47 // prevent constructor by default
48 ResourceReference& operator=(ResourceReference const&);
51 };
52
53 using ResourceTable = ::std::unordered_map<::HashedString, ::ExpressionNode::ResourceReference>;
54
55 using MissingResourceSet =
57
59
60 using GetParticleTintFunc = ::std::function<::mce::Color(::Block const&, ::BlockSource&, ::BlockPos const&)>;
61
62public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<8, 16, ::std::variant<::std::unique_ptr<::Molang::details::IComplexExpression>, float>> mImpl;
66 // NOLINTEND
67
68public:
69 // prevent constructor by default
71
72public:
74 std::string const& expression,
75 ::MolangVersion molangVersion,
76 ::gsl::span<::HashedString const> querySetID
77 )
78 : ExpressionNode(expression, molangVersion) {
79 MolangParseConfig config;
80 config.mVersion = molangVersion;
81 config.mAllowedQuerySets = querySetID;
82 parse(expression, config);
83 }
84
85public:
86 // member functions
87 // NOLINTBEGIN
89
90 MCAPI ExpressionNode(::ExpressionNode const& rhs);
91
93
94 MCAPI explicit ExpressionNode(float value);
95
96 MCAPI ExpressionNode(::std::string const& expression, ::MolangVersion molangVersion);
97
98 MCAPI ExpressionNode(::Json::Value const& value, ::MolangParseConfig const& config);
99
100 MCAPI ExpressionNode(::MolangScriptArg const& value, ::ExpressionOp op);
101
102 MCAPI float evalAsFloat(::RenderParams& renderParams) const;
103
104 MCAPI ::MolangScriptArg const& evalGeneric(::RenderParams& renderParams) const;
105
106 MCAPI ::std::string getExpressionString() const;
107
108 MCAPI ::MolangCompileResult link();
109
110 MCAPI ::ExpressionNode& operator=(::ExpressionNode&&);
111
112 MCAPI ::ExpressionNode& operator=(::ExpressionNode const& rhs);
113
114 MCAPI ::ExpressionNode& operator=(float value);
115
116 MCAPI bool parse(::std::string_view expression, ::MolangParseConfig const& config);
117
118 MCAPI ~ExpressionNode();
119 // NOLINTEND
120
121public:
122 // static functions
123 // NOLINTBEGIN
124 MCAPI static bool _initializeMolangQueries();
125
126 MCAPI static void initializeMolang();
127
128 MCAPI static ::std::function<
129 ::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)> const*
130 queryFunctionAccessorFromString(
131 ::HashedString const& functionName,
132 ::MolangVersion molangVersion,
133 ::MolangQueryFunctionReturnType& functionReturnType,
134 bool missingIsOkay_returnNullIfSo
135 );
136
137 MCAPI static ::MolangQueryFunction& registerQueryFunction(
138 ::std::string_view queryFunctionName,
139 ::std::function<::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)> accessor,
140 ::std::string_view documentation,
141 ::MolangQueryFunctionReturnType returnType,
142 ::HashedString querySetIdentifier,
143 uint64 minArgumentCount,
144 uint64 maxArgumentCount,
145 ::std::initializer_list<int> const& experiments
146 );
147
148 MCAPI static void
149 unregisterQueryFunction(::std::string const& queryFunctionName, ::HashedString querySetIdentifier);
150 // NOLINTEND
151
152public:
153 // static variables
154 // NOLINTBEGIN
155 MCAPI static ::std::function<::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)>&
156 _defaultUnknownQueryFunction();
157
158 MCAPI static ::std::function<::mce::Color(::Block const&, ::BlockSource&, ::BlockPos const&)>&
159 mGetParticleTintFunc();
160
161 MCAPI static ::std::unordered_multimap<::HashedString, ::MolangQueryFunction>& mQueryFunctionAccessors();
162
163 MCAPI static ::std::unordered_map<::HashedString, ::std::unordered_set<::HashedString>>& mQuerySets();
164 // NOLINTEND
165
166public:
167 // constructor thunks
168 // NOLINTBEGIN
169 MCAPI void* $ctor(::ExpressionNode&&);
170
171 MCAPI void* $ctor(::ExpressionNode const& rhs);
172
173 MCAPI void* $ctor(::Molang::details::SourceTree root);
174
175 MCAPI void* $ctor(float value);
176
177 MCAPI void* $ctor(::std::string const& expression, ::MolangVersion molangVersion);
178
179 MCAPI void* $ctor(::Json::Value const& value, ::MolangParseConfig const& config);
180
181 MCAPI void* $ctor(::MolangScriptArg const& value, ::ExpressionOp op);
182 // NOLINTEND
183
184public:
185 // destructor thunk
186 // NOLINTBEGIN
187 MCFOLD void $dtor();
188 // NOLINTEND
189};
Definition BlockPos.h:18
Definition BlockSource.h:67
Definition Block.h:38
Definition ExpressionNode.h:29
Definition HashedString.h:5
Definition Value.h:16
Definition IComplexExpression.h:21
Definition SourceTree.h:16
Definition RenderParams.h:30
Definition flat_set.h:8
Definition Color.h:13
Definition ExpressionNode.h:37
Definition MolangParseConfig.h:14
Definition MolangQueryFunction.h:16
Definition MolangScriptArg.h:33
Definition Alias.h:14