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 cereal { struct ReflectionCtx; }
30namespace mce { class Color; }
31// clang-format on
32
33class ExpressionNode {
34public:
35 // ExpressionNode inner types declare
36 // clang-format off
37 struct ResourceReference;
38 // clang-format on
39
40 // ExpressionNode inner types define
41 struct ResourceReference {
42 public:
43// member variables
44// NOLINTBEGIN
45#ifdef LL_PLAT_S
47#else // LL_PLAT_C
49#endif
52 // NOLINTEND
53
54 public:
55 // prevent constructor by default
56 ResourceReference& operator=(ResourceReference const&);
57 ResourceReference(ResourceReference const&);
58 ResourceReference();
59
60 public:
61 // member functions
62 // NOLINTBEGIN
63
64 // NOLINTEND
65
66 public:
67 // constructor thunks
68 // NOLINTBEGIN
69 MCNAPI_C void* $ctor();
70
71 MCNAPI_C void* $ctor(::MolangDataDrivenGeometry const& geometry);
72
73 MCNAPI_C void* $ctor(::MaterialVariants const& matVariants);
74
75 MCNAPI_C void* $ctor(::MolangClientTextureSet const& textureSet);
76 // NOLINTEND
77
78 public:
79 // destructor thunk
80 // NOLINTBEGIN
81 MCNAPI_C void $dtor();
82 // NOLINTEND
83 };
84
85 using GetParticleTintFunc = ::std::function<::mce::Color(::Block const&, ::BlockSource&, ::BlockPos const&)>;
86
87 using IComplexExpression = ::Molang::details::IComplexExpression;
88
89 using MissingResourceSet =
91
92 using ResourceTable = ::std::unordered_map<::HashedString, ::ExpressionNode::ResourceReference>;
93
94public:
95 // member variables
96 // NOLINTBEGIN
97 ::ll::TypedStorage<8, 16, ::std::variant<::std::unique_ptr<::Molang::details::IComplexExpression>, float>> mImpl;
98 // NOLINTEND
99
100public:
101 // prevent constructor by default
102 ExpressionNode();
103
104public:
105 ExpressionNode(
106 std::string const& expression,
107 ::MolangVersion molangVersion,
108 ::gsl::span<::HashedString const> querySetID
109 )
110 : ExpressionNode(expression, molangVersion) {
111 MolangParseConfig config;
112 config.mVersion = molangVersion;
113 config.mAllowedQuerySets = querySetID;
114 parse(expression, config);
115 }
116
117public:
118 // member functions
119 // NOLINTBEGIN
121
122 MCAPI ExpressionNode(::ExpressionNode const& rhs);
123
124 MCAPI ExpressionNode(::std::string const& expression, ::MolangVersion molangVersion);
125
126 MCAPI ExpressionNode(::Json::Value const& value, ::MolangParseConfig const& config);
127
128 MCAPI ExpressionNode(::MolangScriptArg const& value, ::ExpressionOp op);
129
130 MCAPI float evalAsFloat(::RenderParams& renderParams) const;
131
132 MCAPI ::MolangScriptArg const& evalGeneric(::RenderParams& renderParams) const;
133
134 MCAPI ::std::string getExpressionString() const;
135
136 MCAPI_C bool hasVariableAssignments() const;
137
138 MCAPI ::MolangCompileResult link();
139
140 MCAPI ::ExpressionNode& operator=(::ExpressionNode&&);
141
142 MCAPI ::ExpressionNode& operator=(::ExpressionNode const& rhs);
143
144 MCAPI ::ExpressionNode& operator=(float value);
145
146 MCAPI bool parse(::std::string_view expression, ::MolangParseConfig const& config);
147
148 MCAPI_C void
149 replaceArrayVariables(::std::unordered_map<::HashedString, ::ExpressionNode>& dataMap, bool compileProgram);
150
151 MCAPI ~ExpressionNode();
152 // NOLINTEND
153
154public:
155 // static functions
156 // NOLINTBEGIN
157 MCAPI static bool _initializeMolangQueries(::ExpressionQueries&& queries);
158
159 MCAPI static void bindType(::cereal::ReflectionCtx& ctx);
160
161 MCAPI_S static void initializeMolang(::ExpressionQueries&& queries);
162
163 MCAPI_C static ::std::function<
164 ::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)> const*
165 queryFunctionAccessorFromString(
166 ::HashedString const& functionName,
167 ::MolangVersion molangVersion,
168 ::MolangQueryFunctionReturnType& functionReturnType,
169 bool missingIsOkay_returnNullIfSo
170 );
171
172 MCAPI static ::MolangQueryFunction& registerQueryFunction(
173 ::std::string_view queryFunctionName,
174 ::std::function<::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)> accessor,
175 ::std::string_view documentation,
176 ::MolangQueryFunctionReturnType returnType,
177 ::HashedString querySetIdentifier,
178 uint64 minArgumentCount,
179 uint64 maxArgumentCount,
180 ::std::initializer_list<int> const& experiments
181 );
182
183 MCAPI static void
184 unregisterQueryFunction(::std::string const& queryFunctionName, ::HashedString querySetIdentifier);
185 // NOLINTEND
186
187public:
188 // static variables
189 // NOLINTBEGIN
190 MCAPI static ::std::function<::MolangScriptArg const&(::RenderParams&, ::std::vector<::ExpressionNode> const&)>&
191 _defaultUnknownQueryFunction();
192
193 MCAPI static ::std::function<::mce::Color(::Block const&, ::BlockSource&, ::BlockPos const&)>&
194 mGetParticleTintFunc();
195
196 MCAPI static ::std::unordered_multimap<::HashedString, ::MolangQueryFunction>& mQueryFunctionAccessors();
197
198 MCAPI static ::std::unordered_map<::HashedString, ::std::unordered_set<::HashedString>>& mQuerySets();
199 // NOLINTEND
200
201public:
202 // constructor thunks
203 // NOLINTBEGIN
204 MCAPI_C void* $ctor();
205
206 MCAPI void* $ctor(::ExpressionNode&&);
207
208 MCAPI_C void* $ctor(::MaterialVariants const& materialVariants);
209
210 MCAPI void* $ctor(::ExpressionNode const& rhs);
211
212 MCAPI void* $ctor(::std::string const& expression, ::MolangVersion molangVersion);
213
214 MCAPI_C void* $ctor(char const* expression, ::MolangVersion molangVersion);
215
216 MCAPI void* $ctor(::Json::Value const& value, ::MolangParseConfig const& config);
217
218 MCAPI void* $ctor(::MolangScriptArg const& value, ::ExpressionOp op);
219 // NOLINTEND
220
221public:
222 // destructor thunk
223 // NOLINTBEGIN
224 MCFOLD void $dtor();
225 // NOLINTEND
226};
Definition BlockPos.h:19
Definition BlockSource.h:68
Definition Block.h:43
Definition ExpressionNode.h:33
Definition HashedString.h:5
Definition Value.h:16
Definition MaterialVariants.h:8
Definition IComplexExpression.h:21
Definition RenderParams.h:30
Definition flat_set.h:8
Definition Color.h:13
Definition ExpressionNode.h:41
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