LeviLamina
Loading...
Searching...
No Matches
Router.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/oreui/routing/RouteHistoryAction.h"
7#include "mc/client/gui/oreui/routing/RouterAction.h"
8#include "mc/client/gui/oreui/routing/RouterHistory.h"
9#include "mc/client/gui/oreui/routing/RouterLocation.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11#include "mc/deps/core/utility/pub_sub/Publisher.h"
12
13// auto generated forward declare list
14// clang-format off
15class AbstractScene;
16class ISceneStack;
17namespace Bedrock::PubSub { class Subscription; }
18namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
19namespace OreUI { class IRouteMatcher; }
20namespace OreUI { class IRoutePrerequisiteHandler; }
21namespace OreUI { class RouterEventing; }
22namespace OreUI { struct RouteAction; }
23// clang-format on
24
25namespace OreUI {
26
27class Router {
28public:
29 // Router inner types declare
30 // clang-format off
32 // clang-format on
33
34 // Router inner types define
35 enum class RouterPushMode : int {
36 Normal = 0,
37 Flux = 1,
38 };
39
41 public:
42 // member variables
43 // NOLINTBEGIN
44 ::ll::TypedStorage<8, 160, ::std::optional<::OreUI::RouterLocation>> mOldLocation;
45 ::ll::TypedStorage<8, 160, ::std::optional<::OreUI::RouterLocation>> mCurrentLocation;
46 // NOLINTEND
47
48 public:
49 // prevent constructor by default
50 DeferredChangeNotification();
51
52 public:
53 // member functions
54 // NOLINTBEGIN
55 MCAPI DeferredChangeNotification(
56 ::std::optional<::OreUI::RouterLocation> const& oldLocation,
57 ::std::optional<::OreUI::RouterLocation> const& currentLocation
58 );
59
60 MCAPI ~DeferredChangeNotification();
61 // NOLINTEND
62
63 public:
64 // constructor thunks
65 // NOLINTBEGIN
66 MCAPI void* $ctor(
67 ::std::optional<::OreUI::RouterLocation> const& oldLocation,
68 ::std::optional<::OreUI::RouterLocation> const& currentLocation
69 );
70 // NOLINTEND
71
72 public:
73 // destructor thunk
74 // NOLINTBEGIN
75 MCAPI void $dtor();
76 // NOLINTEND
77 };
78
79 using OnRouteChangedCallback = void(
80 ::std::optional<::OreUI::RouterLocation> const&,
81 ::std::optional<::OreUI::RouterLocation> const&,
82 ::OreUI::RouterAction
83 );
84
85public:
86 // member variables
87 // NOLINTBEGIN
88 ::ll::TypedStorage<8, 128, ::OreUI::RouterHistory> mHistory;
89 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::IRouteMatcher const>> mRouteMatcher;
90 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::ISceneStack>> mSceneStack;
91 ::ll::TypedStorage<
92 8,
93 128,
94 ::Bedrock::PubSub::Publisher<
95 void(
96 ::std::optional<::OreUI::RouterLocation> const&,
97 ::std::optional<::OreUI::RouterLocation> const&,
98 ::OreUI::RouterAction
99 ),
100 ::Bedrock::PubSub::ThreadModel::MultiThreaded,
101 0>>
102 mOnRouteChangedPublisher;
103 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler>> mPrerequisiteHandler;
104 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::RouterEventing>> mEventing;
105 ::ll::TypedStorage<1, 1, bool> mIsNotifyingListeners;
106 ::ll::TypedStorage<8, 24, ::std::vector<::OreUI::Router::DeferredChangeNotification>> mDeferredChangeNotifications;
107 // NOLINTEND
108
109public:
110 // prevent constructor by default
111 Router();
112
113public:
114 // member functions
115 // NOLINTBEGIN
116 MCAPI Router(
117 ::std::unique_ptr<::OreUI::IRouteMatcher const> routeMatcher,
118 ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler> prerequisiteHandler,
119 ::std::unique_ptr<::OreUI::RouterEventing> routerEventing,
120 ::Bedrock::NotNullNonOwnerPtr<::ISceneStack> const& sceneStack
121 );
122
123 MCAPI void _handleSceneStackPop(
124 ::std::shared_ptr<::AbstractScene> const& newTopScreen,
125 bool,
126 ::std::optional<::OreUI::RouteAction> const& routeAction
127 );
128
129 MCAPI void _handleSceneStackPush(
130 ::std::shared_ptr<::AbstractScene> const& newScreen,
131 ::std::optional<::OreUI::RouteAction> const& routeAction
132 );
133
134 MCAPI void _onChange(
135 ::std::optional<::OreUI::RouterLocation> const& oldLocation,
136 ::std::optional<::OreUI::RouterLocation> const& currentLocation
137 );
138
139 MCAPI bool _pushRoute(::std::string const& route, ::OreUI::Router::RouterPushMode mode);
140
141 MCAPI void _replaceCurrentRouteInHistory(::std::string const& newRoute, ::OreUI::RouteHistoryAction action);
142
143 MCAPI bool _shouldGoBackAndReplaceInsteadOfPush(::std::string const& newRoute) const;
144
145 MCAPI bool _shouldPopCurrentScreenOnReplacingWithIncompatibleRoute() const;
146
147 MCFOLD ::Bedrock::PubSub::Subscription addObserver(
148 ::std::function<void(
149 ::std::optional<::OreUI::RouterLocation> const&,
150 ::std::optional<::OreUI::RouterLocation> const&,
151 ::OreUI::RouterAction
152 )> const& callback
153 );
154
155 MCAPI ::std::optional<::OreUI::RouterLocation> getCurrentLocation() const;
156
157 MCAPI void goBack();
158
159 MCAPI bool isCurrentRoute(::std::string_view route) const;
160
161 MCAPI bool replaceRoute(::std::string const& route);
162
163 MCAPI void replaceRouteMatcher(::std::unique_ptr<::OreUI::IRouteMatcher> newRouteMatcher);
164
165 MCAPI ~Router();
166 // NOLINTEND
167
168public:
169 // static variables
170 // NOLINTBEGIN
171 MCAPI static ::std::add_lvalue_reference_t<char const[]> BEDROCK_PREFIX();
172 // NOLINTEND
173
174public:
175 // constructor thunks
176 // NOLINTBEGIN
177 MCAPI void* $ctor(
178 ::std::unique_ptr<::OreUI::IRouteMatcher const> routeMatcher,
179 ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler> prerequisiteHandler,
180 ::std::unique_ptr<::OreUI::RouterEventing> routerEventing,
181 ::Bedrock::NotNullNonOwnerPtr<::ISceneStack> const& sceneStack
182 );
183 // NOLINTEND
184
185public:
186 // destructor thunk
187 // NOLINTBEGIN
188 MCAPI void $dtor();
189 // NOLINTEND
190};
191
192} // namespace OreUI
Definition AbstractScene.h:5
Definition Subscription.h:10
Definition ISceneStack.h:5
Definition IRouteMatcher.h:7
Definition IRoutePrerequisiteHandler.h:7
Definition RouterEventing.h:7
Definition Router.h:7
Definition MultiThreaded.h:12
Definition RouteAction.h:7