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