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;
20class RenderParams;
26struct MolangScriptArg;
27namespace Json { class Value; }
28namespace Molang::details { class IComplexExpression; }
29namespace Molang::details { class SourceTree; }
30namespace cereal { struct ReflectionCtx; }
31namespace mce { class Color; }
32// clang-format on
33
34class ExpressionNode {
35public:
36 // ExpressionNode inner types declare
37 // clang-format off
38 struct ResourceReference;
39 // clang-format on
40
41 // ExpressionNode inner types define
42 struct ResourceReference {
43 public:
44// member variables
45// NOLINTBEGIN
46#ifdef LL_PLAT_S
48#else // LL_PLAT_C
50#endif
53 // NOLINTEND
54
55#ifdef LL_PLAT_S
56 public:
57 // prevent constructor by default
58 ResourceReference& operator=(ResourceReference const&);
59 ResourceReference(ResourceReference const&);
60 ResourceReference();
61
62#else // LL_PLAT_C
63 public:
64 // prevent constructor by default
65 ResourceReference& operator=(ResourceReference const&);
66 ResourceReference(ResourceReference const&);
67
68#endif
69 public:
70 // member functions
71 // NOLINTBEGIN
72#ifdef LL_PLAT_C
73 MCNAPI ResourceReference();
74
75 MCNAPI explicit ResourceReference(::MolangDataDrivenGeometry const& geometry);
76
77 MCNAPI explicit ResourceReference(::MaterialVariants const& matVariants);
78
79 MCNAPI explicit ResourceReference(::MolangClientTextureSet const& textureSet);
80
81 MCNAPI ~ResourceReference();
82#endif
83 // NOLINTEND
84
85 public:
86 // constructor thunks
87 // NOLINTBEGIN
88#ifdef LL_PLAT_C
89 MCNAPI void* $ctor();
90
91 MCNAPI void* $ctor(::MolangDataDrivenGeometry const& geometry);
92
93 MCNAPI void* $ctor(::MaterialVariants const& matVariants);
94
95 MCNAPI void* $ctor(::MolangClientTextureSet const& textureSet);
96#endif
97 // NOLINTEND
98
99 public:
100 // destructor thunk
101 // NOLINTBEGIN
102#ifdef LL_PLAT_C
103 MCNAPI void $dtor();
104#endif
105 // NOLINTEND
106 };
107
108 using GetParticleTintFunc = ::std::function<::mce::Color(::Block const&, ::BlockSource&, ::BlockPos const&)>;
109
110 using IComplexExpression = ::Molang::details::IComplexExpression;
111
112 using MissingResourceSet =
114
115 using ResourceTable = ::std::unordered_map<::HashedString, ::ExpressionNode::ResourceReference>;
116
117public:
118 // member variables
119 // NOLINTBEGIN
120 ::ll::TypedStorage<8, 16, ::std::variant<::std::unique_ptr<::Molang::details::IComplexExpression>, float>> mImpl;
121 // NOLINTEND
122
123#ifdef LL_PLAT_S
124public:
125 // prevent constructor by default
126 ExpressionNode();
127
128#else // LL_PLAT_C
129#endif
130public:
131 ExpressionNode(
132 std::string const& expression,
133 ::MolangVersion molangVersion,
134 ::gsl::span<::HashedString const> querySetID
135 )
136 : ExpressionNode(expression, molangVersion) {
137 MolangParseConfig config;
138 config.mVersion = molangVersion;
139 config.mAllowedQuerySets = querySetID;
140 parse(expression, config);
141 }
142
143public:
144 // member functions
145 // NOLINTBEGIN
146#ifdef LL_PLAT_C
147 MCAPI ExpressionNode();
148#endif
149
151
152#ifdef LL_PLAT_C
153 MCAPI explicit ExpressionNode(::MaterialVariants const& materialVariants);
154#endif
155
156 MCAPI ExpressionNode(::ExpressionNode const& rhs);
157
158#ifdef LL_PLAT_C
160#endif
161
162 MCAPI ExpressionNode(::std::string const& expression, ::MolangVersion molangVersion);
163
164#ifdef LL_PLAT_C
165 MCAPI ExpressionNode(char const* expression, ::MolangVersion molangVersion);
166#endif
167
168 MCAPI ExpressionNode(::Json::Value const& value, ::MolangParseConfig const& config);
169
170 MCAPI ExpressionNode(::MolangScriptArg const& value, ::ExpressionOp op);
171
172 MCAPI float evalAsFloat(::RenderParams& renderParams) const;
173
174 MCAPI ::MolangScriptArg const& evalGeneric(::RenderParams& renderParams) const;
175
176 MCAPI ::std::string getExpressionString() const;
177
178#ifdef LL_PLAT_C
179 MCAPI bool hasVariableAssignments() const;
180#endif
181
182 MCAPI ::MolangCompileResult link();
183
184 MCAPI ::ExpressionNode& operator=(::ExpressionNode&&);
185
186#ifdef LL_PLAT_C
187 MCAPI ::ExpressionNode& operator=(::MaterialVariants const& materialVariants);
188#endif
189
190 MCAPI ::ExpressionNode& operator=(::ExpressionNode const& rhs);
191
192 MCAPI ::ExpressionNode& operator=(float value);
193
194 MCAPI bool parse(::std::string_view expression, ::MolangParseConfig const& config);
195
196#ifdef LL_PLAT_C
197 MCAPI void
198 replaceArrayVariables(::std::unordered_map<::HashedString, ::ExpressionNode>& dataMap, bool compileProgram);
199#endif
200
201 MCAPI ~ExpressionNode();
202 // NOLINTEND
203
204public:
205 // static functions
206 // NOLINTBEGIN
207 MCAPI static bool _initializeMolangQueries(::ExpressionQueries&& queries);
208
209 MCAPI static void bindType(::cereal::ReflectionCtx& ctx);
210
211#ifdef LL_PLAT_S
212 MCAPI static void initializeMolang(::ExpressionQueries&& queries);
213#endif
214
215#ifdef LL_PLAT_C
216 MCAPI static ::std::function<
217 ::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)> const*
218 queryFunctionAccessorFromString(
219 ::HashedString const& functionName,
220 ::MolangVersion molangVersion,
221 ::MolangQueryFunctionReturnType& functionReturnType,
222 bool missingIsOkay_returnNullIfSo
223 );
224#endif
225
226 MCAPI static ::MolangQueryFunction& registerQueryFunction(
227 ::std::string_view queryFunctionName,
228 ::std::function<::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)> accessor,
229 ::std::string_view documentation,
230 ::MolangQueryFunctionReturnType returnType,
231 ::HashedString querySetIdentifier,
232 uint64 minArgumentCount,
233 uint64 maxArgumentCount,
234 ::std::initializer_list<int> const& experiments
235 );
236
237 MCAPI static void
238 unregisterQueryFunction(::std::string const& queryFunctionName, ::HashedString querySetIdentifier);
239 // NOLINTEND
240
241public:
242 // static variables
243 // NOLINTBEGIN
244 MCAPI static ::std::function<::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)>&
245 _defaultUnknownQueryFunction();
246
247 MCAPI static ::std::function<::mce::Color(::Block const&, ::BlockSource&, ::BlockPos const&)>&
248 mGetParticleTintFunc();
249
250 MCAPI static ::std::unordered_multimap<::HashedString, ::MolangQueryFunction>& mQueryFunctionAccessors();
251
252 MCAPI static ::std::unordered_map<::HashedString, ::std::unordered_set<::HashedString>>& mQuerySets();
253 // NOLINTEND
254
255public:
256 // constructor thunks
257 // NOLINTBEGIN
258#ifdef LL_PLAT_C
259 MCAPI void* $ctor();
260#endif
261
262 MCAPI void* $ctor(::ExpressionNode&&);
263
264#ifdef LL_PLAT_C
265 MCAPI void* $ctor(::MaterialVariants const& materialVariants);
266#endif
267
268 MCAPI void* $ctor(::ExpressionNode const& rhs);
269
270#ifdef LL_PLAT_C
271 MCAPI void* $ctor(::Molang::details::SourceTree root);
272#endif
273
274 MCAPI void* $ctor(::std::string const& expression, ::MolangVersion molangVersion);
275
276#ifdef LL_PLAT_C
277 MCAPI void* $ctor(char const* expression, ::MolangVersion molangVersion);
278#endif
279
280 MCAPI void* $ctor(::Json::Value const& value, ::MolangParseConfig const& config);
281
282 MCAPI void* $ctor(::MolangScriptArg const& value, ::ExpressionOp op);
283 // NOLINTEND
284
285public:
286 // destructor thunk
287 // NOLINTBEGIN
288 MCFOLD void $dtor();
289 // NOLINTEND
290};
291
292// free functions
293// NOLINTBEGIN
294MCAPI bool operator==(::ExpressionNode const& lhs, ::ExpressionNode const& rhs);
295// NOLINTEND
Definition BlockPos.h:19
Definition BlockSource.h:71
Definition Block.h:43
Definition ExpressionNode.h:34
Definition HashedString.h:5
Definition Value.h:16
Definition MaterialVariants.h:8
Definition IComplexExpression.h:21
Definition SourceTree.h:16
Definition RenderParams.h:30
Definition flat_set.h:10
Definition Color.h:13
Definition ExpressionNode.h:42
Definition ExpressionQueries.h:12
Definition MolangClientTextureSet.h:18
Definition MolangDataDrivenGeometry.h:13
Definition MolangParseConfig.h:14
Definition MolangQueryFunction.h:16
Definition MolangScriptArg.h:33
Definition ReflectionCtx.h:11
Definition ctx.h:5
Definition Alias.h:14