LeviLamina
Loading...
Searching...
No Matches
MolangVariableMap.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/string/HashedString.h"
5#include "mc/util/MolangVariable.h"
6
7// auto generated inclusion list
8#include "mc/util/MolangVariableIndex.h"
9
10// auto generated forward declare list
11// clang-format off
12class HashedString;
13class MolangVariable;
14struct MolangScriptArg;
15// clang-format on
16
17class MolangVariableMap {
18public:
19 LLAPI void setMolangVariable(::MolangVariableIndex molangVariableIndex, ::MolangScriptArg const& value);
20
21#ifdef LL_PLAT_S
22 LLAPI void setMolangVariable(uint64 variableNameHash, char const* variableName, ::MolangScriptArg const& value);
23
24 LLAPI void setMolangVariable(HashedString const& variableName, ::MolangScriptArg const& value);
25#endif
26
27 LLAPI void setMolangVariable(
28 uint64 variableNameHash,
29 char const* variableName,
30 ::MolangScriptArg const& value,
31 bool allowSpecialCharacters
32 );
33
34public:
35 // MolangVariableMap inner types define
36 enum class MissingVariableHandling : int {
37 Error = 0,
38 NoError = 1,
39 };
40
41public:
42 // member variables
43 // NOLINTBEGIN
44 ::ll::TypedStorage<8, 24, ::std::vector<short>> mMapFromVariableIndexToVariableArrayOffset;
45 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::MolangVariable>>> mVariables;
46 ::ll::TypedStorage<1, 1, bool> mHasPublicVariables;
47 // NOLINTEND
48
49public:
50 // prevent constructor by default
51 MolangVariableMap(MolangVariableMap const& rhs) {
52 mMapFromVariableIndexToVariableArrayOffset = rhs.mMapFromVariableIndexToVariableArrayOffset;
53 mVariables = {};
54 for (auto& ptr : *rhs.mVariables) {
55 mVariables->push_back(std::make_unique<MolangVariable>(*ptr));
56 }
57 mHasPublicVariables = rhs.mHasPublicVariables;
58 }
59 MolangVariableMap();
60
61public:
62 // member functions
63 // NOLINTBEGIN
64 MCAPI ::MolangVariable* _getMolangVariable(
65 ::MolangVariableIndex molangVariableIndex,
66 ::MolangVariableMap::MissingVariableHandling errorHandling
67 ) const;
68
69 MCAPI ::MolangVariable* _getOrAddMolangVariable(::MolangVariableIndex molangVariableIndex);
70
71 MCAPI ::MolangVariableMap& clear();
72
73#ifdef LL_PLAT_C
74 MCAPI ::MolangScriptArg const& getMolangVariable(uint64 variableNameHash, char const*) const;
75#endif
76
77 MCAPI ::MolangVariableMap& operator=(::MolangVariableMap&& rhs);
78
79 MCAPI ::MolangVariableMap& operator=(::MolangVariableMap const& rhs);
80
81 MCAPI bool operator==(::MolangVariableMap const& rhs) const;
82
83 MCAPI void setMolangStructMember(
84 ::MolangVariableIndex molangVariableIndex,
85 ::HashedString const& memberNameDepth0,
86 ::MolangScriptArg const& value
87 );
88
89#ifdef LL_PLAT_C
90 MCAPI void setMolangVariable(::HashedString const& variableName, ::MolangScriptArg const& value);
91
92 MCAPI void setMolangVariable(uint64 variableNameHash, char const* variableName, ::MolangScriptArg const& value);
93#endif
94
95 MCAPI ~MolangVariableMap();
96 // NOLINTEND
97
98public:
99 // destructor thunk
100 // NOLINTBEGIN
101 MCAPI void $dtor();
102 // NOLINTEND
103};
Definition HashedString.h:5
Definition MolangVariable.h:15
Definition MolangScriptArg.h:28