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 // member functions
50 // NOLINTBEGIN
51 MCAPI ~DeferredChangeNotification();
52 // NOLINTEND
53
54 public:
55 // destructor thunk
56 // NOLINTBEGIN
57 MCAPI void $dtor();
58 // NOLINTEND
59 };
60
61 using OnRouteChangedCallback = void(
62 ::std::optional<::OreUI::RouterLocation> const&,
63 ::std::optional<::OreUI::RouterLocation> const&,
64 ::OreUI::RouterAction
65 );
66
67public:
68 // member variables
69 // NOLINTBEGIN
70 ::ll::TypedStorage<8, 128, ::OreUI::RouterHistory> mHistory;
71 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::IRouteMatcher const>> mRouteMatcher;
72 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::ISceneStack>> mSceneStack;
73 ::ll::TypedStorage<
74 8,
75 128,
76 ::Bedrock::PubSub::Publisher<
77 void(
78 ::std::optional<::OreUI::RouterLocation> const&,
79 ::std::optional<::OreUI::RouterLocation> const&,
80 ::OreUI::RouterAction
81 ),
82 ::Bedrock::PubSub::ThreadModel::MultiThreaded,
83 0>>
84 mOnRouteChangedPublisher;
85 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler>> mPrerequisiteHandler;
86 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::RouterEventing>> mEventing;
87 ::ll::TypedStorage<1, 1, bool> mIsNotifyingListeners;
88 ::ll::TypedStorage<8, 24, ::std::vector<::OreUI::Router::DeferredChangeNotification>> mDeferredChangeNotifications;
89 // NOLINTEND
90
91public:
92 // prevent constructor by default
93 Router();
94
95public:
96 // member functions
97 // NOLINTBEGIN
98 MCAPI Router(
99 ::std::unique_ptr<::OreUI::IRouteMatcher const> routeMatcher,
100 ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler> prerequisiteHandler,
101 ::std::unique_ptr<::OreUI::RouterEventing> routerEventing,
102 ::Bedrock::NotNullNonOwnerPtr<::ISceneStack> const& sceneStack
103 );
104
105 MCAPI void _handleSceneStackPop(
106 ::std::shared_ptr<::AbstractScene> const& newTopScreen,
107 bool routeAction,
108 ::std::optional<::OreUI::RouteAction> const&
109 );
110
111 MCAPI void _handleSceneStackPush(
112 ::std::shared_ptr<::AbstractScene> const& newScreen,
113 ::std::optional<::OreUI::RouteAction> const& routeAction
114 );
115
116 MCAPI void _onChange(
117 ::std::optional<::OreUI::RouterLocation> const& oldLocation,
118 ::std::optional<::OreUI::RouterLocation> const& currentLocation
119 );
120
121 MCAPI bool _pushRoute(::std::string const& route, ::OreUI::Router::RouterPushMode mode);
122
123 MCAPI void _replaceCurrentRouteInHistory(::std::string const& newRoute, ::OreUI::RouteHistoryAction action);
124
125 MCAPI bool _shouldGoBackAndReplaceInsteadOfPush(::std::string const& newRoute) const;
126
127 MCAPI bool _shouldPopCurrentScreenOnReplacingWithIncompatibleRoute() const;
128
129 MCAPI ::Bedrock::PubSub::Subscription addObserver(
130 ::std::function<void(
131 ::std::optional<::OreUI::RouterLocation> const&,
132 ::std::optional<::OreUI::RouterLocation> const&,
133 ::OreUI::RouterAction
134 )> const& callback
135 );
136
137 MCAPI bool areRoutesCompatible(::std::string const& routeA, ::std::string const& routeB) const;
138
139 MCAPI ::std::optional<::OreUI::RouterLocation> getCurrentLocation() const;
140
141 MCAPI ::std::vector<::std::string> getFullHistory() const;
142
143 MCFOLD ::std::vector<::OreUI::RouterLocation> const& getFullRouterLocationHistory() const;
144
145 MCFOLD uint64 getHistoryLength() const;
146
147 MCAPI void goBack();
148
149 MCAPI bool isCurrentRoute(::std::string_view route) const;
150
151 MCAPI bool pushRoute(::std::string const& route);
152
153 MCAPI bool pushRouteWithFlux(::std::string const& route);
154
155 MCAPI bool replaceRoute(::std::string const& route);
156
157 MCAPI void replaceRouteMatcher(::std::unique_ptr<::OreUI::IRouteMatcher> newRouteMatcher);
158
159 MCAPI ~Router();
160 // NOLINTEND
161
162public:
163 // static variables
164 // NOLINTBEGIN
165 MCAPI static ::std::add_lvalue_reference_t<char const[]> BEDROCK_PREFIX();
166 // NOLINTEND
167
168public:
169 // constructor thunks
170 // NOLINTBEGIN
171 MCAPI void* $ctor(
172 ::std::unique_ptr<::OreUI::IRouteMatcher const> routeMatcher,
173 ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler> prerequisiteHandler,
174 ::std::unique_ptr<::OreUI::RouterEventing> routerEventing,
175 ::Bedrock::NotNullNonOwnerPtr<::ISceneStack> const& sceneStack
176 );
177 // NOLINTEND
178
179public:
180 // destructor thunk
181 // NOLINTBEGIN
182 MCAPI void $dtor();
183 // NOLINTEND
184};
185
186} // 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 RouteAction.h:7