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