LeviLamina
Loading...
Searching...
No Matches
DataStoreSync.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/scripting/data_sync/DDUI.h"
5
6// auto generated inclusion list
7#include "mc/deps/core/utility/pub_sub/Publisher.h"
8#include "mc/scripting/data_sync/DataStoreChange.h"
9#include "mc/scripting/data_sync/DataStoreRemoval.h"
10#include "mc/scripting/data_sync/DataStoreUpdate.h"
11
12// auto generated forward declare list
13// clang-format off
14namespace Bedrock::DDUI::PathUtility { struct PathQueryError; }
15namespace Bedrock::PubSub { class Subscription; }
16namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
17namespace cereal { class DynamicValue; }
18// clang-format on
19
20namespace Bedrock::DDUI {
21
23public:
24 // DataStoreSync inner types define
25 using PropertyChangePublisher = ::Bedrock::PubSub::
27
28public:
29 // member variables
30 // NOLINTBEGIN
31 ::ll::TypedStorage<
32 8,
33 64,
34 ::std::unordered_map<::std::string, ::std::unordered_map<::std::string, ::cereal::DynamicValue>>>
35 mDataStores;
36 ::ll::TypedStorage<
37 8,
38 64,
39 ::std::unordered_map<
40 ::std::string,
41 ::std::unordered_map<
42 ::std::string,
43 ::std::unordered_map<
44 ::std::string,
46 void(::cereal::DynamicValue const*),
48 0>,
49 ::std::hash<::std::string>,
50 ::std::equal_to<::std::string>>>>>
51 mPropertyPathPublishers;
52 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unordered_map<::std::string, uint>>>
53 mPropertyUpdateCount;
54 ::ll::TypedStorage<
55 8,
56 64,
57 ::std::unordered_map<
58 ::std::string,
59 ::std::unordered_map<
60 ::std::string,
61 ::std::unordered_map<::std::string, uint, ::std::hash<::std::string>, ::std::equal_to<::std::string>>>>>
62 mPathUpdateCount;
63 ::ll::TypedStorage<
64 8,
65 24,
66 ::std::vector<::std::variant<
70 mOutgoingChanges;
71 // NOLINTEND
72
73public:
74 [[nodiscard]] cereal::DynamicValue const* get(std::string const& datastoreName, std::string const& property) const {
75 return getNestedMapValueConst(mDataStores.get(), datastoreName, property);
76 }
77
78public:
79 // virtual functions
80 // NOLINTBEGIN
81#ifdef LL_PLAT_S
82 virtual ~DataStoreSync() = default;
83#else // LL_PLAT_C
84 virtual ~DataStoreSync();
85#endif
86
87 virtual void clear(::std::string const& datastoreName, bool addToOutgoingChanges);
88
89 virtual void assertAppropriateThread() const = 0;
90 // NOLINTEND
91
92public:
93 // member functions
94 // NOLINTBEGIN
95#ifdef LL_PLAT_C
96 MCAPI DataStoreSync();
97#endif
98
99 MCAPI ::nonstd::
100 expected<::gsl::not_null<::cereal::DynamicValue const*>, ::Bedrock::DDUI::PathUtility::PathQueryError>
101 getPath(::std::string const& dataStoreName, ::std::string const& property, ::std::string const& path) const;
102
103 MCAPI ::Bedrock::PubSub::Subscription listen(
104 ::std::string const& datastoreName,
105 ::std::string const& property,
106 ::std::string const& path,
107 ::std::function<void(::cereal::DynamicValue const*)> onChange
108 );
109
110 MCAPI void
111 set(::std::string const& datastoreName,
112 ::std::string const& property,
113 ::cereal::DynamicValue const& obj,
114 bool addToOutgoingChanges);
115
116 MCAPI ::nonstd::expected<void, ::Bedrock::DDUI::PathUtility::PathQueryError> setPath(
117 ::std::string const& dataStoreName,
118 ::std::string const& propertyName,
119 ::std::string const& path,
120 ::std::variant<double, bool, ::std::string> const& data,
121 bool addToOutgoing,
122 bool allowStringToObjectUpdates
123 );
124 // NOLINTEND
125
126public:
127 // constructor thunks
128 // NOLINTBEGIN
129#ifdef LL_PLAT_C
130 MCAPI void* $ctor();
131#endif
132 // NOLINTEND
133
134public:
135 // destructor thunk
136 // NOLINTBEGIN
137#ifdef LL_PLAT_C
138 MCAPI void $dtor();
139#endif
140 // NOLINTEND
141
142public:
143 // virtual function thunks
144 // NOLINTBEGIN
145 MCAPI void $clear(::std::string const& datastoreName, bool addToOutgoingChanges);
146
147
148 // NOLINTEND
149
150public:
151 // vftables
152 // NOLINTBEGIN
153 MCNAPI static void** $vftable();
154 // NOLINTEND
155};
156
157} // namespace Bedrock::DDUI
Definition DataStoreSync.h:22
static MCAPI void ** $vftable()
Definition Publisher.h:25
Definition Subscription.h:10
Definition DynamicValue.h:14
Definition DataStoreChange.h:10
Definition DataStoreRemoval.h:7
Definition DataStoreUpdate.h:7
Definition PathQueryError.h:7