diff --git a/Import/GacUI.Windows.cpp b/Import/GacUI.Windows.cpp index 7a89d957..f67c98f7 100644 --- a/Import/GacUI.Windows.cpp +++ b/Import/GacUI.Windows.cpp @@ -2695,7 +2695,7 @@ ControllerListener d3d11Device = CreateD3D11Device(D3D_DRIVER_TYPE_WARP); } } -#if _DEBUG +#ifdef _DEBUG CHECK_ERROR(d3d11Device, L"Direct2DWindowsNativeControllerListener::NativeWindowCreated(INativeWindow*)#" L"Failed to create Direct3D 11 Device. " @@ -14364,7 +14364,7 @@ WindowsInputService WindowsInputService::WindowsInputService() :ownerHandle(NULL) ,isTimerEnabled(false) - ,keyNames(146) + ,keyNames((vint)VKEY::KEY_MAXIMUM) { InitializeKeyNames(); } @@ -14415,7 +14415,7 @@ WindowsInputService } else { - return L"?"; + return WString::Unmanaged(L"?"); } } diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index 40061990..71ac091b 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -1202,12 +1202,13 @@ GuiControl void GuiControl::SetFocused() { - if (focusableComposition) + if (!focusableComposition) return; + if (!isVisuallyEnabled) return; + if (!focusableComposition->GetEventuallyVisible()) return; + + if (auto host = focusableComposition->GetRelatedGraphicsHost()) { - if (auto host = focusableComposition->GetRelatedGraphicsHost()) - { - host->SetFocus(focusableComposition); - } + host->SetFocus(focusableComposition); } } @@ -4404,18 +4405,22 @@ GuiGraphicsHost void GuiGraphicsHost::OnCharInput(const NativeWindowCharInfo& info, GuiGraphicsComposition* composition, GuiCharEvent GuiGraphicsEventReceiver::* eventReceiverEvent) { List compositions; - while(composition) + GuiCharEventArgs arguments(composition); + (NativeWindowCharInfo&)arguments = info; + + while (composition) { - if(composition->HasEventReceiver()) + if (composition->HasEventReceiver()) { + if (!arguments.eventSource) + { + arguments.eventSource = composition; + } compositions.Add(composition); } - composition=composition->GetParent(); + composition = composition->GetParent(); } - GuiCharEventArgs arguments(composition); - (NativeWindowCharInfo&)arguments=info; - // TODO: (enumerable) foreach:reversed for(vint i=compositions.Count()-1;i>=0;i--) { @@ -4440,21 +4445,22 @@ GuiGraphicsHost void GuiGraphicsHost::OnKeyInput(const NativeWindowKeyInfo& info, GuiGraphicsComposition* composition, GuiKeyEvent GuiGraphicsEventReceiver::* eventReceiverEvent) { List compositions; - { - auto current = composition; - while (current) - { - if (current->HasEventReceiver()) - { - compositions.Add(current); - } - current = current->GetParent(); - } - } - GuiKeyEventArgs arguments(composition); (NativeWindowKeyInfo&)arguments = info; + while (composition) + { + if (composition->HasEventReceiver()) + { + if (!arguments.eventSource) + { + arguments.eventSource = composition; + } + compositions.Add(composition); + } + composition = composition->GetParent(); + } + // TODO: (enumerable) foreach:reversed for (vint i = compositions.Count() - 1; i >= 0; i--) { @@ -4671,7 +4677,8 @@ GuiGraphicsHost void GuiGraphicsHost::LeftButtonDoubleClick(const NativeWindowMouseInfo& info) { - LeftButtonDown(info); + altActionManager->CloseAltHost(); + OnMouseInput(info, false, false, &GuiGraphicsEventReceiver::leftButtonDown); OnMouseInput(info, false, false, &GuiGraphicsEventReceiver::leftButtonDoubleClick); } @@ -4688,7 +4695,8 @@ GuiGraphicsHost void GuiGraphicsHost::RightButtonDoubleClick(const NativeWindowMouseInfo& info) { - RightButtonDown(info); + altActionManager->CloseAltHost(); + OnMouseInput(info, false, false, &GuiGraphicsEventReceiver::rightButtonDown); OnMouseInput(info, false, false, &GuiGraphicsEventReceiver::rightButtonDoubleClick); } @@ -4705,7 +4713,8 @@ GuiGraphicsHost void GuiGraphicsHost::MiddleButtonDoubleClick(const NativeWindowMouseInfo& info) { - MiddleButtonDown(info); + altActionManager->CloseAltHost(); + OnMouseInput(info, false, false, &GuiGraphicsEventReceiver::middleButtonDown); OnMouseInput(info, false, false, &GuiGraphicsEventReceiver::middleButtonDoubleClick); } @@ -4793,10 +4802,10 @@ GuiGraphicsHost void GuiGraphicsHost::MouseLeaved() { // TODO: (enumerable) foreach:reversed - for(vint i=mouseEnterCompositions.Count()-1;i>=0;i--) + for (vint i = mouseEnterCompositions.Count() - 1; i >= 0; i--) { - GuiGraphicsComposition* composition=mouseEnterCompositions[i]; - if(composition->HasEventReceiver()) + GuiGraphicsComposition* composition = mouseEnterCompositions[i]; + if (composition->HasEventReceiver()) { composition->GetEventReceiver()->mouseLeave.Execute(GuiEventArgs(composition)); } @@ -4810,9 +4819,13 @@ GuiGraphicsHost if (tabActionManager->KeyDown(info, focusedComposition)) { return; } if(shortcutKeyManager && shortcutKeyManager->Execute(info)) { return; } - if (focusedComposition && focusedComposition->HasEventReceiver()) + auto receiver = focusedComposition; + if (!receiver) receiver = controlHost->GetFocusableComposition(); + if (!receiver) receiver = controlHost->GetBoundsComposition(); + + if (receiver && receiver->HasEventReceiver()) { - OnKeyInput(info, focusedComposition, &GuiGraphicsEventReceiver::keyDown); + OnKeyInput(info, receiver, &GuiGraphicsEventReceiver::keyDown); } } @@ -4824,9 +4837,13 @@ GuiGraphicsHost hostRecord.nativeWindow->SupressAlt(); } - if(focusedComposition && focusedComposition->HasEventReceiver()) + auto receiver = focusedComposition; + if (!receiver) receiver = controlHost->GetFocusableComposition(); + if (!receiver) receiver = controlHost->GetBoundsComposition(); + + if(receiver && receiver->HasEventReceiver()) { - OnKeyInput(info, focusedComposition, &GuiGraphicsEventReceiver::keyUp); + OnKeyInput(info, receiver, &GuiGraphicsEventReceiver::keyUp); } } @@ -4835,9 +4852,13 @@ GuiGraphicsHost if (altActionManager->Char(info)) { return; } if (tabActionManager->Char(info)) { return; } - if(focusedComposition && focusedComposition->HasEventReceiver()) + auto receiver = focusedComposition; + if (!receiver) receiver = controlHost->GetFocusableComposition(); + if (!receiver) receiver = controlHost->GetBoundsComposition(); + + if(receiver && receiver->HasEventReceiver()) { - OnCharInput(info, focusedComposition, &GuiGraphicsEventReceiver::charInput); + OnCharInput(info, receiver, &GuiGraphicsEventReceiver::charInput); } } @@ -25821,7 +25842,10 @@ GuiToolstripCommand void GuiToolstripCommand::OnShortcutKeyItemExecuted(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { - Executed.ExecuteWithNewSender(arguments, sender); + if (enabled) + { + Executed.ExecuteWithNewSender(arguments, sender); + } } void GuiToolstripCommand::OnRenderTargetChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) @@ -35295,6 +35319,7 @@ GuiHostedController::WindowManager void GuiHostedController::OnGotFocus(hosted_window_manager::Window* window) { + window->id->BecomeFocusedWindow(); for (auto listener : window->id->listeners) { listener->GotFocus(); @@ -35303,7 +35328,6 @@ GuiHostedController::WindowManager void GuiHostedController::OnLostFocus(hosted_window_manager::Window* window) { - window->id->BecomeFocusedWindow(); for (auto listener : window->id->listeners) { listener->LostFocus(); @@ -35891,36 +35915,28 @@ GuiHostedController::INativeControllerListener bool failureByResized = false; bool failureByLostDevice = false; - // TODO: (enumerable) foreach:reversed - for (vint i = wmManager->ordinaryWindowsInOrder.Count() - 1; i >= 0; i--) + auto forceRefreshWindows = [&](List*>& windows) { - auto hostedWindow = wmManager->ordinaryWindowsInOrder[i]->id; - for (auto listener : hostedWindow->listeners) + // TODO: (enumerable) foreach:reversed + for (vint i = windows.Count() - 1; i >= 0; i--) { - bool updated = false; - listener->ForceRefresh(false, updated, failureByResized, failureByLostDevice); - windowsUpdatedInLastFrame |= updated; - if (failureByResized || failureByLostDevice) + auto hostedWindow = windows[i]->id; + for (auto listener : hostedWindow->listeners) { - goto STOP_RENDERING; + bool updated = false; + listener->ForceRefresh(false, updated, failureByResized, failureByLostDevice); + windowsUpdatedInLastFrame |= updated; + if (failureByResized || failureByLostDevice) + { + return false; + } } } - } - // TODO: (enumerable) foreach:reversed - for (vint i = wmManager->topMostedWindowsInOrder.Count() - 1; i >= 0; i--) - { - auto hostedWindow = wmManager->topMostedWindowsInOrder[i]->id; - for (auto listener : hostedWindow->listeners) - { - bool updated = false; - listener->ForceRefresh(false, updated, failureByResized, failureByLostDevice); - windowsUpdatedInLastFrame |= updated; - if (failureByResized || failureByLostDevice) - { - goto STOP_RENDERING; - } - } - } + return true; + }; + + if (!forceRefreshWindows(wmManager->ordinaryWindowsInOrder)) goto STOP_RENDERING; + if (!forceRefreshWindows(wmManager->topMostedWindowsInOrder)) goto STOP_RENDERING; STOP_RENDERING: switch (renderTarget->StopHostedRendering()) @@ -36184,7 +36200,10 @@ GuiHostedController::INativeWindowService { if (nativeWindow) { - wmManager->Stop(); + if (wmManager->mainWindow) + { + wmManager->Stop(); + } // TODO: (enumerable) foreach:indexed(alterable(reversed)) for (vint i = createdWindows.Count() - 1; i >= 0; i--) @@ -36412,7 +36431,7 @@ GuiHostedWindow void GuiHostedWindow::BecomeNonMainWindow() { - proxy = CreateNonMainHostedWindowProxy(this); + proxy = CreateNonMainHostedWindowProxy(this, controller->nativeWindow); proxy->CheckAndSyncProperties(); } @@ -36645,15 +36664,21 @@ GuiHostedWindow void GuiHostedWindow::Hide(bool closeWindow) { - bool cancel = false; - for (auto listener : listeners) + if (!wmWindow.visible) return; + + if (this != controller->mainWindow) { - listener->BeforeClosing(cancel); - if (cancel) return; - } - for (auto listener : listeners) - { - listener->AfterClosing(); + // for main window, the underlying INativeWindow will run the process + bool cancel = false; + for (auto listener : listeners) + { + listener->BeforeClosing(cancel); + if (cancel) return; + } + for (auto listener : listeners) + { + listener->AfterClosing(); + } } if (closeWindow) @@ -37130,12 +37155,14 @@ GuiNonMainHostedWindowProxy { protected: GuiHostedWindowData* data = nullptr; + INativeWindow* nativeWindow = nullptr; bool calledAssignFrameConfig = false; public: - GuiNonMainHostedWindowProxy(GuiHostedWindowData* _data) + GuiNonMainHostedWindowProxy(GuiHostedWindowData* _data, INativeWindow* _nativeWindow) : data(_data) + , nativeWindow(_nativeWindow) { } @@ -37306,7 +37333,11 @@ GuiNonMainHostedWindowProxy void SetFocus() override { - data->wmWindow.Activate(); + if (data->wmWindow.visible) + { + data->wmWindow.Activate(); + nativeWindow->SetActivate(); + } } }; @@ -37314,9 +37345,9 @@ GuiNonMainHostedWindowProxy Helper ***********************************************************************/ - Ptr CreateNonMainHostedWindowProxy(GuiHostedWindowData* data) + Ptr CreateNonMainHostedWindowProxy(GuiHostedWindowData* data, INativeWindow* nativeWindow) { - return Ptr(new GuiNonMainHostedWindowProxy(data)); + return Ptr(new GuiNonMainHostedWindowProxy(data, nativeWindow)); } } } @@ -37478,6 +37509,1997 @@ Helper } } +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTECONTROLLER.CPP +***********************************************************************/ + +namespace vl::presentation +{ + using namespace collections; + +/*********************************************************************** +GuiRemoteCursor +***********************************************************************/ + + class GuiRemoteCursor : public Object, public virtual INativeCursor + { + protected: + INativeCursor::SystemCursorType cursorType; + + public: + GuiRemoteCursor(INativeCursor::SystemCursorType _cursorType) : cursorType(_cursorType) {} + + bool IsSystemCursor() { return true; } + SystemCursorType GetSystemCursorType() { return cursorType; } + }; + +/*********************************************************************** +GuiRemoteController::INativeResourceService +***********************************************************************/ + + INativeCursor* GuiRemoteController::GetSystemCursor(INativeCursor::SystemCursorType type) + { + vint index = cursors.Keys().IndexOf(type); + if (index == -1) + { + auto cursor = Ptr(new GuiRemoteCursor(type)); + cursors.Add(type, cursor); + return cursor.Obj(); + } + else + { + return cursors.Values()[index].Obj(); + } + } + + INativeCursor* GuiRemoteController::GetDefaultSystemCursor() + { + return GetSystemCursor(INativeCursor::SystemCursorType::Arrow); + } + + FontProperties GuiRemoteController::GetDefaultFont() + { + return remoteFontConfig.defaultFont; + } + + void GuiRemoteController::SetDefaultFont(const FontProperties& value) + { + remoteFontConfig.defaultFont = value; + } + + void GuiRemoteController::EnumerateFonts(collections::List& fonts) + { + if (remoteFontConfig.supportedFonts) + { + CopyFrom(fonts, *remoteFontConfig.supportedFonts.Obj()); + } + } + +/*********************************************************************** +GuiRemoteController::INativeInputService +***********************************************************************/ + + void GuiRemoteController::StartTimer() + { + timerEnabled = true; + } + + void GuiRemoteController::StopTimer() + { + timerEnabled = false; + } + + bool GuiRemoteController::IsTimerEnabled() + { + return timerEnabled; + } + + bool GuiRemoteController::IsKeyPressing(VKEY code) + { + vint idIsKeyPressing = remoteMessages.RequestIOIsKeyPressing(code); + remoteMessages.Submit(); + bool result = remoteMessages.RetrieveIOIsKeyPressing(idIsKeyPressing); + remoteMessages.ClearResponses(); + return result; + } + + bool GuiRemoteController::IsKeyToggled(VKEY code) + { + vint idIsKeyToggled = remoteMessages.RequestIOIsKeyToggled(code); + remoteMessages.Submit(); + bool result = remoteMessages.RetrieveIOIsKeyToggled(idIsKeyToggled); + remoteMessages.ClearResponses(); + return result; + } + + void GuiRemoteController::EnsureKeyInitialized() + { + if (keyInitialized) return; + keyInitialized = true; + +#define INITIALIZE_KEY_NAME(NAME, TEXT)\ + keyNames.Add(VKEY::KEY_ ## NAME, WString::Unmanaged(TEXT));\ + if (!keyCodes.Keys().Contains(WString::Unmanaged(TEXT))) keyCodes.Add(WString::Unmanaged(TEXT), VKEY::KEY_ ## NAME);\ + + GUI_DEFINE_KEYBOARD_WINDOWS_NAME(INITIALIZE_KEY_NAME) +#undef INITIALIZE_KEY_NAME + } + + WString GuiRemoteController::GetKeyName(VKEY code) + { + EnsureKeyInitialized(); + vint index = keyNames.Keys().IndexOf(code); + return index == -1 ? WString::Unmanaged(L"?") : keyNames.Values()[index]; + } + + VKEY GuiRemoteController::GetKey(const WString& name) + { + EnsureKeyInitialized(); + vint index = keyCodes.Keys().IndexOf(name); + return index == -1 ? VKEY::KEY_UNKNOWN : keyCodes.Values()[index]; + } + + void GuiRemoteController::UpdateGlobalShortcutKey() + { + auto hotKeys = Ptr(new List); + for (auto [id, entry] : hotKeyIds) + { + remoteprotocol::GlobalShortcutKey key; + key.id = id; + key.ctrl = entry.get<0>(); + key.shift = entry.get<1>(); + key.alt = entry.get<2>(); + key.code = entry.get<3>(); + hotKeys->Add(key); + } + remoteMessages.RequestIOUpdateGlobalShortcutKey(hotKeys); + } + + vint GuiRemoteController::RegisterGlobalShortcutKey(bool ctrl, bool shift, bool alt, VKEY key) + { + HotKeyEntry entry = { ctrl,shift,alt,key }; + if (hotKeySet.Contains(entry)) return (vint)NativeGlobalShortcutKeyResult::Occupied; + + vint id = ++usedHotKeys; + hotKeySet.Add(entry); + hotKeyIds.Add(id, entry); + + UpdateGlobalShortcutKey(); + remoteMessages.Submit(); + + return id; + } + + bool GuiRemoteController::UnregisterGlobalShortcutKey(vint id) + { + vint index = hotKeyIds.Keys().IndexOf(id); + if (index == -1) return false; + + auto entry = hotKeyIds.Values()[index]; + hotKeyIds.Remove(id); + hotKeySet.Remove(entry); + + UpdateGlobalShortcutKey(); + remoteMessages.Submit(); + + return true; + } + +/*********************************************************************** +GuiRemoteController::INativeScreenService +***********************************************************************/ + + vint GuiRemoteController::GetScreenCount() + { + return 1; + } + + INativeScreen* GuiRemoteController::GetScreen(vint index) + { + CHECK_ERROR(index == 0, L"vl::presentation::GuiRemoteController::GetScreen(vint)#Index out of range."); + return this; + } + + INativeScreen* GuiRemoteController::GetScreen(INativeWindow* window) + { + return this; + } + +/*********************************************************************** +GuiHostedController::INativeScreen +***********************************************************************/ + + NativeRect GuiRemoteController::GetBounds() + { + return remoteScreenConfig.bounds; + } + + NativeRect GuiRemoteController::GetClientBounds() + { + return remoteScreenConfig.clientBounds; + } + + WString GuiRemoteController::GetName() + { + return WString::Unmanaged(L"GacUI Virtual Remote Screen"); + } + + bool GuiRemoteController::IsPrimary() + { + return true; + } + + double GuiRemoteController::GetScalingX() + { + return remoteScreenConfig.scalingX; + } + + double GuiRemoteController::GetScalingY() + { + return remoteScreenConfig.scalingY; + } + +/*********************************************************************** +GuiRemoteController::INativeWindowService +***********************************************************************/ + + const NativeWindowFrameConfig& GuiRemoteController::GetMainWindowFrameConfig() + { + return NativeWindowFrameConfig::Default; + } + + const NativeWindowFrameConfig& GuiRemoteController::GetNonMainWindowFrameConfig() + { + return NativeWindowFrameConfig::Default; + } + + INativeWindow* GuiRemoteController::CreateNativeWindow(INativeWindow::WindowMode windowMode) + { + CHECK_ERROR(!windowCreated, L"vl::presentation::GuiRemoteController::CreateNativeWindow(INativeWindow::WindowMode)#GuiHostedController is not supposed to call this function for twice."); + windowCreated = true; + remoteWindow.windowMode = windowMode; + callbackService.InvokeNativeWindowCreated(&remoteWindow); + return &remoteWindow; + } + + void GuiRemoteController::DestroyNativeWindow(INativeWindow* window) + { + CHECK_ERROR(!windowDestroyed, L"vl::presentation::GuiRemoteController::CreateNativeWindow(INativeWindow::WindowMode)#GuiHostedController is not supposed to call this function for twice."); + windowDestroyed = true; + + for (auto l : remoteWindow.listeners) l->Closed(); + for (auto l : remoteWindow.listeners) l->Destroying(); + callbackService.InvokeNativeWindowDestroying(&remoteWindow); + for (auto l : remoteWindow.listeners) l->Destroyed(); + connectionStopped = true; + } + + INativeWindow* GuiRemoteController::GetMainWindow() + { + return windowCreated && !windowDestroyed ? &remoteWindow : nullptr; + } + + INativeWindow* GuiRemoteController::GetWindow(NativePoint location) + { + return GetMainWindow(); + } + + void GuiRemoteController::Run(INativeWindow* window) + { + CHECK_ERROR(window == &remoteWindow, L"vl::presentation::GuiRemoteController::Run(INativeWindow*)#GuiHostedController should call this function with the native window."); + applicationRunning = true; + window->Show(); + while (RunOneCycle()); + applicationRunning = false; + } + + bool GuiRemoteController::RunOneCycle() + { + if (!connectionStopped) + { + remoteProtocol->ProcessRemoteEvents(); + remoteMessages.Submit(); + } + return !connectionStopped; + } + +/*********************************************************************** +GuiRemoteController (events) +***********************************************************************/ + + void GuiRemoteController::OnControllerConnect() + { + UpdateGlobalShortcutKey(); + vint idGetFontConfig = remoteMessages.RequestControllerGetFontConfig(); + vint idGetScreenConfig = remoteMessages.RequestControllerGetScreenConfig(); + remoteMessages.Submit(); + remoteFontConfig = remoteMessages.RetrieveControllerGetFontConfig(idGetFontConfig); + remoteScreenConfig = remoteMessages.RetrieveControllerGetScreenConfig(idGetScreenConfig); + remoteMessages.ClearResponses(); + remoteWindow.OnControllerConnect(); + } + + void GuiRemoteController::OnControllerDisconnect() + { + remoteWindow.OnControllerDisconnect(); + } + + void GuiRemoteController::OnControllerRequestExit() + { + remoteWindow.Hide(true); + } + + void GuiRemoteController::OnControllerForceExit() + { + connectionForcedToStop = true; + remoteWindow.Hide(true); + } + + void GuiRemoteController::OnControllerScreenUpdated(const remoteprotocol::ScreenConfig& arguments) + { + remoteScreenConfig = arguments; + } + +/*********************************************************************** +GuiRemoteController +***********************************************************************/ + + GuiRemoteController::GuiRemoteController(IGuiRemoteProtocol* _remoteProtocol) + : remoteProtocol(_remoteProtocol) + , remoteMessages(this) + , remoteEvents(this) + , remoteWindow(this) + { + } + + GuiRemoteController::~GuiRemoteController() + { + } + + void GuiRemoteController::Initialize() + { + remoteProtocol->Initialize(&remoteEvents); + } + + void GuiRemoteController::Finalize() + { + remoteMessages.RequestControllerConnectionStopped(); + remoteMessages.Submit(); + } + +/*********************************************************************** +GuiRemoteController (INativeController) +***********************************************************************/ + + INativeCallbackService* GuiRemoteController::CallbackService() + { + return &callbackService; + } + + INativeResourceService* GuiRemoteController::ResourceService() + { + return this; + } + + INativeAsyncService* GuiRemoteController::AsyncService() + { + return &asyncService; + } + + INativeClipboardService* GuiRemoteController::ClipboardService() + { + CHECK_FAIL(L"Not Implemented!"); + } + + INativeImageService* GuiRemoteController::ImageService() + { + CHECK_FAIL(L"Not Implemented!"); + } + + INativeInputService* GuiRemoteController::InputService() + { + return this; + } + + INativeDialogService* GuiRemoteController::DialogService() + { + // Use FakeDialogServiceBase + return nullptr; + } + + WString GuiRemoteController::GetExecutablePath() + { + return remoteProtocol->GetExecutablePath(); + } + + INativeScreenService* GuiRemoteController::ScreenService() + { + return this; + } + + INativeWindowService* GuiRemoteController::WindowService() + { + return this; + } +} + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTECONTROLLERSETUP.CPP +***********************************************************************/ + +using namespace vl; +using namespace vl::presentation; +using namespace vl::presentation::elements; + +/*********************************************************************** +SetupRemoteNativeController +***********************************************************************/ + +extern void GuiApplicationMain(); + +int SetupRemoteNativeController(vl::presentation::IGuiRemoteProtocol* protocol) +{ + GuiRemoteController remoteController(protocol); + GuiRemoteGraphicsResourceManager remoteResourceManager(&remoteController); + + GuiHostedController hostedController(&remoteController); + GuiHostedGraphicsResourceManager hostedResourceManager(&hostedController, &remoteResourceManager); + + SetNativeController(&hostedController); + SetGuiGraphicsResourceManager(&hostedResourceManager); + + remoteController.Initialize(); + hostedController.Initialize(); + GuiApplicationMain(); + hostedController.Finalize(); + remoteController.Finalize(); + + SetGuiGraphicsResourceManager(nullptr); + SetNativeController(nullptr); + return 0; +} + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEEVENTS.CPP +***********************************************************************/ + +namespace vl::presentation +{ + +/*********************************************************************** +GuiRemoteMessages +***********************************************************************/ + + GuiRemoteMessages::GuiRemoteMessages(GuiRemoteController* _remote) + : remote(_remote) + { + } + + GuiRemoteMessages::~GuiRemoteMessages() + { + } + + void GuiRemoteMessages::Submit() + { + remote->remoteProtocol->Submit(); + } + + void GuiRemoteMessages::ClearResponses() + { +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE) response ## NAME.Clear(); +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + } + +/*********************************************************************** +GuiRemoteMessages (messages) +***********************************************************************/ + +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE)\ + void GuiRemoteMessages::Request ## NAME()\ + {\ + remote->remoteProtocol->Request ## NAME();\ + }\ + +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE)\ + vint GuiRemoteMessages::Request ## NAME()\ + {\ + vint requestId = ++id;\ + remote->remoteProtocol->Request ## NAME(requestId);\ + return requestId;\ + }\ + +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE)\ + void GuiRemoteMessages::Request ## NAME(const REQUEST& arguments)\ + {\ + remote->remoteProtocol->Request ## NAME(arguments);\ + }\ + +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE)\ + vint GuiRemoteMessages::Request ## NAME(const REQUEST& arguments)\ + {\ + vint requestId = ++id;\ + remote->remoteProtocol->Request ## NAME(requestId, arguments);\ + return requestId;\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE)\ + void GuiRemoteMessages::Respond ## NAME(vint id, const RESPONSE& arguments)\ + {\ + response ## NAME.Add(id, arguments);\ + }\ + const RESPONSE& GuiRemoteMessages::Retrieve ## NAME(vint id)\ + {\ + return response ## NAME[id];\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + +/*********************************************************************** +GuiRemoteEvents +***********************************************************************/ + + GuiRemoteEvents::GuiRemoteEvents(GuiRemoteController* _remote) + : remote(_remote) + { + } + + GuiRemoteEvents::~GuiRemoteEvents() + { + } + +/*********************************************************************** +GuiRemoteEvents (messages) +***********************************************************************/ + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE)\ + void GuiRemoteEvents::Respond ## NAME(vint id, const RESPONSE& arguments)\ + {\ + remote->remoteMessages.Respond ## NAME(id, arguments);\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + +/*********************************************************************** +GuiRemoteEvents (events) +***********************************************************************/ + + void GuiRemoteEvents::OnControllerConnect() + { + remote->OnControllerConnect(); + remote->remoteMessages.RequestControllerConnectionEstablished(); + remote->remoteMessages.Submit(); + } + + void GuiRemoteEvents::OnControllerDisconnect() + { + remote->OnControllerDisconnect(); + } + + void GuiRemoteEvents::OnControllerRequestExit() + { + remote->OnControllerRequestExit(); + } + + void GuiRemoteEvents::OnControllerForceExit() + { + remote->OnControllerForceExit(); + } + + void GuiRemoteEvents::OnControllerScreenUpdated(const remoteprotocol::ScreenConfig& arguments) + { + remote->OnControllerScreenUpdated(arguments); + } + + void GuiRemoteEvents::OnWindowBoundsUpdated(const remoteprotocol::WindowSizingConfig& arguments) + { + remote->remoteWindow.OnWindowBoundsUpdated(arguments); + } + + void GuiRemoteEvents::OnWindowActivatedUpdated(const bool& arguments) + { + remote->remoteWindow.OnWindowActivatedUpdated(arguments); + } + + void GuiRemoteEvents::OnIOGlobalShortcutKey(const vint& arguments) + { + remote->callbackService.InvokeGlobalShortcutKeyActivated(arguments); + } + + void GuiRemoteEvents::OnIOButtonDown(const remoteprotocol::IOMouseInfoWithButton& arguments) + { + switch (arguments.button) + { + case remoteprotocol::IOMouseButton::Left: + for (auto l : remote->remoteWindow.listeners) l->LeftButtonDown(arguments.info); + break; + case remoteprotocol::IOMouseButton::Middle: + for (auto l : remote->remoteWindow.listeners) l->MiddleButtonDown(arguments.info); + break; + case remoteprotocol::IOMouseButton::Right: + for (auto l : remote->remoteWindow.listeners) l->RightButtonDown(arguments.info); + break; + default: + CHECK_FAIL(L"vl::presentation::GuiRemoteEvents::OnIOButtonDown(const IOMouseInfoWithButton&)#Unrecognized button."); + } + } + + void GuiRemoteEvents::OnIOButtonDoubleClick(const remoteprotocol::IOMouseInfoWithButton& arguments) + { + switch (arguments.button) + { + case remoteprotocol::IOMouseButton::Left: + for (auto l : remote->remoteWindow.listeners) l->LeftButtonDoubleClick(arguments.info); + break; + case remoteprotocol::IOMouseButton::Middle: + for (auto l : remote->remoteWindow.listeners) l->MiddleButtonDoubleClick(arguments.info); + break; + case remoteprotocol::IOMouseButton::Right: + for (auto l : remote->remoteWindow.listeners) l->RightButtonDoubleClick(arguments.info); + break; + default: + CHECK_FAIL(L"vl::presentation::GuiRemoteEvents::OnIOButtonDoubleClick(const IOMouseInfoWithButton&)#Unrecognized button."); + } + } + + void GuiRemoteEvents::OnIOButtonUp(const remoteprotocol::IOMouseInfoWithButton& arguments) + { + switch (arguments.button) + { + case remoteprotocol::IOMouseButton::Left: + for (auto l : remote->remoteWindow.listeners) l->LeftButtonUp(arguments.info); + break; + case remoteprotocol::IOMouseButton::Middle: + for (auto l : remote->remoteWindow.listeners) l->MiddleButtonUp(arguments.info); + break; + case remoteprotocol::IOMouseButton::Right: + for (auto l : remote->remoteWindow.listeners) l->RightButtonUp(arguments.info); + break; + default: + CHECK_FAIL(L"vl::presentation::GuiRemoteEvents::OnIOButtonUp(const IOMouseInfoWithButton&)#Unrecognized button."); + } + } + + void GuiRemoteEvents::OnIOHWheel(const NativeWindowMouseInfo& arguments) + { + for (auto l : remote->remoteWindow.listeners) l->HorizontalWheel(arguments); + } + + void GuiRemoteEvents::OnIOVWheel(const NativeWindowMouseInfo& arguments) + { + for (auto l : remote->remoteWindow.listeners) l->VerticalWheel(arguments); + } + + void GuiRemoteEvents::OnIOMouseMoving(const NativeWindowMouseInfo& arguments) + { + for (auto l : remote->remoteWindow.listeners) l->MouseMoving(arguments); + } + + void GuiRemoteEvents::OnIOMouseEntered() + { + for (auto l : remote->remoteWindow.listeners) l->MouseEntered(); + } + + void GuiRemoteEvents::OnIOMouseLeaved() + { + for (auto l : remote->remoteWindow.listeners) l->MouseLeaved(); + } + + void GuiRemoteEvents::OnIOKeyDown(const NativeWindowKeyInfo& arguments) + { + for (auto l : remote->remoteWindow.listeners) l->KeyDown(arguments); + } + + void GuiRemoteEvents::OnIOKeyUp(const NativeWindowKeyInfo& arguments) + { + for (auto l : remote->remoteWindow.listeners) l->KeyUp(arguments); + } + + void GuiRemoteEvents::OnIOChar(const NativeWindowCharInfo& arguments) + { + for (auto l : remote->remoteWindow.listeners) l->Char(arguments); + } +} + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEGRAPHICS.CPP +***********************************************************************/ + +namespace vl::presentation::elements +{ + +/*********************************************************************** +GuiRemoteGraphicsRenderTarget +***********************************************************************/ + + void GuiRemoteGraphicsRenderTarget::StartRenderingOnNativeWindow() + { + canvasSize = remote->remoteWindow.GetClientSize(); + } + + RenderTargetFailure GuiRemoteGraphicsRenderTarget::StopRenderingOnNativeWindow() + { + if (canvasSize == remote->remoteWindow.GetClientSize()) + { + return RenderTargetFailure::None; + } + else + { + return RenderTargetFailure::ResizeWhileRendering; + } + } + + Size GuiRemoteGraphicsRenderTarget::GetCanvasSize() + { + return remote->remoteWindow.Convert(canvasSize); + } + + void GuiRemoteGraphicsRenderTarget::AfterPushedClipper(Rect clipper, Rect validArea) + { + } + + void GuiRemoteGraphicsRenderTarget::AfterPushedClipperAndBecameInvalid(Rect clipper) + { + } + + void GuiRemoteGraphicsRenderTarget::AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) + { + } + + void GuiRemoteGraphicsRenderTarget::AfterPoppedClipper(Rect validArea, bool clipperExists) + { + } + + GuiRemoteGraphicsRenderTarget::GuiRemoteGraphicsRenderTarget(GuiRemoteController* _remote) + : remote(_remote) + { + } + + GuiRemoteGraphicsRenderTarget::~GuiRemoteGraphicsRenderTarget() + { + } + +/*********************************************************************** +GuiRemoteGraphicsResourceManager +***********************************************************************/ + + GuiRemoteGraphicsResourceManager::GuiRemoteGraphicsResourceManager(GuiRemoteController* _remote) + : remote(_remote) + , renderTarget(_remote) + { + // TODO: register element renderers; + } + + GuiRemoteGraphicsResourceManager::~GuiRemoteGraphicsResourceManager() + { + } + + IGuiGraphicsRenderTarget* GuiRemoteGraphicsResourceManager::GetRenderTarget(INativeWindow* window) + { + CHECK_ERROR(window == &remote->remoteWindow, L"vl::presentation::elements::GuiRemoteGraphicsResourceManager::GetRenderTarget(INativeWindow*)#GuiHostedController should call this function with the native window."); + return &renderTarget; + } + + void GuiRemoteGraphicsResourceManager::RecreateRenderTarget(INativeWindow* window) + { + } + + void GuiRemoteGraphicsResourceManager::ResizeRenderTarget(INativeWindow* window) + { + } + + IGuiGraphicsLayoutProvider* GuiRemoteGraphicsResourceManager::GetLayoutProvider() + { + CHECK_FAIL(L"Not Implemented!"); + } +} + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOLSCHEMASHARED.CPP +***********************************************************************/ + +namespace vl::presentation::remoteprotocol +{ + template<> Ptr ConvertCustomTypeToJson(const bool& value) + { + auto node = Ptr(new glr::json::JsonLiteral); + node->value = value ? glr::json::JsonLiteralValue::True : glr::json::JsonLiteralValue::False; + return node; + } + + template<> Ptr ConvertCustomTypeToJson(const vint& value) + { + auto node = Ptr(new glr::json::JsonNumber); + reflection::description::TypedValueSerializerProvider::Serialize(value, node->content.value); + return node; + } + + template<> Ptr ConvertCustomTypeToJson(const float& value) + { + auto node = Ptr(new glr::json::JsonNumber); + reflection::description::TypedValueSerializerProvider::Serialize(value, node->content.value); + return node; + } + + template<> Ptr ConvertCustomTypeToJson(const double& value) + { + auto node = Ptr(new glr::json::JsonNumber); + reflection::description::TypedValueSerializerProvider::Serialize(value, node->content.value); + return node; + } + + template<> Ptr ConvertCustomTypeToJson(const WString& value) + { + auto node = Ptr(new glr::json::JsonString); + node->content.value = value; + return node; + } + + template<> Ptr ConvertCustomTypeToJson(const wchar_t& value) + { + return ConvertCustomTypeToJson(WString::FromChar(value)); + } + + template<> Ptr ConvertCustomTypeToJson(const VKEY& value) + { + return ConvertCustomTypeToJson((vint)value); + } + + template<> void ConvertJsonToCustomType(Ptr node, bool& value) + { +#define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, bool&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"JSON node does not match the expected type."); + switch (jsonNode->value) + { + case glr::json::JsonLiteralValue::True: value = true; break; + case glr::json::JsonLiteralValue::False: value = false; break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported json literal."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(Ptr node, vint& value) + { +#define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vint&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"JSON node does not match the expected type."); + CHECK_ERROR(reflection::description::TypedValueSerializerProvider::Deserialize(jsonNode->content.value, value), ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(Ptr node, float& value) + { +#define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, float&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"JSON node does not match the expected type."); + CHECK_ERROR(reflection::description::TypedValueSerializerProvider::Deserialize(jsonNode->content.value, value), ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(Ptr node, double& value) + { +#define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, double&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"JSON node does not match the expected type."); + CHECK_ERROR(reflection::description::TypedValueSerializerProvider::Deserialize(jsonNode->content.value, value), ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(Ptr node, WString& value) + { +#define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, WString&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"JSON node does not match the expected type."); + value = jsonNode->content.value; +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(Ptr node, wchar_t& value) + { +#define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, wchar_t&)#" + WString strValue; + ConvertJsonToCustomType(node, strValue); + CHECK_ERROR(strValue.Length() == 1, ERROR_MESSAGE_PREFIX L"Char in JSON should be a string with one char."); + value = strValue[0]; +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(Ptr node, VKEY& value) + { + vint intValue; + ConvertJsonToCustomType(node, intValue); + value = (VKEY)intValue; + } +} + + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEWINDOW.CPP +***********************************************************************/ + +namespace vl::presentation +{ +/*********************************************************************** +GuiRemoteWindow +***********************************************************************/ + +#define SET_REMOTE_WINDOW_STYLE(STYLE, VALUE)\ + if (style ## STYLE != VALUE)\ + {\ + style ## STYLE = VALUE;\ + remoteMessages.RequestWindowNotifySet ## STYLE(VALUE);\ + }\ + +#define SET_REMOTE_WINDOW_STYLE_INVALIDATE(STYLE, VALUE)\ + if (style ## STYLE != VALUE)\ + {\ + style ## STYLE = VALUE;\ + sizingConfigInvalidated = true;\ + remoteMessages.RequestWindowNotifySet ## STYLE(VALUE);\ + }\ + + void GuiRemoteWindow::RequestGetBounds() + { + sizingConfigInvalidated = false; + vint idGetBounds = remoteMessages.RequestWindowGetBounds(); + remoteMessages.Submit(); + OnWindowBoundsUpdated(remoteMessages.RetrieveWindowGetBounds(idGetBounds)); + remoteMessages.ClearResponses(); + } + + void GuiRemoteWindow::Opened() + { + if (!statusVisible) + { + statusVisible = true; + for (auto l : listeners)l->Opened(); + } + } + + void GuiRemoteWindow::SetActivated(bool activated) + { + if (statusActivated != activated) + { + statusActivated = activated; + if (statusActivated) + { + for (auto l : listeners)l->GotFocus(); + for (auto l : listeners)l->RenderingAsActivated(); + } + else + { + for (auto l : listeners)l->LostFocus(); + for (auto l : listeners)l->RenderingAsDeactivated(); + } + } + } + + void GuiRemoteWindow::ShowWithSizeState(bool activate, INativeWindow::WindowSizeState sizeState) + { + if (!statusVisible || remoteWindowSizingConfig.sizeState != sizeState) + { + remoteprotocol::WindowShowing windowShowing; + windowShowing.activate = activate; + windowShowing.sizeState = sizeState; + remoteMessages.RequestWindowNotifyShow(windowShowing); + remoteMessages.Submit(); + + remoteWindowSizingConfig.sizeState = sizeState; + Opened(); + SetActivated(activate); + } + else if (!statusActivated && activate) + { + SetActivate(); + } + } + +/*********************************************************************** +GuiRemoteWindow (events) +***********************************************************************/ + + void GuiRemoteWindow::OnControllerConnect() + { + if (disconnected) + { + disconnected = false; + } + + sizingConfigInvalidated = true; + RequestGetBounds(); + + if (remote->applicationRunning) + { + remoteMessages.RequestWindowNotifySetTitle(styleTitle); + remoteMessages.RequestWindowNotifySetEnabled(styleEnabled); + remoteMessages.RequestWindowNotifySetTopMost(styleTopMost); + remoteMessages.RequestWindowNotifySetShowInTaskBar(styleShowInTaskBar); + remoteMessages.RequestWindowNotifySetCustomFrameMode(styleCustomFrameMode); + remoteMessages.RequestWindowNotifySetMaximizedBox(styleMaximizedBox); + remoteMessages.RequestWindowNotifySetMinimizedBox(styleMinimizedBox); + remoteMessages.RequestWindowNotifySetBorder(styleBorder); + remoteMessages.RequestWindowNotifySetSizeBox(styleSizeBox); + remoteMessages.RequestWindowNotifySetIconVisible(styleIconVisible); + remoteMessages.RequestWindowNotifySetTitleBar(styleTitleBar); + if (statusCapturing) + { + remoteMessages.RequestIORequireCapture(); + } + else + { + remoteMessages.RequestIOReleaseCapture(); + } + remoteMessages.Submit(); + } + } + + void GuiRemoteWindow::OnControllerDisconnect() + { + disconnected = true; + } + + void GuiRemoteWindow::OnControllerScreenUpdated(const remoteprotocol::ScreenConfig& arguments) + { + if (scalingX != arguments.scalingX || scalingY != arguments.scalingY) + { + scalingX = arguments.scalingX; + scalingY = arguments.scalingY; + for (auto l : listeners) l->DpiChanged(true); + for (auto l : listeners) l->DpiChanged(false); + } + } + + void GuiRemoteWindow::OnWindowBoundsUpdated(const remoteprotocol::WindowSizingConfig& arguments) + { + bool callMoved = false; + if (remoteWindowSizingConfig.bounds != arguments.bounds || + remoteWindowSizingConfig.clientBounds != arguments.clientBounds) + { + callMoved = true; + } + + remoteWindowSizingConfig = arguments; + if(callMoved) + { + for (auto l : listeners) l->Moved(); + } + } + + void GuiRemoteWindow::OnWindowActivatedUpdated(bool activated) + { + SetActivated(activated); + } + +/*********************************************************************** +GuiRemoteWindow +***********************************************************************/ + + GuiRemoteWindow::GuiRemoteWindow(GuiRemoteController* _remote) + : remote(_remote) + , remoteMessages(_remote->remoteMessages) + , remoteEvents(_remote->remoteEvents) + { + remoteWindowSizingConfig.sizeState = INativeWindow::Restored; + } + + GuiRemoteWindow::~GuiRemoteWindow() + { + } + +/*********************************************************************** +GuiRemoteWindow (INativeWindow) +***********************************************************************/ + + bool GuiRemoteWindow::IsActivelyRefreshing() + { + return true; + } + + NativeSize GuiRemoteWindow::GetRenderingOffset() + { + return { 0,0 }; + } + + Point GuiRemoteWindow::Convert(NativePoint value) + { + return Point((vint)(value.x.value / scalingX), (vint)(value.y.value / scalingY)); + } + + NativePoint GuiRemoteWindow::Convert(Point value) + { + return NativePoint((vint)(value.x * scalingX), (vint)(value.y * scalingY)); + } + + Size GuiRemoteWindow::Convert(NativeSize value) + { + return Size((vint)(value.x.value / scalingX), (vint)(value.y.value / scalingY)); + } + + NativeSize GuiRemoteWindow::Convert(Size value) + { + return NativeSize((vint)(value.x * scalingX), (vint)(value.y * scalingY)); + } + + Margin GuiRemoteWindow::Convert(NativeMargin value) + { + return Margin( + (vint)(value.left.value / scalingX), + (vint)(value.top.value / scalingY), + (vint)(value.right.value / scalingX), + (vint)(value.bottom.value / scalingY) + ); + } + + NativeMargin GuiRemoteWindow::Convert(Margin value) + { + return NativeMargin( + (vint)(value.left * scalingX), + (vint)(value.top * scalingY), + (vint)(value.right * scalingX), + (vint)(value.bottom * scalingY) + ); + } + + NativeRect GuiRemoteWindow::GetBounds() + { + if (sizingConfigInvalidated) RequestGetBounds(); + return remoteWindowSizingConfig.bounds; + } + + void GuiRemoteWindow::SetBounds(const NativeRect& bounds) + { + if (remoteWindowSizingConfig.bounds != bounds) + { + remoteMessages.RequestWindowNotifySetBounds(bounds); + sizingConfigInvalidated = true; + } + } + + NativeSize GuiRemoteWindow::GetClientSize() + { + if (sizingConfigInvalidated) RequestGetBounds(); + return remoteWindowSizingConfig.clientBounds.GetSize(); + } + + void GuiRemoteWindow::SetClientSize(NativeSize size) + { + if (remoteWindowSizingConfig.clientBounds.GetSize() != size) + { + remoteMessages.RequestWindowNotifySetClientSize(size); + sizingConfigInvalidated = true; + } + } + + NativeRect GuiRemoteWindow::GetClientBoundsInScreen() + { + auto bounds = remoteWindowSizingConfig.clientBounds; + bounds.x1.value += remoteWindowSizingConfig.bounds.x1.value; + bounds.y1.value += remoteWindowSizingConfig.bounds.y1.value; + bounds.x2.value += remoteWindowSizingConfig.bounds.x1.value; + bounds.y2.value += remoteWindowSizingConfig.bounds.y1.value; + return bounds; + } + + WString GuiRemoteWindow::GetTitle() + { + return styleTitle; + } + + void GuiRemoteWindow::SetTitle(const WString& title) + { + SET_REMOTE_WINDOW_STYLE(Title, title); + } + + INativeCursor* GuiRemoteWindow::GetWindowCursor() + { + if (!styleCursor) + { + styleCursor = remote->ResourceService()->GetDefaultSystemCursor(); + } + return styleCursor; + } + + void GuiRemoteWindow::SetWindowCursor(INativeCursor* cursor) + { + styleCursor = cursor; + } + + NativePoint GuiRemoteWindow::GetCaretPoint() + { + return styleCaret; + } + + void GuiRemoteWindow::SetCaretPoint(NativePoint point) + { + styleCaret = point; + } + + INativeWindow* GuiRemoteWindow::GetParent() + { + return nullptr; + } + + void GuiRemoteWindow::SetParent(INativeWindow* parent) + { + CHECK_FAIL(L"vl::presentation::GuiRemoteWindow::SetParent(INativeWindow*)#GuiHostedController is not supposed to call this."); + } + + INativeWindow::WindowMode GuiRemoteWindow::GetWindowMode() + { + return windowMode; + } + + void GuiRemoteWindow::EnableCustomFrameMode() + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(CustomFrameMode, true); + } + + void GuiRemoteWindow::DisableCustomFrameMode() + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(CustomFrameMode, false); + } + + bool GuiRemoteWindow::IsCustomFrameModeEnabled() + { + return styleCustomFrameMode; + } + + NativeMargin GuiRemoteWindow::GetCustomFramePadding() + { + return remoteWindowSizingConfig.customFramePadding; + } + + Ptr GuiRemoteWindow::GetIcon() + { + return styleIcon; + } + + void GuiRemoteWindow::SetIcon(Ptr icon) + { + styleIcon = icon; + } + + INativeWindow::WindowSizeState GuiRemoteWindow::GetSizeState() + { + return remoteWindowSizingConfig.sizeState; + } + + void GuiRemoteWindow::Show() + { + ShowWithSizeState(true, remoteWindowSizingConfig.sizeState); + } + + void GuiRemoteWindow::ShowDeactivated() + { + ShowWithSizeState(false, remoteWindowSizingConfig.sizeState); + } + + void GuiRemoteWindow::ShowRestored() + { + ShowWithSizeState(true, INativeWindow::Restored); + } + + void GuiRemoteWindow::ShowMaximized() + { + ShowWithSizeState(true, INativeWindow::Maximized); + } + + void GuiRemoteWindow::ShowMinimized() + { + ShowWithSizeState(true, INativeWindow::Minimized); + } + + void GuiRemoteWindow::Hide(bool closeWindow) + { + if (!remote->connectionForcedToStop) + { + bool cancel = false; + for (auto l : listeners) + { + l->BeforeClosing(cancel); + if (cancel) return; + } + for (auto l : listeners) l->AfterClosing(); + } + remote->DestroyNativeWindow(this); + } + + bool GuiRemoteWindow::IsVisible() + { + return statusVisible; + } + + void GuiRemoteWindow::Enable() + { + if (styleEnabled != true) + { + styleEnabled = true; + remoteMessages.RequestWindowNotifySetEnabled(true); + for (auto l : listeners) l->Enabled(); + } + } + + void GuiRemoteWindow::Disable() + { + if (styleEnabled != false) + { + styleEnabled = false; + remoteMessages.RequestWindowNotifySetEnabled(false); + for (auto l : listeners) l->Disabled(); + } + } + + bool GuiRemoteWindow::IsEnabled() + { + return styleEnabled; + } + + void GuiRemoteWindow::SetActivate() + { + if (statusActivated != true) + { + SetActivated(true); + remoteMessages.RequestWindowNotifyActivate(); + } + } + + bool GuiRemoteWindow::IsActivated() + { + return statusActivated; + } + + bool GuiRemoteWindow::IsRenderingAsActivated() + { + return statusActivated; + } + + void GuiRemoteWindow::ShowInTaskBar() + { + SET_REMOTE_WINDOW_STYLE(ShowInTaskBar, true); + } + + void GuiRemoteWindow::HideInTaskBar() + { + SET_REMOTE_WINDOW_STYLE(ShowInTaskBar, false); + } + + bool GuiRemoteWindow::IsAppearedInTaskBar() + { + return styleShowInTaskBar; + } + + void GuiRemoteWindow::EnableActivate() + { + CHECK_FAIL(L"vl::presentation::GuiRemoteWindow::EnableActivate()#GuiHostedController is not supposed to call this."); + } + + void GuiRemoteWindow::DisableActivate() + { + CHECK_FAIL(L"vl::presentation::GuiRemoteWindow::EnableActivate()#GuiHostedController is not supposed to call this."); + } + + bool GuiRemoteWindow::IsEnabledActivate() + { + return true; + } + + bool GuiRemoteWindow::RequireCapture() + { + if (!statusCapturing) + { + statusCapturing = true; + remoteMessages.RequestIORequireCapture(); + remoteMessages.Submit(); + } + return true; + } + + bool GuiRemoteWindow::ReleaseCapture() + { + if (statusCapturing) + { + statusCapturing = false; + remoteMessages.RequestIOReleaseCapture(); + remoteMessages.Submit(); + } + return true; + } + + bool GuiRemoteWindow::IsCapturing() + { + return statusCapturing; + } + + bool GuiRemoteWindow::GetMaximizedBox() + { + return styleMaximizedBox; + } + + void GuiRemoteWindow::SetMaximizedBox(bool visible) + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(MaximizedBox, visible); + } + + bool GuiRemoteWindow::GetMinimizedBox() + { + return styleMinimizedBox; + } + + void GuiRemoteWindow::SetMinimizedBox(bool visible) + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(MinimizedBox, visible); + } + + bool GuiRemoteWindow::GetBorder() + { + return styleBorder; + } + + void GuiRemoteWindow::SetBorder(bool visible) + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(Border, visible); + } + + bool GuiRemoteWindow::GetSizeBox() + { + return styleSizeBox; + } + + void GuiRemoteWindow::SetSizeBox(bool visible) + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(SizeBox, visible); + } + + bool GuiRemoteWindow::GetIconVisible() + { + return styleIconVisible; + } + + void GuiRemoteWindow::SetIconVisible(bool visible) + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(IconVisible, visible); + } + + bool GuiRemoteWindow::GetTitleBar() + { + return styleTitleBar; + } + + void GuiRemoteWindow::SetTitleBar(bool visible) + { + SET_REMOTE_WINDOW_STYLE_INVALIDATE(TitleBar, visible); + } + + bool GuiRemoteWindow::GetTopMost() + { + return styleTopMost; + } + + void GuiRemoteWindow::SetTopMost(bool topmost) + { + SET_REMOTE_WINDOW_STYLE(TopMost, topmost); + } + + void GuiRemoteWindow::SupressAlt() + { + } + + bool GuiRemoteWindow::InstallListener(INativeWindowListener* listener) + { + if (listeners.Contains(listener)) + { + return false; + } + else + { + listeners.Add(listener); + return true; + } + } + + bool GuiRemoteWindow::UninstallListener(INativeWindowListener* listener) + { + if (listeners.Contains(listener)) + { + listeners.Remove(listener); + return true; + } + else + { + return false; + } + } + + void GuiRemoteWindow::RedrawContent() + { + CHECK_FAIL(L"Not Implemented!"); + } + +#undef SET_REMOTE_WINDOW_STYLE_INVALIDATE +#undef SET_REMOTE_WINDOW_STYLE +} + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\PROTOCOL\GENERATED\GUIREMOTEPROTOCOLSCHEMA.CPP +***********************************************************************/ +/*********************************************************************** +This file is generated by : Vczh GacUI Remote Protocol Generator +Licensed under https ://github.com/vczh-libraries/License +***********************************************************************/ + + +namespace vl::presentation::remoteprotocol +{ + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseButton & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseButton&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case vl::presentation::remoteprotocol::IOMouseButton::Left: node->content.value = L"Left"; break; + case vl::presentation::remoteprotocol::IOMouseButton::Middle: node->content.value = L"Middle"; break; + case vl::presentation::remoteprotocol::IOMouseButton::Right: node->content.value = L"Right"; break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeWindow::WindowSizeState>(const ::vl::presentation::INativeWindow::WindowSizeState & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::INativeWindow::WindowSizeState>(const ::vl::presentation::INativeWindow::WindowSizeState&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::INativeWindow::WindowSizeState::Minimized: node->content.value = L"Minimized"; break; + case ::vl::presentation::INativeWindow::WindowSizeState::Restored: node->content.value = L"Restored"; break; + case ::vl::presentation::INativeWindow::WindowSizeState::Maximized: node->content.value = L"Maximized"; break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeCoordinate>(const ::vl::presentation::NativeCoordinate & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"value", value.value); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativePoint>(const ::vl::presentation::NativePoint & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"x", value.x); + ConvertCustomTypeToJsonField(node, L"y", value.y); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeSize>(const ::vl::presentation::NativeSize & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"x", value.x); + ConvertCustomTypeToJsonField(node, L"y", value.y); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeRect>(const ::vl::presentation::NativeRect & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"x1", value.x1); + ConvertCustomTypeToJsonField(node, L"y1", value.y1); + ConvertCustomTypeToJsonField(node, L"x2", value.x2); + ConvertCustomTypeToJsonField(node, L"y2", value.y2); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeMargin>(const ::vl::presentation::NativeMargin & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"left", value.left); + ConvertCustomTypeToJsonField(node, L"top", value.top); + ConvertCustomTypeToJsonField(node, L"right", value.right); + ConvertCustomTypeToJsonField(node, L"bottom", value.bottom); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::FontProperties>(const ::vl::presentation::FontProperties & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"fontFamily", value.fontFamily); + ConvertCustomTypeToJsonField(node, L"size", value.size); + ConvertCustomTypeToJsonField(node, L"bold", value.bold); + ConvertCustomTypeToJsonField(node, L"italic", value.italic); + ConvertCustomTypeToJsonField(node, L"underline", value.underline); + ConvertCustomTypeToJsonField(node, L"strikeline", value.strikeline); + ConvertCustomTypeToJsonField(node, L"antialias", value.antialias); + ConvertCustomTypeToJsonField(node, L"verticalAntialias", value.verticalAntialias); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::FontConfig & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"defaultFont", value.defaultFont); + ConvertCustomTypeToJsonField(node, L"supportedFonts", value.supportedFonts); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::ScreenConfig & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"bounds", value.bounds); + ConvertCustomTypeToJsonField(node, L"clientBounds", value.clientBounds); + ConvertCustomTypeToJsonField(node, L"scalingX", value.scalingX); + ConvertCustomTypeToJsonField(node, L"scalingY", value.scalingY); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowMouseInfo>(const ::vl::presentation::NativeWindowMouseInfo & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"ctrl", value.ctrl); + ConvertCustomTypeToJsonField(node, L"shift", value.shift); + ConvertCustomTypeToJsonField(node, L"left", value.left); + ConvertCustomTypeToJsonField(node, L"middle", value.middle); + ConvertCustomTypeToJsonField(node, L"right", value.right); + ConvertCustomTypeToJsonField(node, L"x", value.x); + ConvertCustomTypeToJsonField(node, L"y", value.y); + ConvertCustomTypeToJsonField(node, L"wheel", value.wheel); + ConvertCustomTypeToJsonField(node, L"nonClient", value.nonClient); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseInfoWithButton & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"button", value.button); + ConvertCustomTypeToJsonField(node, L"info", value.info); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowKeyInfo>(const ::vl::presentation::NativeWindowKeyInfo & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"code", value.code); + ConvertCustomTypeToJsonField(node, L"ctrl", value.ctrl); + ConvertCustomTypeToJsonField(node, L"shift", value.shift); + ConvertCustomTypeToJsonField(node, L"alt", value.alt); + ConvertCustomTypeToJsonField(node, L"capslock", value.capslock); + ConvertCustomTypeToJsonField(node, L"autoRepeatKeyDown", value.autoRepeatKeyDown); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowCharInfo>(const ::vl::presentation::NativeWindowCharInfo & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"code", value.code); + ConvertCustomTypeToJsonField(node, L"ctrl", value.ctrl); + ConvertCustomTypeToJsonField(node, L"shift", value.shift); + ConvertCustomTypeToJsonField(node, L"alt", value.alt); + ConvertCustomTypeToJsonField(node, L"capslock", value.capslock); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::GlobalShortcutKey & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"ctrl", value.ctrl); + ConvertCustomTypeToJsonField(node, L"shift", value.shift); + ConvertCustomTypeToJsonField(node, L"alt", value.alt); + ConvertCustomTypeToJsonField(node, L"code", value.code); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowSizingConfig & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"bounds", value.bounds); + ConvertCustomTypeToJsonField(node, L"clientBounds", value.clientBounds); + ConvertCustomTypeToJsonField(node, L"sizeState", value.sizeState); + ConvertCustomTypeToJsonField(node, L"customFramePadding", value.customFramePadding); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowShowing & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"activate", value.activate); + ConvertCustomTypeToJsonField(node, L"sizeState", value.sizeState); + return node; + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseButton& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::IOMouseButton&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Left") value = vl::presentation::remoteprotocol::IOMouseButton::Left; else + if (jsonNode->content.value == L"Middle") value = vl::presentation::remoteprotocol::IOMouseButton::Middle; else + if (jsonNode->content.value == L"Right") value = vl::presentation::remoteprotocol::IOMouseButton::Right; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::INativeWindow::WindowSizeState>(vl::Ptr node, ::vl::presentation::INativeWindow::WindowSizeState& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::INativeWindow::WindowSizeState>(Ptr, ::vl::presentation::INativeWindow::WindowSizeState&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Minimized") value = ::vl::presentation::INativeWindow::WindowSizeState::Minimized; else + if (jsonNode->content.value == L"Restored") value = ::vl::presentation::INativeWindow::WindowSizeState::Restored; else + if (jsonNode->content.value == L"Maximized") value = ::vl::presentation::INativeWindow::WindowSizeState::Maximized; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(vl::Ptr node, ::vl::presentation::NativeCoordinate& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(Ptr, ::vl::presentation::NativeCoordinate&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"value") ConvertJsonToCustomType(field->value, value.value); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativePoint>(vl::Ptr node, ::vl::presentation::NativePoint& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativePoint>(Ptr, ::vl::presentation::NativePoint&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"x") ConvertJsonToCustomType(field->value, value.x); else + if (field->name.value == L"y") ConvertJsonToCustomType(field->value, value.y); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeSize>(vl::Ptr node, ::vl::presentation::NativeSize& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeSize>(Ptr, ::vl::presentation::NativeSize&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"x") ConvertJsonToCustomType(field->value, value.x); else + if (field->name.value == L"y") ConvertJsonToCustomType(field->value, value.y); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeRect>(vl::Ptr node, ::vl::presentation::NativeRect& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeRect>(Ptr, ::vl::presentation::NativeRect&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"x1") ConvertJsonToCustomType(field->value, value.x1); else + if (field->name.value == L"y1") ConvertJsonToCustomType(field->value, value.y1); else + if (field->name.value == L"x2") ConvertJsonToCustomType(field->value, value.x2); else + if (field->name.value == L"y2") ConvertJsonToCustomType(field->value, value.y2); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeMargin>(vl::Ptr node, ::vl::presentation::NativeMargin& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeMargin>(Ptr, ::vl::presentation::NativeMargin&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"left") ConvertJsonToCustomType(field->value, value.left); else + if (field->name.value == L"top") ConvertJsonToCustomType(field->value, value.top); else + if (field->name.value == L"right") ConvertJsonToCustomType(field->value, value.right); else + if (field->name.value == L"bottom") ConvertJsonToCustomType(field->value, value.bottom); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::FontProperties>(vl::Ptr node, ::vl::presentation::FontProperties& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::FontProperties>(Ptr, ::vl::presentation::FontProperties&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"fontFamily") ConvertJsonToCustomType(field->value, value.fontFamily); else + if (field->name.value == L"size") ConvertJsonToCustomType(field->value, value.size); else + if (field->name.value == L"bold") ConvertJsonToCustomType(field->value, value.bold); else + if (field->name.value == L"italic") ConvertJsonToCustomType(field->value, value.italic); else + if (field->name.value == L"underline") ConvertJsonToCustomType(field->value, value.underline); else + if (field->name.value == L"strikeline") ConvertJsonToCustomType(field->value, value.strikeline); else + if (field->name.value == L"antialias") ConvertJsonToCustomType(field->value, value.antialias); else + if (field->name.value == L"verticalAntialias") ConvertJsonToCustomType(field->value, value.verticalAntialias); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::FontConfig& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::FontConfig&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"defaultFont") ConvertJsonToCustomType(field->value, value.defaultFont); else + if (field->name.value == L"supportedFonts") ConvertJsonToCustomType(field->value, value.supportedFonts); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::ScreenConfig& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::ScreenConfig&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"bounds") ConvertJsonToCustomType(field->value, value.bounds); else + if (field->name.value == L"clientBounds") ConvertJsonToCustomType(field->value, value.clientBounds); else + if (field->name.value == L"scalingX") ConvertJsonToCustomType(field->value, value.scalingX); else + if (field->name.value == L"scalingY") ConvertJsonToCustomType(field->value, value.scalingY); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowMouseInfo>(vl::Ptr node, ::vl::presentation::NativeWindowMouseInfo& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeWindowMouseInfo>(Ptr, ::vl::presentation::NativeWindowMouseInfo&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"ctrl") ConvertJsonToCustomType(field->value, value.ctrl); else + if (field->name.value == L"shift") ConvertJsonToCustomType(field->value, value.shift); else + if (field->name.value == L"left") ConvertJsonToCustomType(field->value, value.left); else + if (field->name.value == L"middle") ConvertJsonToCustomType(field->value, value.middle); else + if (field->name.value == L"right") ConvertJsonToCustomType(field->value, value.right); else + if (field->name.value == L"x") ConvertJsonToCustomType(field->value, value.x); else + if (field->name.value == L"y") ConvertJsonToCustomType(field->value, value.y); else + if (field->name.value == L"wheel") ConvertJsonToCustomType(field->value, value.wheel); else + if (field->name.value == L"nonClient") ConvertJsonToCustomType(field->value, value.nonClient); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseInfoWithButton& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::IOMouseInfoWithButton&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"button") ConvertJsonToCustomType(field->value, value.button); else + if (field->name.value == L"info") ConvertJsonToCustomType(field->value, value.info); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowKeyInfo>(vl::Ptr node, ::vl::presentation::NativeWindowKeyInfo& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeWindowKeyInfo>(Ptr, ::vl::presentation::NativeWindowKeyInfo&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"code") ConvertJsonToCustomType(field->value, value.code); else + if (field->name.value == L"ctrl") ConvertJsonToCustomType(field->value, value.ctrl); else + if (field->name.value == L"shift") ConvertJsonToCustomType(field->value, value.shift); else + if (field->name.value == L"alt") ConvertJsonToCustomType(field->value, value.alt); else + if (field->name.value == L"capslock") ConvertJsonToCustomType(field->value, value.capslock); else + if (field->name.value == L"autoRepeatKeyDown") ConvertJsonToCustomType(field->value, value.autoRepeatKeyDown); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowCharInfo>(vl::Ptr node, ::vl::presentation::NativeWindowCharInfo& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeWindowCharInfo>(Ptr, ::vl::presentation::NativeWindowCharInfo&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"code") ConvertJsonToCustomType(field->value, value.code); else + if (field->name.value == L"ctrl") ConvertJsonToCustomType(field->value, value.ctrl); else + if (field->name.value == L"shift") ConvertJsonToCustomType(field->value, value.shift); else + if (field->name.value == L"alt") ConvertJsonToCustomType(field->value, value.alt); else + if (field->name.value == L"capslock") ConvertJsonToCustomType(field->value, value.capslock); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::GlobalShortcutKey& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::GlobalShortcutKey&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"ctrl") ConvertJsonToCustomType(field->value, value.ctrl); else + if (field->name.value == L"shift") ConvertJsonToCustomType(field->value, value.shift); else + if (field->name.value == L"alt") ConvertJsonToCustomType(field->value, value.alt); else + if (field->name.value == L"code") ConvertJsonToCustomType(field->value, value.code); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowSizingConfig& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::WindowSizingConfig&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"bounds") ConvertJsonToCustomType(field->value, value.bounds); else + if (field->name.value == L"clientBounds") ConvertJsonToCustomType(field->value, value.clientBounds); else + if (field->name.value == L"sizeState") ConvertJsonToCustomType(field->value, value.sizeState); else + if (field->name.value == L"customFramePadding") ConvertJsonToCustomType(field->value, value.customFramePadding); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowShowing& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::WindowShowing&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"activate") ConvertJsonToCustomType(field->value, value.activate); else + if (field->name.value == L"sizeState") ConvertJsonToCustomType(field->value, value.sizeState); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + +} + + /*********************************************************************** .\RESOURCES\GUIDOCUMENT.CPP ***********************************************************************/ diff --git a/Import/GacUI.h b/Import/GacUI.h index fe2b6676..ae8d3d9e 100644 --- a/Import/GacUI.h +++ b/Import/GacUI.h @@ -648,7 +648,7 @@ Resources Keys ***********************************************************************/ -#define GUI_DEFINE_KEYBOARD_CODE(ITEM) \ +#define GUI_DEFINE_KEYBOARD_CODE_BASIC(ITEM) \ /* \ * Virtual Keys, Standard Set \ */ \ @@ -670,7 +670,6 @@ ITEM(CAPITAL, 0x14) \ ITEM(KANA_HANGUL, 0x15) \ ITEM(JUNJA, 0x17) \ ITEM(FINAL, 0x18) \ -ITEM(HANJA, 0x19) \ ITEM(KANJI, 0x19) \ ITEM(ESCAPE, 0x1B) \ ITEM(CONVERT, 0x1C) \ @@ -779,10 +778,6 @@ ITEM(F23, 0x86) \ ITEM(F24, 0x87) \ ITEM(NUMLOCK, 0x90) \ ITEM(SCROLL, 0x91) \ -/* \ - * NEC PC-9800 kbd definitions \ - */ \ -ITEM(OEM_NEC_EQUAL, 0x92) /* '=' key on numpad */ \ /* \ * Fujitsu/OASYS kbd definitions \ */ \ @@ -820,17 +815,10 @@ ITEM(LAUNCH_MAIL, 0xB4) \ ITEM(LAUNCH_MEDIA_SELECT, 0xB5) \ ITEM(LAUNCH_APP1, 0xB6) \ ITEM(LAUNCH_APP2, 0xB7) \ -ITEM(OEM_1, 0xBA) /* ';:' for US */ \ ITEM(OEM_PLUS, 0xBB) /* '+' any country */ \ ITEM(OEM_COMMA, 0xBC) /* ',' any country */ \ ITEM(OEM_MINUS, 0xBD) /* '-' any country */ \ ITEM(OEM_PERIOD, 0xBE) /* '.' any country */ \ -ITEM(OEM_2, 0xBF) /* '/?' for US */ \ -ITEM(OEM_3, 0xC0) /* '`~' for US */ \ -ITEM(OEM_4, 0xDB) /* '[{' for US */ \ -ITEM(OEM_5, 0xDC) /* '\|' for US */ \ -ITEM(OEM_6, 0xDD) /* ']}' for US */ \ -ITEM(OEM_7, 0xDE) /* ''"' for US */ \ ITEM(OEM_8, 0xDF) \ /* \ * Various extended or enhanced keyboards \ @@ -878,19 +866,142 @@ ITEM(BACKSLASH, 0xDC) /* OEM_5 */ \ ITEM(LEFT_BRACKET, 0xDD) /* OEM_6 */ \ ITEM(APOSTROPHE, 0xDE) /* OEM_7 */ \ +#define GUI_DEFINE_KEYBOARD_CODE_ADDITIONAL(ITEM) \ +ITEM(OEM_1, 0xBA) /* ';:' for US */ \ +ITEM(OEM_2, 0xBF) /* '/?' for US */ \ +ITEM(OEM_3, 0xC0) /* '`~' for US */ \ +ITEM(OEM_4, 0xDB) /* '[{' for US */ \ +ITEM(OEM_5, 0xDC) /* '\|' for US */ \ +ITEM(OEM_6, 0xDD) /* ']}' for US */ \ +ITEM(OEM_7, 0xDE) /* ''"' for US */ \ +ITEM(HANJA, 0x19) \ +/* \ + * NEC PC-9800 kbd definitions \ + */ \ +ITEM(OEM_NEC_EQUAL, 0x92) /* '=' key on numpad */ \ + +#define GUI_DEFINE_KEYBOARD_CODE(ITEM) \ + GUI_DEFINE_KEYBOARD_CODE_BASIC(ITEM) \ + GUI_DEFINE_KEYBOARD_CODE_ADDITIONAL(ITEM) \ + + +#define GUI_DEFINE_KEYBOARD_WINDOWS_NAME(ITEM) \ +ITEM(BACK, L"Backspace")\ +ITEM(TAB, L"Tab")\ +ITEM(RETURN, L"Enter")\ +ITEM(SHIFT, L"Shift")\ +ITEM(CONTROL, L"Ctrl")\ +ITEM(MENU, L"Alt")\ +ITEM(CAPITAL, L"Caps Lock")\ +ITEM(ESCAPE, L"Esc")\ +ITEM(SPACE, L"Space")\ +ITEM(PRIOR, L"Page Up")\ +ITEM(NEXT, L"Page Down")\ +ITEM(END, L"End")\ +ITEM(HOME, L"Home")\ +ITEM(LEFT, L"Left")\ +ITEM(UP, L"Up")\ +ITEM(RIGHT, L"Right")\ +ITEM(DOWN, L"Down")\ +ITEM(SNAPSHOT, L"Sys Req")\ +ITEM(INSERT, L"Insert")\ +ITEM(DELETE, L"Delete")\ +ITEM(0, L"0")\ +ITEM(1, L"1")\ +ITEM(2, L"2")\ +ITEM(3, L"3")\ +ITEM(4, L"4")\ +ITEM(5, L"5")\ +ITEM(6, L"6")\ +ITEM(7, L"7")\ +ITEM(8, L"8")\ +ITEM(9, L"9")\ +ITEM(A, L"A")\ +ITEM(B, L"B")\ +ITEM(C, L"C")\ +ITEM(D, L"D")\ +ITEM(E, L"E")\ +ITEM(F, L"F")\ +ITEM(G, L"G")\ +ITEM(H, L"H")\ +ITEM(I, L"I")\ +ITEM(J, L"J")\ +ITEM(K, L"K")\ +ITEM(L, L"L")\ +ITEM(M, L"M")\ +ITEM(N, L"N")\ +ITEM(O, L"O")\ +ITEM(P, L"P")\ +ITEM(Q, L"Q")\ +ITEM(R, L"R")\ +ITEM(S, L"S")\ +ITEM(T, L"T")\ +ITEM(U, L"U")\ +ITEM(V, L"V")\ +ITEM(W, L"W")\ +ITEM(X, L"X")\ +ITEM(Y, L"Y")\ +ITEM(Z, L"Z")\ +ITEM(NUMPAD0, L"Num 0")\ +ITEM(NUMPAD1, L"Num 1")\ +ITEM(NUMPAD2, L"Num 2")\ +ITEM(NUMPAD3, L"Num 3")\ +ITEM(NUMPAD4, L"Num 4")\ +ITEM(NUMPAD5, L"Num 5")\ +ITEM(NUMPAD6, L"Num 6")\ +ITEM(NUMPAD7, L"Num 7")\ +ITEM(NUMPAD8, L"Num 8")\ +ITEM(NUMPAD9, L"Num 9")\ +ITEM(MULTIPLY, L"Num *")\ +ITEM(ADD, L"Num +")\ +ITEM(SUBTRACT, L"Num -")\ +ITEM(DECIMAL, L"Num Del")\ +ITEM(DIVIDE, L"/")\ +ITEM(F1, L"F1")\ +ITEM(F2, L"F2")\ +ITEM(F3, L"F3")\ +ITEM(F4, L"F4")\ +ITEM(F5, L"F5")\ +ITEM(F6, L"F6")\ +ITEM(F7, L"F7")\ +ITEM(F8, L"F8")\ +ITEM(F9, L"F9")\ +ITEM(F10, L"F10")\ +ITEM(F11, L"F11")\ +ITEM(F12, L"F12")\ +ITEM(NUMLOCK, L"Pause")\ +ITEM(SCROLL, L"Scroll Lock")\ +ITEM(BROWSER_HOME, L"M")\ +ITEM(VOLUME_MUTE, L"D")\ +ITEM(VOLUME_DOWN, L"C")\ +ITEM(VOLUME_UP, L"B")\ +ITEM(MEDIA_NEXT_TRACK, L"P")\ +ITEM(MEDIA_PREV_TRACK, L"Q")\ +ITEM(MEDIA_STOP, L"J")\ +ITEM(MEDIA_PLAY_PAUSE, L"G")\ +ITEM(LAUNCH_APP2, L"F")\ +ITEM(OEM_PLUS, L"=")\ +ITEM(OEM_COMMA, L",")\ +ITEM(OEM_MINUS, L"-")\ +ITEM(OEM_PERIOD, L".")\ +ITEM(OEM_102, L"\\")\ +ITEM(SEMICOLON, L";")\ +ITEM(SLASH, L"/")\ +ITEM(GRAVE_ACCENT, L"`")\ +ITEM(RIGHT_BRACKET, L"[")\ +ITEM(BACKSLASH, L"\\")\ +ITEM(LEFT_BRACKET, L"]")\ +ITEM(APOSTROPHE, L"'")\ + #define GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM(NAME, CODE) KEY_##NAME = CODE, enum class VKEY { KEY_UNKNOWN = -1, + KEY_MAXIMUM = 255, GUI_DEFINE_KEYBOARD_CODE(GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM) }; #undef GUI_DEFINE_KEYBOARD_CODE_ENUM_ITEM - static bool operator == (VKEY a, VKEY b) { return (vint)a == (vint)b; } - static bool operator != (VKEY a, VKEY b) { return (vint)a != (vint)b; } - static bool operator < (VKEY a, VKEY b) { return (vint)a < (vint)b; } - static bool operator <= (VKEY a, VKEY b) { return (vint)a <= (vint)b; } - static bool operator > (VKEY a, VKEY b) { return (vint)a > (vint)b; } - static bool operator >= (VKEY a, VKEY b) { return (vint)a >= (vint)b; } + static auto operator <=> (VKEY a, VKEY b) { return (vint)a <=> (vint)b; } static VKEY operator & (VKEY a, VKEY b) { return (VKEY)((vint)a & (vint)b); } static VKEY operator | (VKEY a, VKEY b) { return (VKEY)((vint)a | (vint)b); } @@ -6987,8 +7098,8 @@ Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_GUIHOSTEDGRAPHICS -#define VCZH_PRESENTATION_GUIHOSTEDGRAPHICS +#ifndef VCZH_PRESENTATION_GUIHOSTEDCONTROLLER_GUIHOSTEDGRAPHICS +#define VCZH_PRESENTATION_GUIHOSTEDCONTROLLER_GUIHOSTEDGRAPHICS namespace vl @@ -7043,8 +7154,8 @@ Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_GUIHOSTEDWINDOWMANAGER -#define VCZH_PRESENTATION_GUIHOSTEDWINDOWMANAGER +#ifndef VCZH_PRESENTATION_GUIHOSTEDCONTROLLER_GUIHOSTEDWINDOWMANAGER +#define VCZH_PRESENTATION_GUIHOSTEDCONTROLLER_GUIHOSTEDWINDOWMANAGER namespace vl @@ -7530,13 +7641,13 @@ Window { current = current->parent; } + windowManager->activeWindow = current; + windowManager->needRefresh = true; if (current) { current->active = true; windowManager->OnGotFocus(current); } - windowManager->activeWindow = current; - windowManager->needRefresh = true; } #undef ERROR_MESSAGE_PREFIX } @@ -7703,8 +7814,8 @@ Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_GUIHOSTEDWINDOW -#define VCZH_PRESENTATION_GUIHOSTEDWINDOW +#ifndef VCZH_PRESENTATION_GUIHOSTEDCONTROLLER_GUIHOSTEDWINDOW +#define VCZH_PRESENTATION_GUIHOSTEDCONTROLLER_GUIHOSTEDWINDOW namespace vl @@ -7786,7 +7897,7 @@ Proxy extern Ptr CreatePlaceholderHostedWindowProxy(GuiHostedWindowData* data); extern Ptr CreateMainHostedWindowProxy(GuiHostedWindowData* data, INativeWindow* nativeWindow); - extern Ptr CreateNonMainHostedWindowProxy(GuiHostedWindowData* data); + extern Ptr CreateNonMainHostedWindowProxy(GuiHostedWindowData* data, INativeWindow* nativeWindow); /*********************************************************************** GuiHostedWindow @@ -7811,7 +7922,7 @@ GuiHostedWindow ~GuiHostedWindow(); // ============================================================= - // INativeWindowListener + // INativeWindow // ============================================================= bool IsActivelyRefreshing() override; @@ -7889,6 +8000,439 @@ GuiHostedWindow #endif +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEGRAPHICS.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window + +Interfaces: + GuiRemoteController + +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTEGRAPHICS +#define VCZH_PRESENTATION_GUIREMOTEGRAPHICS + + +namespace vl::presentation +{ + class GuiRemoteController; + + namespace elements + { +/*********************************************************************** +GuiRemoteGraphicsRenderTarget +***********************************************************************/ + + class GuiRemoteGraphicsRenderTarget : public GuiGraphicsRenderTarget + { + protected: + GuiRemoteController* remote; + NativeSize canvasSize; + + void StartRenderingOnNativeWindow() override; + RenderTargetFailure StopRenderingOnNativeWindow() override; + + Size GetCanvasSize() override; + void AfterPushedClipper(Rect clipper, Rect validArea) override; + void AfterPushedClipperAndBecameInvalid(Rect clipper) override; + void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) override; + void AfterPoppedClipper(Rect validArea, bool clipperExists) override; + public: + GuiRemoteGraphicsRenderTarget(GuiRemoteController* _remote); + ~GuiRemoteGraphicsRenderTarget(); + }; + +/*********************************************************************** +GuiRemoteGraphicsResourceManager +***********************************************************************/ + + class GuiRemoteGraphicsResourceManager : public GuiGraphicsResourceManager + { + protected: + GuiRemoteController* remote; + GuiRemoteGraphicsRenderTarget renderTarget; + + public: + GuiRemoteGraphicsResourceManager(GuiRemoteController* _remote); + ~GuiRemoteGraphicsResourceManager(); + + // ============================================================= + // IGuiGraphicsResourceManager + // ============================================================= + + IGuiGraphicsRenderTarget* GetRenderTarget(INativeWindow* window) override; + void RecreateRenderTarget(INativeWindow* window) override; + void ResizeRenderTarget(INativeWindow* window) override; + IGuiGraphicsLayoutProvider* GetLayoutProvider() override; + }; + } +} + +#endif + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOLSCHEMASHARED.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window + +Interfaces: + IGuiRemoteProtocol + +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMASHARED +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMASHARED + + +namespace vl::presentation::remoteprotocol +{ + template + struct JsonHelper + { + static Ptr ToJson(const T& value); + static void ConvertJsonToCustomType(Ptr node, T& value); + }; + + template + Ptr ConvertCustomTypeToJson(const T& value) + { + return JsonHelper::ToJson(value); + } + + template<> Ptr ConvertCustomTypeToJson(const bool& value); + template<> Ptr ConvertCustomTypeToJson(const vint& value); + template<> Ptr ConvertCustomTypeToJson(const float& value); + template<> Ptr ConvertCustomTypeToJson(const double& value); + template<> Ptr ConvertCustomTypeToJson(const WString& value); + template<> Ptr ConvertCustomTypeToJson(const wchar_t& value); + template<> Ptr ConvertCustomTypeToJson(const VKEY& value); + + template + void ConvertJsonToCustomType(Ptr node, T& value) + { + return JsonHelper::FromJson(node, value); + } + + template<> void ConvertJsonToCustomType(Ptr node, bool& value); + template<> void ConvertJsonToCustomType(Ptr node, vint& value); + template<> void ConvertJsonToCustomType(Ptr node, float& value); + template<> void ConvertJsonToCustomType(Ptr node, double& value); + template<> void ConvertJsonToCustomType(Ptr node, WString& value); + template<> void ConvertJsonToCustomType(Ptr node, wchar_t& value); + template<> void ConvertJsonToCustomType(Ptr node, VKEY& value); + + template + void ConvertCustomTypeToJsonField(Ptr node, const wchar_t* name, const T& value) + { + auto field = Ptr(new glr::json::JsonObjectField); + field->name.value = WString::Unmanaged(name); + field->value = ConvertCustomTypeToJson(value); + node->fields.Add(field); + } + + template + struct JsonHelper>> + { + static Ptr ToJson(const Ptr>& value) + { + if (!value) + { + auto node = Ptr(new glr::json::JsonLiteral); + node->value = glr::json::JsonLiteralValue::Null; + return node; + } + else + { + auto node = Ptr(new glr::json::JsonArray); + for (auto&& item : *value.Obj()) + { + node->items.Add(ConvertCustomTypeToJson(item)); + } + return node; + } + } + + static void FromJson(Ptr node, Ptr>& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, Ptr>&)#" + if (auto jsonLiteral = node.Cast()) + { + if (jsonLiteral->value == glr::json::JsonLiteralValue::Null) + { + value = {}; + return; + } + } + else if (auto jsonArray = node.Cast()) + { + value = Ptr(new collections::List); + for (auto jsonItem : jsonArray->items) + { + T item; + ConvertJsonToCustomType(jsonItem, item); + value->Add(std::move(item)); + } + return; + } + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); +#undef ERROR_MESSAGE_PREFIX + } + }; +} + +#endif + + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\PROTOCOL\GENERATED\GUIREMOTEPROTOCOLSCHEMA.H +***********************************************************************/ +/*********************************************************************** +This file is generated by : Vczh GacUI Remote Protocol Generator +Licensed under https ://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMA +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMA + + +namespace vl::presentation::remoteprotocol +{ + enum class IOMouseButton + { + Left, + Middle, + Right, + }; + + struct FontConfig + { + ::vl::presentation::FontProperties defaultFont; + ::vl::Ptr<::vl::collections::List<::vl::WString>> supportedFonts; + }; + + struct ScreenConfig + { + ::vl::presentation::NativeRect bounds; + ::vl::presentation::NativeRect clientBounds; + double scalingX; + double scalingY; + }; + + struct IOMouseInfoWithButton + { + vl::presentation::remoteprotocol::IOMouseButton button; + ::vl::presentation::NativeWindowMouseInfo info; + }; + + struct GlobalShortcutKey + { + ::vl::vint id; + bool ctrl; + bool shift; + bool alt; + ::vl::presentation::VKEY code; + }; + + struct WindowSizingConfig + { + ::vl::presentation::NativeRect bounds; + ::vl::presentation::NativeRect clientBounds; + ::vl::presentation::INativeWindow::WindowSizeState sizeState; + ::vl::presentation::NativeMargin customFramePadding; + }; + + struct WindowShowing + { + bool activate; + ::vl::presentation::INativeWindow::WindowSizeState sizeState; + }; + + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseButton & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeWindow::WindowSizeState>(const ::vl::presentation::INativeWindow::WindowSizeState & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeCoordinate>(const ::vl::presentation::NativeCoordinate & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativePoint>(const ::vl::presentation::NativePoint & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeSize>(const ::vl::presentation::NativeSize & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeRect>(const ::vl::presentation::NativeRect & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeMargin>(const ::vl::presentation::NativeMargin & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::FontProperties>(const ::vl::presentation::FontProperties & value); + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::FontConfig & value); + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::ScreenConfig & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowMouseInfo>(const ::vl::presentation::NativeWindowMouseInfo & value); + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseInfoWithButton & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowKeyInfo>(const ::vl::presentation::NativeWindowKeyInfo & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowCharInfo>(const ::vl::presentation::NativeWindowCharInfo & value); + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::GlobalShortcutKey & value); + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowSizingConfig & value); + template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowShowing & value); + + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseButton& value); + template<> void ConvertJsonToCustomType<::vl::presentation::INativeWindow::WindowSizeState>(vl::Ptr node, ::vl::presentation::INativeWindow::WindowSizeState& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(vl::Ptr node, ::vl::presentation::NativeCoordinate& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativePoint>(vl::Ptr node, ::vl::presentation::NativePoint& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeSize>(vl::Ptr node, ::vl::presentation::NativeSize& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeRect>(vl::Ptr node, ::vl::presentation::NativeRect& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeMargin>(vl::Ptr node, ::vl::presentation::NativeMargin& value); + template<> void ConvertJsonToCustomType<::vl::presentation::FontProperties>(vl::Ptr node, ::vl::presentation::FontProperties& value); + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::FontConfig& value); + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::ScreenConfig& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowMouseInfo>(vl::Ptr node, ::vl::presentation::NativeWindowMouseInfo& value); + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseInfoWithButton& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowKeyInfo>(vl::Ptr node, ::vl::presentation::NativeWindowKeyInfo& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowCharInfo>(vl::Ptr node, ::vl::presentation::NativeWindowCharInfo& value); + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::GlobalShortcutKey& value); + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowSizingConfig& value); + template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowShowing& value); + +#define GACUI_REMOTEPROTOCOL_MESSAGES(HANDLER)\ + HANDLER(ControllerGetFontConfig, void, vl::presentation::remoteprotocol::FontConfig, NOREQ, RES, NODROP)\ + HANDLER(ControllerGetScreenConfig, void, vl::presentation::remoteprotocol::ScreenConfig, NOREQ, RES, NODROP)\ + HANDLER(ControllerConnectionEstablished, void, void, NOREQ, NORES, NODROP)\ + HANDLER(ControllerConnectionStopped, void, void, NOREQ, NORES, NODROP)\ + HANDLER(IOUpdateGlobalShortcutKey, ::vl::Ptr<::vl::collections::List>, void, REQ, NORES, NODROP)\ + HANDLER(IORequireCapture, void, void, NOREQ, NORES, NODROP)\ + HANDLER(IOReleaseCapture, void, void, NOREQ, NORES, NODROP)\ + HANDLER(IOIsKeyPressing, ::vl::presentation::VKEY, bool, REQ, RES, NODROP)\ + HANDLER(IOIsKeyToggled, ::vl::presentation::VKEY, bool, REQ, RES, NODROP)\ + HANDLER(WindowGetBounds, void, vl::presentation::remoteprotocol::WindowSizingConfig, NOREQ, RES, NODROP)\ + HANDLER(WindowNotifySetTitle, ::vl::WString, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetEnabled, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetTopMost, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetShowInTaskBar, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetCustomFrameMode, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetMaximizedBox, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetMinimizedBox, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetBorder, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetSizeBox, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetIconVisible, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetTitleBar, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetBounds, ::vl::presentation::NativeRect, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetClientSize, ::vl::presentation::NativeSize, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifyActivate, void, void, NOREQ, NORES, DROPREP)\ + HANDLER(WindowNotifyShow, vl::presentation::remoteprotocol::WindowShowing, void, REQ, NORES, DROPREP)\ + +#define GACUI_REMOTEPROTOCOL_EVENTS(HANDLER)\ + HANDLER(ControllerConnect, void, NOREQ, NODROP)\ + HANDLER(ControllerDisconnect, void, NOREQ, NODROP)\ + HANDLER(ControllerRequestExit, void, NOREQ, NODROP)\ + HANDLER(ControllerForceExit, void, NOREQ, NODROP)\ + HANDLER(ControllerScreenUpdated, vl::presentation::remoteprotocol::ScreenConfig, REQ, DROPREP)\ + HANDLER(IOGlobalShortcutKey, ::vl::vint, REQ, NODROP)\ + HANDLER(IOButtonDown, vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ + HANDLER(IOButtonDoubleClick, vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ + HANDLER(IOButtonUp, vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ + HANDLER(IOHWheel, ::vl::presentation::NativeWindowMouseInfo, REQ, NODROP)\ + HANDLER(IOVWheel, ::vl::presentation::NativeWindowMouseInfo, REQ, NODROP)\ + HANDLER(IOMouseMoving, ::vl::presentation::NativeWindowMouseInfo, REQ, DROPCON)\ + HANDLER(IOMouseEntered, void, NOREQ, NODROP)\ + HANDLER(IOMouseLeaved, void, NOREQ, NODROP)\ + HANDLER(IOKeyDown, ::vl::presentation::NativeWindowKeyInfo, REQ, NODROP)\ + HANDLER(IOKeyUp, ::vl::presentation::NativeWindowKeyInfo, REQ, NODROP)\ + HANDLER(IOChar, ::vl::presentation::NativeWindowCharInfo, REQ, NODROP)\ + HANDLER(WindowBoundsUpdated, vl::presentation::remoteprotocol::WindowSizingConfig, REQ, DROPREP)\ + HANDLER(WindowActivatedUpdated, bool, REQ, DROPREP)\ + +} + +#endif + + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOL.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window + +Interfaces: + IGuiRemoteProtocol + +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEPROTOCOL +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEPROTOCOL + + +namespace vl::presentation +{ +/*********************************************************************** +IGuiRemoteProtocolEvents +***********************************************************************/ + + class IGuiRemoteProtocolEvents : public virtual Interface + { + public: +#define EVENT_NOREQ(NAME, REQUEST) virtual void On ## NAME() = 0; +#define EVENT_REQ(NAME, REQUEST) virtual void On ## NAME(const REQUEST& arguments) = 0; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_REQ +#undef EVENT_NOREQ + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE) virtual void Respond ## NAME(vint id, const RESPONSE& arguments) = 0; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + }; + +/*********************************************************************** +IGuiRemoteProtocolMessages +***********************************************************************/ + + class IGuiRemoteProtocolMessages : public virtual Interface + { + public: +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME() = 0; +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(vint id) = 0; +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(const REQUEST& arguments) = 0; +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(vint id, const REQUEST& arguments) = 0; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES + }; + +/*********************************************************************** +IGuiRemoteProtocolConfig +***********************************************************************/ + + class IGuiRemoteProtocolConfig : public virtual Interface + { + public: + virtual WString GetExecutablePath() = 0; + }; + +/*********************************************************************** +IGuiRemoteProtocol +***********************************************************************/ + + class IGuiRemoteProtocol + : public virtual IGuiRemoteProtocolConfig + , public virtual IGuiRemoteProtocolMessages + { + public: + virtual void Initialize(IGuiRemoteProtocolEvents* events) = 0; + virtual void Submit() = 0; + virtual void ProcessRemoteEvents() = 0; + }; +} + +#endif + /*********************************************************************** .\RESOURCES\GUIPLUGINMANAGER.H ***********************************************************************/ @@ -22294,6 +22838,13 @@ using namespace vl::presentation::templates; // GacUI Compiler extern int SetupGacGenNativeController(); +// Remote +namespace vl::presentation +{ + class IGuiRemoteProtocol; +} +extern int SetupRemoteNativeController(vl::presentation::IGuiRemoteProtocol* protocol); + // Windows extern int SetupWindowsGDIRenderer(); extern int SetupWindowsDirect2DRenderer(); @@ -25812,3 +26363,440 @@ GuiHostedController } #endif + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEEVENTS.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window + +Interfaces: + GuiRemoteEvent + +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEEVENT +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEEVENT + + +namespace vl::presentation +{ + class GuiRemoteController; + +/*********************************************************************** +GuiRemoteMessages +***********************************************************************/ + + class GuiRemoteMessages : public Object + { + protected: + GuiRemoteController* remote; + vint id = 0; + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE) collections::Dictionary response ## NAME; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + + public: + GuiRemoteMessages(GuiRemoteController* _remote); + ~GuiRemoteMessages(); + + void Submit(); + void ClearResponses(); + + // messages + +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE) void Request ## NAME(); +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE) vint Request ## NAME(); +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE) void Request ## NAME(const REQUEST& arguments); +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE) vint Request ## NAME(const REQUEST& arguments); +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE)\ + void Respond ## NAME(vint id, const RESPONSE& arguments);\ + const RESPONSE& Retrieve ## NAME(vint id);\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + }; + +/*********************************************************************** +GuiRemoteEvents +***********************************************************************/ + + class GuiRemoteEvents : public Object, public virtual IGuiRemoteProtocolEvents + { + protected: + GuiRemoteController* remote; + + public: + GuiRemoteEvents(GuiRemoteController* _remote); + ~GuiRemoteEvents(); + + // ============================================================= + // IGuiRemoteProtocolEvents + // ============================================================= + + // messages + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE) void Respond ## NAME(vint id, const RESPONSE& arguments) override; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + + void ClearResponses(); + + // events + +#define EVENT_NOREQ(NAME, REQUEST) void On ## NAME() override; +#define EVENT_REQ(NAME, REQUEST) void On ## NAME(const REQUEST& arguments) override; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_REQ +#undef EVENT_NOREQ + }; +} + +#endif + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEWINDOW.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window + +Interfaces: + GuiRemoteController + +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEWINDOW +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEWINDOW + + +namespace vl::presentation +{ + class GuiRemoteController; + +/*********************************************************************** +GuiRemoteWindow +***********************************************************************/ + + class GuiRemoteWindow : public Object, public virtual INativeWindow + { + friend class GuiRemoteEvents; + friend class GuiRemoteController; + protected: + GuiRemoteController* remote; + GuiRemoteMessages& remoteMessages; + GuiRemoteEvents& remoteEvents; + collections::List listeners; + INativeWindow::WindowMode windowMode = INativeWindow::Normal; + + bool disconnected = false; + remoteprotocol::WindowSizingConfig remoteWindowSizingConfig; + bool sizingConfigInvalidated = false; + double scalingX = 1; + double scalingY = 1; + + WString styleTitle; + INativeCursor* styleCursor = nullptr; + NativePoint styleCaret; + Ptr styleIcon; + bool styleEnabled = true; + bool styleTopMost = false; + + bool styleMaximizedBox = true; + bool styleMinimizedBox = true; + bool styleBorder = true; + bool styleSizeBox = true; + bool styleIconVisible = true; + bool styleTitleBar = true; + bool styleShowInTaskBar = true; + bool styleCustomFrameMode = false; + + bool statusVisible = false; + bool statusActivated = false; + bool statusCapturing = false; + + void RequestGetBounds(); + void Opened(); + void SetActivated(bool activated); + void ShowWithSizeState(bool activate, INativeWindow::WindowSizeState sizeState); + + // ============================================================= + // Events + // ============================================================= + + void OnControllerConnect(); + void OnControllerDisconnect(); + void OnControllerScreenUpdated(const remoteprotocol::ScreenConfig& arguments); + void OnWindowBoundsUpdated(const remoteprotocol::WindowSizingConfig& arguments); + void OnWindowActivatedUpdated(bool activated); + + public: + GuiRemoteWindow(GuiRemoteController* _remote); + ~GuiRemoteWindow(); + + // ============================================================= + // INativeWindow + // ============================================================= + + bool IsActivelyRefreshing() override; + NativeSize GetRenderingOffset() override; + Point Convert(NativePoint value) override; + NativePoint Convert(Point value) override; + Size Convert(NativeSize value) override; + NativeSize Convert(Size value) override; + Margin Convert(NativeMargin value) override; + NativeMargin Convert(Margin value) override; + NativeRect GetBounds() override; + void SetBounds(const NativeRect& bounds) override; + NativeSize GetClientSize() override; + void SetClientSize(NativeSize size) override; + NativeRect GetClientBoundsInScreen() override; + WString GetTitle() override; + void SetTitle(const WString& title) override; + INativeCursor* GetWindowCursor() override; + void SetWindowCursor(INativeCursor* cursor) override; + NativePoint GetCaretPoint() override; + void SetCaretPoint(NativePoint point) override; + INativeWindow* GetParent() override; + void SetParent(INativeWindow* parent) override; + WindowMode GetWindowMode() override; + void EnableCustomFrameMode() override; + void DisableCustomFrameMode() override; + bool IsCustomFrameModeEnabled() override; + NativeMargin GetCustomFramePadding() override; + Ptr GetIcon() override; + void SetIcon(Ptr icon) override; + WindowSizeState GetSizeState() override; + void Show() override; + void ShowDeactivated() override; + void ShowRestored() override; + void ShowMaximized() override; + void ShowMinimized() override; + void Hide(bool closeWindow) override; + bool IsVisible() override; + void Enable() override; + void Disable() override; + bool IsEnabled() override; + void SetActivate() override; + bool IsActivated() override; + bool IsRenderingAsActivated() override; + void ShowInTaskBar() override; + void HideInTaskBar() override; + bool IsAppearedInTaskBar() override; + void EnableActivate() override; + void DisableActivate() override; + bool IsEnabledActivate() override; + bool RequireCapture() override; + bool ReleaseCapture() override; + bool IsCapturing() override; + bool GetMaximizedBox() override; + void SetMaximizedBox(bool visible) override; + bool GetMinimizedBox() override; + void SetMinimizedBox(bool visible) override; + bool GetBorder() override; + void SetBorder(bool visible) override; + bool GetSizeBox() override; + void SetSizeBox(bool visible) override; + bool GetIconVisible() override; + void SetIconVisible(bool visible) override; + bool GetTitleBar() override; + void SetTitleBar(bool visible) override; + bool GetTopMost() override; + void SetTopMost(bool topmost) override; + void SupressAlt() override; + bool InstallListener(INativeWindowListener* listener) override; + bool UninstallListener(INativeWindowListener* listener) override; + void RedrawContent() override; + }; +} + +#endif + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTECONTROLLER.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window + +Interfaces: + GuiRemoteController + +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER + + +namespace vl::presentation +{ +/*********************************************************************** +GuiRemoteController +***********************************************************************/ + + class GuiRemoteController + : public Object + , public INativeController + , protected INativeResourceService + , protected INativeInputService + , protected INativeScreenService + , protected INativeScreen + , protected INativeWindowService + { + friend class GuiRemoteMessages; + friend class GuiRemoteEvents; + friend class GuiRemoteWindow; + friend class elements::GuiRemoteGraphicsRenderTarget; + friend class elements::GuiRemoteGraphicsResourceManager; + using CursorMap = collections::Dictionary>; + using HotKeyEntry = Tuple; + using HotKeySet = collections::SortedList; + using HotKeyIds = collections::Dictionary; + protected: + IGuiRemoteProtocol* remoteProtocol; + GuiRemoteMessages remoteMessages; + GuiRemoteEvents remoteEvents; + GuiRemoteWindow remoteWindow; + SharedCallbackService callbackService; + SharedAsyncService asyncService; + bool applicationRunning = false; + bool connectionForcedToStop = false; + bool connectionStopped = false; + + remoteprotocol::FontConfig remoteFontConfig; + remoteprotocol::ScreenConfig remoteScreenConfig; + + vint usedHotKeys = (vint)NativeGlobalShortcutKeyResult::ValidIdBegins; + HotKeySet hotKeySet; + HotKeyIds hotKeyIds; + + CursorMap cursors; + bool timerEnabled = false; + bool windowCreated = false; + bool windowDestroyed = false; + + collections::Dictionary keyNames; + collections::Dictionary keyCodes; + bool keyInitialized = false; + + // ============================================================= + // INativeResourceService + // ============================================================= + + INativeCursor* GetSystemCursor(INativeCursor::SystemCursorType type) override; + INativeCursor* GetDefaultSystemCursor() override; + FontProperties GetDefaultFont() override; + void SetDefaultFont(const FontProperties& value) override; + void EnumerateFonts(collections::List& fonts) override; + + // ============================================================= + // INativeInputService + // ============================================================= + + void StartTimer() override; + void StopTimer() override; + bool IsTimerEnabled() override; + bool IsKeyPressing(VKEY code) override; + bool IsKeyToggled(VKEY code) override; + void EnsureKeyInitialized(); + WString GetKeyName(VKEY code) override; + VKEY GetKey(const WString& name) override; + void UpdateGlobalShortcutKey(); + vint RegisterGlobalShortcutKey(bool ctrl, bool shift, bool alt, VKEY key) override; + bool UnregisterGlobalShortcutKey(vint id) override; + + // ============================================================= + // INativeScreenService + // ============================================================= + + vint GetScreenCount() override; + INativeScreen* GetScreen(vint index) override; + INativeScreen* GetScreen(INativeWindow* window) override; + + // ============================================================= + // INativeScreen + // ============================================================= + + NativeRect GetBounds() override; + NativeRect GetClientBounds() override; + WString GetName() override; + bool IsPrimary() override; + double GetScalingX() override; + double GetScalingY() override; + + // ============================================================= + // INativeWindowService + // ============================================================= + + const NativeWindowFrameConfig& GetMainWindowFrameConfig() override; + const NativeWindowFrameConfig& GetNonMainWindowFrameConfig() override; + INativeWindow* CreateNativeWindow(INativeWindow::WindowMode windowMode) override; + void DestroyNativeWindow(INativeWindow* window) override; + INativeWindow* GetMainWindow() override; + INativeWindow* GetWindow(NativePoint location) override; + void Run(INativeWindow* window) override; + bool RunOneCycle() override; + + // ============================================================= + // Events + // ============================================================= + + void OnControllerConnect(); + void OnControllerDisconnect(); + void OnControllerRequestExit(); + void OnControllerForceExit(); + void OnControllerScreenUpdated(const remoteprotocol::ScreenConfig& arguments); + + public: + GuiRemoteController(IGuiRemoteProtocol* _remoteProtocol); + ~GuiRemoteController(); + + void Initialize(); + void Finalize(); + + // ============================================================= + // INativeController + // ============================================================= + + INativeCallbackService* CallbackService() override; + INativeResourceService* ResourceService() override; + INativeAsyncService* AsyncService() override; + INativeClipboardService* ClipboardService() override; + INativeImageService* ImageService() override; + INativeInputService* InputService() override; + INativeDialogService* DialogService() override; + WString GetExecutablePath() override; + + INativeScreenService* ScreenService() override; + INativeWindowService* WindowService() override; + }; +} + +#endif diff --git a/Import/GacUICompiler.cpp b/Import/GacUICompiler.cpp index aedd597b..e47c9db7 100644 --- a/Import/GacUICompiler.cpp +++ b/Import/GacUICompiler.cpp @@ -10461,6 +10461,1825 @@ namespace vl::presentation::instancequery } +/*********************************************************************** +.\REMOTEPROTOCOL\GUIREMOTEPROTOCOLCOMPILER.CPP +***********************************************************************/ + +namespace vl::presentation +{ + using namespace collections; + using namespace remoteprotocol; + +/*********************************************************************** +CheckRemoteProtocolSchema +***********************************************************************/ + + class GuiRpCheckSchemaVisitor + : public Object + , public GuiRpType::IVisitor + , public GuiRpDeclaration::IVisitor + { + protected: + Ptr symbols; + List& errors; + + public: + GuiRpCheckSchemaVisitor(Ptr _symbols, List& _errors) + : symbols(_symbols) + , errors(_errors) + { + } + + // GuiRpType::IVisitor + + void Visit(GuiRpPrimitiveType* node) override + { + } + + void Visit(GuiRpReferenceType* node) override + { + if (!symbols->enumDecls.Keys().Contains(node->name.value) && !symbols->structDecls.Keys().Contains(node->name.value)) + { + errors.Add({ node->name.codeRange,L"Custom type \"" + node->name.value + L"\" not found." }); + } + } + + void Visit(GuiRpArrayType* node) override + { + node->element->Accept(this); + } + + // GuiRpDeclaration::IVisitor + + bool EnsureTypeUndefined(const glr::ParsingToken& name) + { + if (symbols->enumDecls.Keys().Contains(name.value)) + { + errors.Add({ name.codeRange,L"Enum \"" + name.value + L"\" already defined." }); + return false; + } + if (symbols->structDecls.Keys().Contains(name.value)) + { + errors.Add({ name.codeRange,L"Struct \"" + name.value + L"\" already defined." }); + return false; + } + return true; + } + + void Visit(GuiRpEnumDecl* node) override + { + if (!EnsureTypeUndefined(node->name)) return; + + SortedList memberNames; + for (auto member : node->members) + { + if (memberNames.Contains(member->name.value)) + { + errors.Add({ member->name.codeRange,L"Enum member \"" + node->name.value + L"::" + member->name.value + L"\" already exists." }); + } + else + { + memberNames.Add(member->name.value); + } + } + + for (auto att : node->attributes) + { + if (att->name.value == L"@Cpp") + { + if (!att->cppType) + { + errors.Add({ att->name.codeRange,L"Missing parameter for attribute: \"" + att->name.value + L"\"." }); + } + else + { + symbols->cppMapping.Add(node->name.value, att->cppType.value); + } + } + else + { + errors.Add({ att->name.codeRange,L"Unsupported attribute: \"" + att->name.value + L"\" on enum \"" + node->name.value + L"\"." }); + } + } + symbols->enumDecls.Add(node->name.value, node); + } + + void Visit(GuiRpStructDecl* node) override + { + if (!EnsureTypeUndefined(node->name)) return; + + SortedList memberNames; + for (auto member : node->members) + { + if (memberNames.Contains(member->name.value)) + { + errors.Add({ member->name.codeRange,L"Struct member \"" + node->name.value + L"::" + member->name.value + L"\" already exists." }); + } + else + { + memberNames.Add(member->name.value); + } + member->type->Accept(this); + } + + for (auto att : node->attributes) + { + if (att->name.value == L"@Cpp") + { + if (!att->cppType) + { + errors.Add({ att->name.codeRange,L"Missing parameter for attribute: \"" + att->name.value + L"\"." }); + } + else if (symbols->cppMapping.Keys().Contains(node->name.value)) + { + errors.Add({ att->name.codeRange,L"Too many attributes: \"" + att->name.value + L"\"." }); + } + else + { + symbols->cppMapping.Add(node->name.value, att->cppType.value); + } + } + else + { + errors.Add({ att->name.codeRange,L"Unsupported attribute: \"" + att->name.value + L"\" on struct \"" + node->name.value + L"\"." }); + } + } + symbols->structDecls.Add(node->name.value, node); + } + + void VisitDropAttribute(Ptr att, const WString& name, SortedList& names) + { + if (names.Contains(name)) + { + errors.Add({ att->name.codeRange,L"Too many attributes: \"" + att->name.value + L"\"." }); + } + else + { + names.Add(name); + } + } + + void Visit(GuiRpMessageDecl* node) override + { + if (symbols->messageDecls.Keys().Contains(node->name.value)) + { + errors.Add({ node->name.codeRange,L"Message \"" + node->name.value + L"\" already exists." }); + return; + } + + if (node->request) + { + node->request->type->Accept(this); + } + + if (node->response) + { + node->response->type->Accept(this); + } + + for (auto att : node->attributes) + { + if (att->name.value == L"@DropRepeat") + { + if (node->response) + { + errors.Add({ node->name.codeRange,L"@DropRepeat cannot be used on message \"" + node->name.value + L"\" since it has response." }); + } + VisitDropAttribute(att, node->name.value, symbols->dropRepeatDeclNames); + } + else + { + errors.Add({ att->name.codeRange,L"Unsupported attribute: \"" + att->name.value + L"\" on message \"" + node->name.value + L"\"." }); + } + } + symbols->messageDecls.Add(node->name.value, node); + } + + void Visit(GuiRpEventDecl* node) override + { + if (symbols->eventDecls.Keys().Contains(node->name.value)) + { + errors.Add({ node->name.codeRange,L"Event \"" + node->name.value + L"\" already exists." }); + return; + } + + if (node->request) + { + node->request->type->Accept(this); + } + + for (auto att : node->attributes) + { + if (att->name.value == L"@DropRepeat") + { + VisitDropAttribute(att, node->name.value, symbols->dropRepeatDeclNames); + } + else if (att->name.value == L"@DropConsecutive") + { + VisitDropAttribute(att, node->name.value, symbols->dropConsecutiveDeclNames); + } + else + { + errors.Add({ att->name.codeRange,L"Unsupported attribute: \"" + att->name.value + L"\" on event \"" + node->name.value + L"\"." }); + } + } + + if (symbols->dropRepeatDeclNames.Contains(node->name.value) && symbols->dropConsecutiveDeclNames.Contains(node->name.value)) + { + errors.Add({ node->name.codeRange,L"@DropRepeat and @DropConsecutive cannot be used together on event \"" + node->name.value + L"\"." }); + } + symbols->eventDecls.Add(node->name.value, node); + } + }; + + Ptr CheckRemoteProtocolSchema(Ptr schema, collections::List& errors) + { + auto symbols = Ptr(new GuiRpSymbols); + GuiRpCheckSchemaVisitor visitor(symbols, errors); + for (auto decl : schema->declarations) + { + decl->Accept(&visitor); + } + return symbols; + } + +/*********************************************************************** +GenerateRemoteProtocolHeaderFile +***********************************************************************/ + + class GuiRpPrintTypeVisitor : public Object, public GuiRpType::IVisitor + { + protected: + Ptr symbols; + GuiRpCppConfig& config; + stream::TextWriter& writer; + + public: + GuiRpPrintTypeVisitor(Ptr _symbols, GuiRpCppConfig& _config, stream::TextWriter& _writer) + : symbols(_symbols) + , config(_config) + , writer(_writer) + { + } + + // GuiRpType::IVisitor + + void Visit(GuiRpPrimitiveType* node) override + { + switch (node->type) + { + case GuiRpPrimitiveTypes::Boolean: + writer.WriteString(L"bool"); + break; + case GuiRpPrimitiveTypes::Integer: + writer.WriteString(L"::vl::vint"); + break; + case GuiRpPrimitiveTypes::Float: + writer.WriteString(L"float"); + break; + case GuiRpPrimitiveTypes::Double: + writer.WriteString(L"double"); + break; + case GuiRpPrimitiveTypes::String: + writer.WriteString(L"::vl::WString"); + break; + case GuiRpPrimitiveTypes::Char: + writer.WriteString(L"wchar_t"); + break; + case GuiRpPrimitiveTypes::Key: + writer.WriteString(L"::vl::presentation::VKEY"); + break; + default: + CHECK_FAIL(L"Unrecognized type"); + } + } + + static WString GetCppType(const WString& type, Ptr symbols, GuiRpCppConfig& config) + { + vint index = symbols->cppMapping.Keys().IndexOf(type); + if (index == -1) + { + return config.cppNamespace + L"::" + type; + } + else + { + return symbols->cppMapping.Values()[index]; + } + } + + void Visit(GuiRpReferenceType* node) override + { + writer.WriteString(GetCppType(node->name.value, symbols, config)); + } + + void Visit(GuiRpArrayType* node) override + { + writer.WriteString(L"::vl::Ptr<::vl::collections::List<"); + node->element->Accept(this); + writer.WriteString(L">>"); + } + }; + + void GenerateSerializerFunctionHeader(const WString& type, bool semicolon, stream::TextWriter& writer) + { + writer.WriteString(L"\ttemplate<> vl::Ptr ConvertCustomTypeToJson<" + type + L">(const " + type + L" & value)"); + writer.WriteLine(semicolon ? L";" : L""); + } + + void GenerateDeserializerFunctionHeader(const WString& type, bool semicolon, stream::TextWriter& writer) + { + writer.WriteString(L"\ttemplate<> void ConvertJsonToCustomType<" + type + L">(vl::Ptr node, " + type + L"& value)"); + writer.WriteLine(semicolon ? L";" : L""); + } + + void GenerateRemoteProtocolHeaderFile(Ptr schema, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) + { + writer.WriteLine(L"/***********************************************************************"); + writer.WriteLine(L"This file is generated by : Vczh GacUI Remote Protocol Generator"); + writer.WriteLine(L"Licensed under https ://github.com/vczh-libraries/License"); + writer.WriteLine(L"***********************************************************************/"); + writer.WriteLine(L""); + writer.WriteLine(L"#ifndef " + config.headerGuard); + writer.WriteLine(L"#define " + config.headerGuard); + writer.WriteLine(L""); + writer.WriteLine(L"#include \"" + config.headerInclude + L"\""); + writer.WriteLine(L""); + writer.WriteLine(L"namespace " + config.cppNamespace); + writer.WriteLine(L"{"); + + GuiRpPrintTypeVisitor printTypeVisitor(symbols, config, writer); + + for (auto enumDecl : From(schema->declarations).FindType()) + { + if (!symbols->cppMapping.Keys().Contains(enumDecl->name.value)) + { + writer.WriteLine(L"\tenum class " + enumDecl->name.value); + writer.WriteLine(L"\t{"); + for (auto member : enumDecl->members) + { + writer.WriteLine(L"\t\t" + member->name.value + L","); + } + writer.WriteLine(L"\t};"); + writer.WriteLine(L""); + } + } + + for (auto structDecl : From(schema->declarations).FindType()) + { + if (!symbols->cppMapping.Keys().Contains(structDecl->name.value)) + { + writer.WriteLine(L"\tstruct " + structDecl->name.value); + writer.WriteLine(L"\t{"); + for (auto member : structDecl->members) + { + writer.WriteString(L"\t\t"); + member->type->Accept(&printTypeVisitor); + writer.WriteLine(L" " + member->name.value + L";"); + } + writer.WriteLine(L"\t};"); + writer.WriteLine(L""); + } + } + + for (auto enumDecl : From(schema->declarations).FindType()) + { + GenerateSerializerFunctionHeader(GuiRpPrintTypeVisitor::GetCppType(enumDecl->name.value, symbols, config), true, writer); + } + for (auto structDecl : From(schema->declarations).FindType()) + { + GenerateSerializerFunctionHeader(GuiRpPrintTypeVisitor::GetCppType(structDecl->name.value, symbols, config), true, writer); + } + writer.WriteLine(L""); + + for (auto enumDecl : From(schema->declarations).FindType()) + { + GenerateDeserializerFunctionHeader(GuiRpPrintTypeVisitor::GetCppType(enumDecl->name.value, symbols, config), true, writer); + } + for (auto structDecl : From(schema->declarations).FindType()) + { + GenerateDeserializerFunctionHeader(GuiRpPrintTypeVisitor::GetCppType(structDecl->name.value, symbols, config), true, writer); + } + writer.WriteLine(L""); + + writer.WriteLine(L"#define " + config.builderMacroPrefix + L"_MESSAGES(HANDLER)\\"); + for (auto messageDecl : From(schema->declarations).FindType()) + { + writer.WriteString(L"\tHANDLER(" + messageDecl->name.value); + + writer.WriteString(L", "); + if (messageDecl->request) + { + messageDecl->request->type->Accept(&printTypeVisitor); + } + else + { + writer.WriteString(L"void"); + } + + writer.WriteString(L", "); + if (messageDecl->response) + { + messageDecl->response->type->Accept(&printTypeVisitor); + } + else + { + writer.WriteString(L"void"); + } + + writer.WriteString(messageDecl->request ? L", REQ" : L", NOREQ"); + writer.WriteString(messageDecl->response ? L", RES" : L", NORES"); + writer.WriteString(symbols->dropRepeatDeclNames.Contains(messageDecl->name.value) ? L", DROPREP" : L", NODROP"); + writer.WriteLine(L")\\"); + } + writer.WriteLine(L""); + + writer.WriteLine(L"#define " + config.builderMacroPrefix + L"_EVENTS(HANDLER)\\"); + for (auto eventDecl : From(schema->declarations).FindType()) + { + writer.WriteString(L"\tHANDLER(" + eventDecl->name.value); + + writer.WriteString(L", "); + if (eventDecl->request) + { + eventDecl->request->type->Accept(&printTypeVisitor); + } + else + { + writer.WriteString(L"void"); + } + + writer.WriteString(eventDecl->request ? L", REQ" : L", NOREQ"); + writer.WriteString( + symbols->dropRepeatDeclNames.Contains(eventDecl->name.value) ? L", DROPREP" : + symbols->dropConsecutiveDeclNames.Contains(eventDecl->name.value) ? L", DROPCON" : + L", NODROP"); + writer.WriteLine(L")\\"); + } + writer.WriteLine(L""); + + writer.WriteLine(L"}"); + writer.WriteLine(L""); + writer.WriteLine(L"#endif"); + } + +/*********************************************************************** +GenerateRemoteProtocolCppFile +***********************************************************************/ + + void GenerateEnumSerializerFunctionImpl(Ptr enumDecl, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) + { + WString cppName = GuiRpPrintTypeVisitor::GetCppType(enumDecl->name.value, symbols, config); + GenerateSerializerFunctionHeader(cppName, false, writer); + writer.WriteLine(L"\t{"); + writer.WriteLine(L"#define ERROR_MESSAGE_PREFIX L\"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<" + cppName + L">(const " + cppName + L"&)#\""); + writer.WriteLine(L"\t\tauto node = Ptr(new glr::json::JsonString);"); + writer.WriteLine(L"\t\tswitch (value)"); + writer.WriteLine(L"\t\t{"); + for (auto member : enumDecl->members) + { + writer.WriteLine(L"\t\tcase " + cppName + L"::" + member->name.value + L": node->content.value = L\"" + member->name.value + L"\"; break;"); + } + writer.WriteLine(L"\t\tdefault: CHECK_FAIL(ERROR_MESSAGE_PREFIX L\"Unsupported enum value.\");"); + writer.WriteLine(L"\t\t}"); + writer.WriteLine(L"\t\treturn node;"); + writer.WriteLine(L"#undef ERROR_MESSAGE_PREFIX"); + writer.WriteLine(L"\t}"); + writer.WriteLine(L""); + } + + void GenerateStructSerializerFunctionImpl(Ptr structDecl, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) + { + WString cppName = GuiRpPrintTypeVisitor::GetCppType(structDecl->name.value, symbols, config); + GenerateSerializerFunctionHeader(cppName, false, writer); + writer.WriteLine(L"\t{"); + writer.WriteLine(L"\t\tauto node = Ptr(new glr::json::JsonObject);"); + for (auto member : structDecl->members) + { + writer.WriteLine(L"\t\tConvertCustomTypeToJsonField(node, L\"" + member->name.value + L"\", value." + member->name.value + L");"); + } + writer.WriteLine(L"\t\treturn node;"); + writer.WriteLine(L"\t}"); + writer.WriteLine(L""); + } + + void GenerateEnumDeserializerFunctionImpl(Ptr enumDecl, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) + { + WString cppName = GuiRpPrintTypeVisitor::GetCppType(enumDecl->name.value, symbols, config); + GenerateDeserializerFunctionHeader(cppName, false, writer); + writer.WriteLine(L"\t{"); + writer.WriteLine(L"#define ERROR_MESSAGE_PREFIX L\"vl::presentation::remoteprotocol::ConvertJsonToCustomType<" + cppName + L">(Ptr, " + cppName + L"&)#\""); + writer.WriteLine(L"\t\tauto jsonNode = node.Cast();"); + writer.WriteLine(L"\t\tCHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L\"Json node does not match the expected type.\");"); + for (auto member : enumDecl->members) + { + writer.WriteLine(L"\t\tif (jsonNode->content.value == L\"" + member->name.value + L"\") value = " + cppName + L"::" + member->name.value + L"; else"); + } + writer.WriteLine(L"\t\tCHECK_FAIL(ERROR_MESSAGE_PREFIX L\"Unsupported enum value.\");"); + writer.WriteLine(L"#undef ERROR_MESSAGE_PREFIX"); + writer.WriteLine(L"\t}"); + writer.WriteLine(L""); + } + + void GenerateStructDeserializerFunctionImpl(Ptr structDecl, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) + { + WString cppName = GuiRpPrintTypeVisitor::GetCppType(structDecl->name.value, symbols, config); + GenerateDeserializerFunctionHeader(cppName, false, writer); + writer.WriteLine(L"\t{"); + writer.WriteLine(L"#define ERROR_MESSAGE_PREFIX L\"vl::presentation::remoteprotocol::ConvertJsonToCustomType<" + cppName + L">(Ptr, " + cppName + L"&)#\""); + writer.WriteLine(L"\t\tauto jsonNode = node.Cast();"); + writer.WriteLine(L"\t\tCHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L\"Json node does not match the expected type.\");"); + writer.WriteLine(L"\t\tfor (auto field : jsonNode->fields)"); + writer.WriteLine(L"\t\t{"); + for (auto member : structDecl->members) + { + writer.WriteLine(L"\t\t\tif (field->name.value == L\"" + member->name.value + L"\") ConvertJsonToCustomType(field->value, value." + member->name.value + L"); else"); + } + writer.WriteLine(L"\t\t\tCHECK_FAIL(ERROR_MESSAGE_PREFIX L\"Unsupported struct member.\");"); + writer.WriteLine(L"\t\t}"); + writer.WriteLine(L"#undef ERROR_MESSAGE_PREFIX"); + writer.WriteLine(L"\t}"); + writer.WriteLine(L""); + } + + void GenerateRemoteProtocolCppFile(Ptr schema, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) + { + writer.WriteLine(L"/***********************************************************************"); + writer.WriteLine(L"This file is generated by : Vczh GacUI Remote Protocol Generator"); + writer.WriteLine(L"Licensed under https ://github.com/vczh-libraries/License"); + writer.WriteLine(L"***********************************************************************/"); + writer.WriteLine(L""); + writer.WriteLine(L"#include \"" + config.headerFileName + L"\""); + writer.WriteLine(L""); + writer.WriteLine(L"namespace " + config.cppNamespace); + writer.WriteLine(L"{"); + + for (auto enumDecl : From(schema->declarations).FindType()) + { + GenerateEnumSerializerFunctionImpl(enumDecl, symbols, config, writer); + } + for (auto structDecl : From(schema->declarations).FindType()) + { + GenerateStructSerializerFunctionImpl(structDecl, symbols, config, writer); + } + + for (auto enumDecl : From(schema->declarations).FindType()) + { + GenerateEnumDeserializerFunctionImpl(enumDecl, symbols, config, writer); + } + for (auto structDecl : From(schema->declarations).FindType()) + { + GenerateStructDeserializerFunctionImpl(structDecl, symbols, config, writer); + } + writer.WriteLine(L"}"); + } +} + + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOLAST.CPP +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:Ast +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + + +namespace vl::presentation::remoteprotocol +{ +/*********************************************************************** +Visitor Pattern Implementation +***********************************************************************/ + + void GuiRpPrimitiveType::Accept(GuiRpType::IVisitor* visitor) + { + visitor->Visit(this); + } + + void GuiRpReferenceType::Accept(GuiRpType::IVisitor* visitor) + { + visitor->Visit(this); + } + + void GuiRpArrayType::Accept(GuiRpType::IVisitor* visitor) + { + visitor->Visit(this); + } + + void GuiRpEnumDecl::Accept(GuiRpDeclaration::IVisitor* visitor) + { + visitor->Visit(this); + } + + void GuiRpStructDecl::Accept(GuiRpDeclaration::IVisitor* visitor) + { + visitor->Visit(this); + } + + void GuiRpMessageDecl::Accept(GuiRpDeclaration::IVisitor* visitor) + { + visitor->Visit(this); + } + + void GuiRpEventDecl::Accept(GuiRpDeclaration::IVisitor* visitor) + { + visitor->Visit(this); + } +} +namespace vl::reflection::description +{ +#ifndef VCZH_DEBUG_NO_REFLECTION + + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpType, presentation::remoteprotocol::GuiRpType) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpType::IVisitor, presentation::remoteprotocol::GuiRpType::IVisitor) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes, presentation::remoteprotocol::GuiRpPrimitiveTypes) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpPrimitiveType, presentation::remoteprotocol::GuiRpPrimitiveType) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpReferenceType, presentation::remoteprotocol::GuiRpReferenceType) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpArrayType, presentation::remoteprotocol::GuiRpArrayType) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpAttribute, presentation::remoteprotocol::GuiRpAttribute) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpDeclaration, presentation::remoteprotocol::GuiRpDeclaration) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor, presentation::remoteprotocol::GuiRpDeclaration::IVisitor) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpEnumMember, presentation::remoteprotocol::GuiRpEnumMember) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpEnumDecl, presentation::remoteprotocol::GuiRpEnumDecl) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpStructMember, presentation::remoteprotocol::GuiRpStructMember) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpStructDecl, presentation::remoteprotocol::GuiRpStructDecl) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpMessageRequest, presentation::remoteprotocol::GuiRpMessageRequest) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpMessageResponse, presentation::remoteprotocol::GuiRpMessageResponse) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpMessageDecl, presentation::remoteprotocol::GuiRpMessageDecl) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpEventRequest, presentation::remoteprotocol::GuiRpEventRequest) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpEventDecl, presentation::remoteprotocol::GuiRpEventDecl) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpSchema, presentation::remoteprotocol::GuiRpSchema) + +#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpType) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpType) + + BEGIN_ENUM_ITEM(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) + ENUM_ITEM_NAMESPACE(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) + ENUM_NAMESPACE_ITEM(Boolean) + ENUM_NAMESPACE_ITEM(Integer) + ENUM_NAMESPACE_ITEM(Float) + ENUM_NAMESPACE_ITEM(Double) + ENUM_NAMESPACE_ITEM(String) + ENUM_NAMESPACE_ITEM(Char) + ENUM_NAMESPACE_ITEM(Key) + END_ENUM_ITEM(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpPrimitiveType) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpType) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(type) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpPrimitiveType) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpReferenceType) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpType) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(name) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpReferenceType) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpArrayType) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpType) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(element) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpArrayType) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpAttribute) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(name) + CLASS_MEMBER_FIELD(cppType) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpAttribute) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpDeclaration) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_FIELD(attributes) + CLASS_MEMBER_FIELD(name) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpDeclaration) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEnumMember) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(name) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEnumMember) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEnumDecl) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpDeclaration) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(members) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEnumDecl) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpStructMember) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(name) + CLASS_MEMBER_FIELD(type) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpStructMember) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpStructDecl) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpDeclaration) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(members) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpStructDecl) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpMessageRequest) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(type) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpMessageRequest) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpMessageResponse) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(type) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpMessageResponse) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpMessageDecl) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpDeclaration) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(request) + CLASS_MEMBER_FIELD(response) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpMessageDecl) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEventRequest) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(type) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEventRequest) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEventDecl) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpDeclaration) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(request) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpEventDecl) + + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpSchema) + CLASS_MEMBER_BASE(vl::glr::ParsingAstBase) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(declarations) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpSchema) + + BEGIN_INTERFACE_MEMBER(vl::presentation::remoteprotocol::GuiRpType::IVisitor) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpPrimitiveType* node)) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpReferenceType* node)) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpArrayType* node)) + END_INTERFACE_MEMBER(vl::presentation::remoteprotocol::GuiRpType) + + BEGIN_INTERFACE_MEMBER(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpEnumDecl* node)) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpStructDecl* node)) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpMessageDecl* node)) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpEventDecl* node)) + END_INTERFACE_MEMBER(vl::presentation::remoteprotocol::GuiRpDeclaration) + +#endif + +#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA + class GuiRemoteProtocolAstTypeLoader : public vl::Object, public ITypeLoader + { + public: + void Load(ITypeManager* manager) + { + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpType) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpType::IVisitor) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveType) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpReferenceType) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpArrayType) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpAttribute) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpDeclaration) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEnumMember) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEnumDecl) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpStructMember) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpStructDecl) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpMessageRequest) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpMessageResponse) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpMessageDecl) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEventRequest) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEventDecl) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpSchema) + } + + void Unload(ITypeManager* manager) + { + } + }; +#endif +#endif + + bool GuiRemoteProtocolAstLoadTypes() + { +#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA + if (auto manager = GetGlobalTypeManager()) + { + auto loader = Ptr(new GuiRemoteProtocolAstTypeLoader); + return manager->AddTypeLoader(loader); + } +#endif + return false; + } +} + + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOLAST_JSON.CPP +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:Ast +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + + +namespace vl::presentation::remoteprotocol::json_visitor +{ + void AstVisitor::PrintFields(GuiRpArrayType* node) + { + BeginField(L"element"); + Print(node->element.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpAttribute* node) + { + BeginField(L"cppType"); + WriteToken(node->cppType); + EndField(); + BeginField(L"name"); + WriteToken(node->name); + EndField(); + } + void AstVisitor::PrintFields(GuiRpDeclaration* node) + { + BeginField(L"attributes"); + BeginArray(); + for (auto&& listItem : node->attributes) + { + BeginArrayItem(); + Print(listItem.Obj()); + EndArrayItem(); + } + EndArray(); + EndField(); + BeginField(L"name"); + WriteToken(node->name); + EndField(); + } + void AstVisitor::PrintFields(GuiRpEnumDecl* node) + { + BeginField(L"members"); + BeginArray(); + for (auto&& listItem : node->members) + { + BeginArrayItem(); + Print(listItem.Obj()); + EndArrayItem(); + } + EndArray(); + EndField(); + } + void AstVisitor::PrintFields(GuiRpEnumMember* node) + { + BeginField(L"name"); + WriteToken(node->name); + EndField(); + } + void AstVisitor::PrintFields(GuiRpEventDecl* node) + { + BeginField(L"request"); + Print(node->request.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpEventRequest* node) + { + BeginField(L"type"); + Print(node->type.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpMessageDecl* node) + { + BeginField(L"request"); + Print(node->request.Obj()); + EndField(); + BeginField(L"response"); + Print(node->response.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpMessageRequest* node) + { + BeginField(L"type"); + Print(node->type.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpMessageResponse* node) + { + BeginField(L"type"); + Print(node->type.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpPrimitiveType* node) + { + BeginField(L"type"); + switch (node->type) + { + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Boolean: + WriteString(L"Boolean"); + break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Char: + WriteString(L"Char"); + break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Double: + WriteString(L"Double"); + break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Float: + WriteString(L"Float"); + break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Integer: + WriteString(L"Integer"); + break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Key: + WriteString(L"Key"); + break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::String: + WriteString(L"String"); + break; + default: + WriteNull(); + } + EndField(); + } + void AstVisitor::PrintFields(GuiRpReferenceType* node) + { + BeginField(L"name"); + WriteToken(node->name); + EndField(); + } + void AstVisitor::PrintFields(GuiRpSchema* node) + { + BeginField(L"declarations"); + BeginArray(); + for (auto&& listItem : node->declarations) + { + BeginArrayItem(); + Print(listItem.Obj()); + EndArrayItem(); + } + EndArray(); + EndField(); + } + void AstVisitor::PrintFields(GuiRpStructDecl* node) + { + BeginField(L"members"); + BeginArray(); + for (auto&& listItem : node->members) + { + BeginArrayItem(); + Print(listItem.Obj()); + EndArrayItem(); + } + EndArray(); + EndField(); + } + void AstVisitor::PrintFields(GuiRpStructMember* node) + { + BeginField(L"name"); + WriteToken(node->name); + EndField(); + BeginField(L"type"); + Print(node->type.Obj()); + EndField(); + } + void AstVisitor::PrintFields(GuiRpType* node) + { + } + + void AstVisitor::Visit(GuiRpPrimitiveType* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"PrimitiveType", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Visit(GuiRpReferenceType* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"ReferenceType", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Visit(GuiRpArrayType* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"ArrayType", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Visit(GuiRpEnumDecl* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"EnumDecl", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Visit(GuiRpStructDecl* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"StructDecl", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Visit(GuiRpMessageDecl* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"MessageDecl", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Visit(GuiRpEventDecl* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"EventDecl", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + + AstVisitor::AstVisitor(vl::stream::StreamWriter& _writer) + : vl::glr::JsonVisitorBase(_writer) + { + } + + void AstVisitor::Print(GuiRpType* node) + { + if (!node) + { + WriteNull(); + return; + } + node->Accept(static_cast(this)); + } + + void AstVisitor::Print(GuiRpDeclaration* node) + { + if (!node) + { + WriteNull(); + return; + } + node->Accept(static_cast(this)); + } + + void AstVisitor::Print(GuiRpAttribute* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"Attribute", node); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Print(GuiRpEnumMember* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"EnumMember", node); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Print(GuiRpStructMember* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"StructMember", node); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Print(GuiRpMessageRequest* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"MessageRequest", node); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Print(GuiRpMessageResponse* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"MessageResponse", node); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Print(GuiRpEventRequest* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"EventRequest", node); + PrintFields(static_cast(node)); + EndObject(); + } + + void AstVisitor::Print(GuiRpSchema* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"Schema", node); + PrintFields(static_cast(node)); + EndObject(); + } + +} + + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOLPARSER.CPP +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:GuiRemoteProtocol +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + + +namespace vl::presentation::remoteprotocol +{ + void GuiRemoteProtocolParserData(vl::stream::IStream& outputStream) + { + static const vl::vint dataLength = 5216; // 69320 bytes before compressing + static const vl::vint dataBlock = 256; + static const vl::vint dataRemain = 96; + static const vl::vint dataSolidRows = 20; + static const vl::vint dataRows = 21; + static const char* compressed[] = { + "\xC8\x0E\x01\x00\x58\x14\x00\x00\x1B\x00\x01\x82\x80\x0F\x03\x82\x81\x82\x06\x89\x82\x8D\x0A\x80\x0A\x84\x0C\x0A\x9C\x0A\x83\x1A\x82\x16\x85\x18\x0A\xB7\x0A\x9D\x1A\x85\x22\x85\x25\x0A\xD2\x0A\x98\x2A\x84\x2E\x84\x70\x0A\x09\xBF\x6B\x9C\x93\x96\x84\x00\x2D\xAD\xAF\x91\x9C\x93\x98\x9B\x7F\x36\xB4\xB9\x91\x9B\x9A\x9A\x85\x9B\x38\xBF\xB7\x8F\x9F\x91\x02\x84\xA3\x09\xC8\x86\x82\x07\xA2\x87\x01\xA6\x09\x84\x10\xA6\x85\x03\xAB\x80\x03\x56\x82\x80\xBD\x95\x9A\x87\x03\xAC\x01\xDB\x82\xBA\x93\xB4\x9D\xB2\x9F\x2A\xC3\xA7\xBD\xA9\xB4\xB1\xB6\xB3\x6F\xE8\x86\x82\xB1\xBC\xB7\xB8\xB5\x75\xAE\xAB\xBA\xB9\xB9\xA1\xBE\xAE\x7C\xF7\xAE\xA2\xC0\xBC\xC2\xB9\x81\x74\x86\xF6\xA8\xC8\xBA\xC5\xC0\xC6\x83\x90\xC5\xD2\xC7\xC2\xAD\xC6\xCA\x8B\x96\xD1\xDA\xC3\xCC\xCD\xCB\xB0\x97\x9E\xD9\xC0\xDB\xCC\xD1\xCE\xD3\x9F\xB0\xA1\xC8\xD3\xD0\x00\x04\xB0\x00\x09\x30\xC9\xC8\xCF\xC6\xD0\xDB\xAC\xB8\xEA\xC5\xDB\xDF\xD1\xDF\xD4\xB4\xB7\xFE\xAE\xC3\xE5\xD9\xE2\xE1\x80\xC7\xF9\xCA\xEF\xDD\xD5\xE1\xE5\xC9\xD1\xFB\xAC\xEF\xE5\xE6\xDD\xEA\xD8\xAB\xD6\xF4", + "\xEA\xE9\x95\xA4\x85\x0B\x33\xDA\xF9\xEC\xDC\xF2\xDE\xF3\xC0\xE3\xEA\xE5\xFB\xF7\xF1\xF7\xF4\xEC\xF1\xEE\xF2\xF0\xFB\xFA\xFB\xFA\xF8\xCE\xEF\xFA\xFC\xDC\x04\xD8\x86\xDF\x7F\x53\x76\x74\x02\x85\x84\x70\x81\x07\x83\x8A\x82\x81\xC6\x48\x8D\x83\x82\x09\x8C\x88\x70\x84\x0F\x92\x80\x74\x85\x13\x96\x8B\x76\x83\x02\x4E\x00\x6C\x42\x06\x4A\x55\x85\x84\x24\xA3\x86\x89\x86\x25\xA8\x87\x8B\x85\x1A\xA8\x7C\x7F\x7D\x2F\xB9\x77\x77\x7E\x33\xB4\x71\x8F\x8D\x35\xB0\x89\x8E\x8C\xCC\x4E\x41\x82\x41\x11\x22\x76\x8F\x8E\x38\x9C\x73\x92\x91\x3A\x88\x9C\x8C\x87\x2C\xA9\x8D\x93\x8A\x1B\x98\x8F\x92\x8A\x54\x93\x96\x95\x94\x2D\xB4\x8A\x91\x6B\x12\x30\x63\x06\x90\x49\x8C\x98\x96\x93\x63\x90\x9E\x88\x91\x68\x9B\x99\x9A\x98\x67\xAA\x9E\x98\x9B\x5A\xB0\x97\x92\x9C\x61\x8A\x44\x04\x6C\x15\x20\x9B\x92\x94\x65\x95\x9D\x9F\x95\x6D\xB4\x9B\x9D\x96\x73\xBC\x91\xA2\xA1\x71\x88\xA5\xA0\xA1\x75\x89\x46\x04\x6C\x17\x3A\x95\x92\xA0\x93\x8A\xAD\xA0\x99\x87\x8C\xA3\xA0\xA6\x89\x9A\xA5\xA6\xA7\x6B\x96\xAB\xA4\x94\x10\x7F\x83\x41\x06\x92\xA1\xA0\xAB\x9B", + "\xA2\x9F\xAC\xA7\xA2\xAF\x97\xA6\x99\xA7\xB1\xA3\xAE\x9D\xA6\xB5\xAE\xA3\xAC\xAC\xBB\xB2\xA7\xAC\xAD\xBD\xB6\xA0\xA0\xB0\xBF\xBC\xA5\xB2\xAF\xC3\xBC\x6A\x05\xAA\xAC\xAB\xA4\xA6\xAA\xB9\x90\xB1\xB2\xAE\xC7\x82\xBF\x9F\xB5\xB8\x93\xB2\xB5\xB5\xD4\x97\x90\x42\xA9\xDC\x9B\xB9\xB0\xB2\xD8\x84\xB3\xBA\xB5\xD9\xA1\xBD\xB1\xB4\xEB\x9A\xBD\xBA\x40\x12\x60\xB7\xB9\xB7\xE5\x86\xB3\xBE\xB8\xF5\xA4\xB9\xBB\xBD\xEF\xBC\xBF\xB1\xBF\xF9\xA8\xB6\xB9\xC0\xF4\xBB\xB4\xC0\xBE\x06\xC9\xC3\xC1\x07\xCC\xBF\xBE\xC1\xAB\x08\xC3\xCA\xC2\xBD\x07\xC0\xC3\xC6\xBE\x12\xD9\xC4\xC7\xC5\x02\xDB\xCA\xC4\xC6\x1E\xE1\xC0\xCB\xC8\x1D\xE4\xBE\x05\xC3\x10\xD6\xCF\xC5\xC9\x2C\xC5\xCB\xCA\xCB\x22\xED\xC1\xC5\xCC\x30\xE4\xC5\xCE\xCC\x2A\xF4\xC3\xCE\xCD\x3B\xF8\xCF\xC2\xB3\x29\xFF\xC6\x43\x07\x28\xC0\xD6\xD0\xBB\x42\xEE\xB9\xD2\xBA\x4B\xFE\xB1\xD3\xD3\x47\xCA\xD0\xD4\xD2\x53\xC3\x40\x08\x6C\x21\x05\xD4\xD5\xD4\x4C\xD5\xDD\xD4\xD7\x4E\xE0\xD5\xC5\xD3\x00\x22\x0A\xD6\xD4\x62\xDC\xC7\xCF\xDA\x3D\xEC\xD9\xCC\xCF\x6F\xFE\xCE\xD5\xD8\x5B\xF5\xD8\xDA\x41\x14", + "\x72\xB3\xDB\xDC\x7B\xC9\x44\x0B\xD9\x5F\xF6\xD1\xE3\xDD\x84\xC3\xE6\xE0\xDD\x85\xC8\xE7\xE1\xDF\x82\xCA\xEE\xE0\xE3\x89\xD0\xEB\xE2\xDA\x6D\xD5\xE1\xDE\xDB\x64\xE5\x00\xE3\xE3\x94\xD7\xE6\xE4\xD9\x9D\xE0\xEF\xCB\xE7\x0A\x66\x0B\xE6\xE4\x9C\xE3\xEE\xE7\xEA\xA2\xFA\xCC\xE8\xDF\xA1\xF0\xEA\xE9\xEB\x70\xF4\xE2\xDD\x42\x27\x27\xE1\xED\xDA\xB3\xF2\xEE\xEA\xED\x98\xFE\xE5\xEE\xF0\xB7\xCD\xE8\xEB\xF1\xBB\xC6\xF9\xF1\xE4\xCB\xD3\xED\xEE\xD8\x28\x3A\xEF\xF2\x41\x29\x12\xFF\xEC\xF1\xC1\xFC\xE7\xF6\xF6\xC3\xDC\xF5\xF0\xF3\xD3\xE0\xFB\xF6\xF2\xE1\xCE\xF3\xFA\xF8\xDD\xE4\xF7\xFA\xF9\xE9\xE8\xFF\xF4\xFB\xEF\xE9\xEC\x6E\x45\x7A\xCD\xF2\xFD\xFB\xF0\xD9\xFA\xF8\xFE\xF7\xF1\xF8\xF1\xF9\x01\x2B\x07\xE9\x2C\x06\x7A\xFE\x7F\x7B\x7D\xFD\x7A\x7E\xFB\x0A\x89\x7E\xD2\x62\x6D\x05\xA7\x6E\x05\x01\xFE\x76\x7F\x6B\x6F\x03\x82\x0C\x89\x82\x03\xFB\x74\x82\x00\x87\x86\x80\x15\x81\x86\x07\xA2\x88\x81\x0F\x9D\x85\x84\x06\x70\x04\x06\x9B\x8B\x80\x16\x8B\x70\x23\xF5\x63\x86\x0C\xA8\x83\x86\x10\xB5\x87\x84\x36\x94\x86\x0E\xB9\x8C\x86\x1C\xBE\x81", + "\x83\x26\x80\x88\x09\xBD\x82\x89\x1B\x85\x8B\x87\x3F\x98\x5E\x0C\x2B\x8F\x74\xEF\x47\x8C\x88\x2E\x9A\x80\xC0\x33\x00\x36\x1A\x30\x35\x06\xB0\x36\x04\x6C\x1A\x2A\x6E\x1C\x30\x31\x07\x4C\x8F\x26\x0E\x61\x88\x7B\x28\x81\x8A\x37\x3B\x04\x8E\x13\xE6\x83\x89\x24\x8D\x8C\x83\x4F\x8E\x8C\xF0\x6C\x86\x88\x3A\x88\x89\x8E\x78\x96\x8C\x14\xEF\x83\x20\x1E\x2A\x88\x8E\x7A\x92\x8D\x19\xFC\x8D\x80\x42\x92\x8B\x8E\xCC\x3C\x21\x0C\xF7\x81\x91\xD6\x3E\x07\x8F\x2D\x86\x93\x19\x92\x9D\x8D\x3C\x94\x95\x8E\x97\x8C\x91\x26\xFB\x88\x91\x4E\x83\x96\x93\x6B\x9B\x92\x20\xA1\x90\x94\x40\xA2\x94\x5E\x3F\x10\x91\x21\xA5\x91\x92\x31\x40\x0A\x95\x87\x9F\x92\x2C\xA4\x93\x96\x83\x01\x08\x96\x93\x8C\x97\xE2\x42\x08\x97\x4A\x8D\x97\x97\xA7\x86\x8F\x10\x3D\x98\x92\xB2\x44\x0C\x98\x9A\x9A\x95\x2C\xB4\x9C\x98\x53\x8A\x99\x97\xB5\x8D\x95\x34\xAB\x93\x9B\x65\x86\x7E\x23\x8B\x9C\x91\x35\xD0\x9D\x99\xC8\x46\x08\x99\xDA\x9D\x98\x35\xE2\x96\x9A\x69\xA4\x9C\x9B\xCE\x9B\x9A\x2F\xC1\x9C\x9D\x67\xAB\x9E\x9D\xC5\x9B\x9B\x11\x30\x38\x08\xD8\x09\x08\x36\x4A\x10", + "\x34\x48\x7A\x6C\x08\xD8\x0D\x08\x97\x4E\x00\x9F\x28\xE9\x9A\x43\x27\x02\xA6\x92\xF0\x89\x9A\x3A\xF1\x97\x9D\x77\x8B\xA2\xA1\x0D\xAC\xA0\x41\x93\xA6\x9C\x8A\xBE\x48\x0A\x07\xA0\x99\x42\xE1\x96\xA3\x72\xA3\x9D\xA3\xC7\x71\x09\x46\xED\x9F\xA0\xDF\x22\x21\x9B\x03\xB5\xA2\x4A\x9F\xAB\xA4\x8F\xAE\xA0\x9D\x2D\xB0\xA4\x4B\xB3\xAF\xA4\x87\x91\xA0\xA2\x20\xB6\xA4\x99\x53\x00\x36\x2A\x30\x35\x0A\xB0\x36\x08\x6C\x57\x00\x36\x92\x3A\x69\x0B\xB8\x9A\x0B\x48\x9B\xA9\xA4\x81\x1B\x0B\xA9\x25\xAD\xA9\x4D\x92\xA1\xA6\x9D\x95\xAC\xAA\x34\xB2\xA7\x54\xB8\xA7\xAA\xAE\x99\xAE\x24\x28\xA8\xA1\x54\xE2\xA7\xA6\x8E\x9D\xAE\xAC\x8B\x7D\x08\x54\xE5\xA6\x5A\x2F\x2B\xA9\xA7\x58\xBB\xA8\x5A\xF2\xA2\xAA\xAD\xB6\xAE\xAA\x59\xB8\xAC\x5D\xE4\xA0\xAE\xAF\xBB\xAA\xA3\x63\xA0\xB2\x86\x5F\x0F\xAD\xB3\xB5\xAA\xAF\xC7\x60\x0C\x6C\x61\x05\xB1\xBC\xB1\xAF\x78\x62\x0D\xB3\x5F\xA4\xAC\xAC\x7A\x63\x0A\xB2\x77\xAF\xB2\xC1\x64\x08\xB2\xC4\x9E\xB2\xB3\xA0\xBE\xAD\x66\x94\x65\x0D\xCE\xA1\xB6\x37\x66\x06\xB6\x68\x9F\xBB\xB5\xD3\x87\xB6\xB5\x7C\xA6\xB1\x6C\x8E", + "\xBD\xB4\x8A\x67\x0A\xB5\x73\xA3\xB5\x6E\xD5\x38\x0C\xDC\xAF\xB5\xB6\xBB\xB0\xB6\x60\xFD\xA1\xB8\xE0\xBF\xB5\xB8\xC8\xA7\xBA\x72\xB3\xBF\x71\x34\x30\x32\x0D\xB0\x2B\x0C\x6C\x6C\x00\x37\x36\x30\x36\x0D\xB0\x2F\x0C\x2E\xF0\x0E\xB6\xE6\xB6\xA9\x0E\xDD\xA3\xBA\x6C\xE2\xB4\xB7\xE4\x9E\xBC\xB5\xE6\xA4\xBF\x64\xCC\xA7\xBC\xE1\x80\x62\x0E\xE1\xB4\xB0\x71\xCB\xBA\xBC\xDD\xB4\xB8\x60\x73\x11\xBC\x7B\xF5\xB4\x0E\xFD\x81\xB2\xBE\xE3\xA0\xC1\x79\xF7\xBB\xBE\x01\xEB\xBF\xBF\x05\xC9\xC0\x82\x8B\xC5\xB3\xFA\x95\x85\x0E\xFE\xAD\xC2\x81\xF6\xB4\x5E\x3B\x11\xC3\xBE\xED\xB4\x63\x1D\x17\xC1\xC0\x05\xD2\xC6\xC3\x18\xCE\xC2\x76\x78\x0C\xC3\x01\xED\x31\x0F\x25\xC7\xC3\x87\x8C\xC1\xC5\x09\xE8\xBC\xC0\x2C\xDD\xC1\x8C\xD9\xAA\x0F\x14\xD4\xC2\xC4\xBC\x3B\x0C\x6C\x7C\x00\x37\x3E\x38\x96\x0F\x36\xCF\xC5\x86\xE9\xBE\xC4\xF7\xA0\xC2\xC6\x2B\xC9\xC9\x8B\xC7\xC2\x21\x3F\x01\xCE\xC8\x33\xCA\xC7\x92\xD1\xC6\xAE\x40\x0F\xCE\xB8\x43\xD0\xC6\x92\xC8\xC0\xA5\x40\x17\xCC\xC8\x4C\xD2\xC8\x97\xE3\xC9\xAA\x41\x1F\xCA\xCB\x53\xDB\xCA\x89\xB8\xC0\xCC\xBE", + "\x43\x10\x36\x84\x10\x35\x21\x38\x96\x11\x33\xD9\xCE\xBB\x87\x16\xCC\x9B\xE8\xC4\xCC\x31\xEB\xCD\xC8\x58\xDB\xCC\x10\x88\x10\x37\x44\x30\x32\x11\xB8\x8B\x12\x9E\x80\xD9\xB6\x46\x0B\xD4\x6C\x8D\x0F\xD0\x95\xC2\xC2\xD1\x4A\xCC\xD4\xCF\x7E\x4E\x10\x6C\x0F\x10\x36\x48\x38\x91\x12\x92\xCA\xCF\x4B\x92\x11\xD5\x34\xE6\xD5\xCF\x37\xD7\xD3\x9D\x96\xDF\x99\x49\x38\x94\x12\xB0\x35\x10\x6C\x16\x18\x97\x4B\x25\xD0\xD5\x15\x98\x13\xAD\x8B\x79\x12\x5C\x9A\x10\x36\x9B\x10\x34\x27\x38\x9D\x13\x5D\xFE\xCF\xA5\x9E\x06\xDB\xF1\x22\x02\x45\x80\x0C\x29\x21\xDE\x24\x3B\xB3\x86\x21\xDA\xE3\x13\xDB\x20\xD5\xC2\x3B\xB5\x82\x29\xDB\xE5\x1B\xD9\x20\xDD\xDB\x3B\xB7\x80\x01\xDC\xA0\x23\xDD\xDC\x37\x23\xDD\x78\x2B\x50\x28\xD9\x09\x26\x43\x7D\x2D\xD8\x51\x5B\x3E\xDC\x83\x00\x44\x38\x55\x3D\x2C\x50\x72\xD4\x29\x76\xCA\x27\xDE\xC6\x39\xDC\x71\x40\x2F\x2A\x7D\xE9\xDB\xDE\xC4\x2F\x36\xC1\xB4\x25\xDE\x84\xDB\x3C\xDF\x02\xE6\x39\xC3\x8B\x23\x3B\x88\xC2\x3B\xDF\x0A\x36\xE3\x72\x13\xE1\x20\x80\xC2\x3A\xE3\xDB\x24\xE3\x74\x66\xDE\xE0\xE1\x0A\xE3\xE0", + "\x37\x3C\xE1\xBF\xB7\x2C\xDF\xA7\x3D\x2A\xE5\x1E\xEB\x38\xC8\xC0\x28\xE3\x84\x2E\xE4\x38\x30\xF5\xE3\xC8\xB7\x25\xE0\x94\xF4\x23\xDC\xC9\x27\xE6\x71\x7E\xD5\xE5\x87\xCA\x23\xDC\x44\xF6\xDE\xCE\x8B\xE1\x26\x7E\xC8\xE9\xE5\xFF\xCB\xEA\xCF\xB1\x2D\xE7\xA1\xC7\xE5\xE8\x40\x22\xEB\xC5\xD0\xE8\xEA\x96\xCC\x59\xE7\x7D\x33\xE4\xCD\xB4\x2C\xDE\x7E\xC9\xEB\x20\x31\xFB\x3A\xD8\xE3\xED\x25\xAA\xDB\xEF\xE7\x45\xFB\x3A\xD6\xCB\x37\xEC\x84\xF5\xE6\x20\x58\x2F\xE5\xD4\xE1\xEB\xE6\xB2\xCA\x21\xEF\x38\xFB\xEC\xBE\xFD\xE4\xEA\xC2\xED\x20\xE8\xD3\x33\xED\xC8\xDC\xE5\xE5\xBB\xC3\x22\x2A\x7A\xE9\x21\xDA\xC0\x2B\xEC\xB6\xEB\x24\xDF\x90\xE1\xF2\xE4\xD2\xE6\xEA\x9A\x2E\xEC\xEE\x57\xED\xF3\x4D\x0A\xF6\xF3\x96\x2A\xE1\x39\x95\xF6\xF1\xEA\xEC\xEF\xF3\xC5\xF0\xED\xEB\x34\x24\xF5\xE9\xAB\x27\xF4\xCE\xEF\xE9\x26\xAB\xE3\xED\xEB\xB3\xFB\x24\xC4\xFD\x2A\xF6\xB3\xF5\xF4\xBB\x8C\xF3\x20\xB3\xE1\xF5\xF8\x29\x75\xEE\xB3\xC9\xF4\xF8\x81\x06\xFC\x26\xB9\xF4\xE7\xB8\x99\xFE\x5C\xE5\xC0\x00\xF0\x01\xE6\xF0\x4B\x63\xD7\xE7\xEA\xCD\xF9\x20\xD4\xFA\xDA", + "\x42\x61\xFC\x5E\xEB\xD8\xFA\xFC\x51\x2C\xF8\xC3\xFF\xE6\xF6\xD0\xEF\xF6\x20\xF0\xCC\x5E\xF5\xC1\x4D\x2F\x73\xD3\x3E\xFE\xF5\xEA\x20\xBA\xEF\xF8\xDB\xFB\xFA\xFE\xFF\xD0\x60\x80\xD4\x62\x80\x03\x1B\x6E\xF2\x7F\x7D\x00\x01\x7F\xD9\x7C\x74\x87\x72\x78\xDE\x7B\x7E\xE9\x79\x7F\xEF\x64\x80\x1D\x2D\x7E\xAE\x71\x13\xE3\x60\x7C\x18\x8F\x7F\x12\x83\x80\x1D\x8D\x7F\x1F\x8C\x6D\x14\x80\x6E\x23\x84\x6E\x25\x8B\x7F\x1B\x89\x10\x06\x8F\x80\x31\x1A\x72\x0A\x8F\x71\xDA\x7D\x7B\x0A\x1A\x72\x24\x71\x80\x21\x84\x82\x37\x86\x82\x39\x88\x82\x0D\x86\x83\xD2\x6C\x81\x3F\x8E\x83\xD6\x60\x1E\xEA\x7D\x82\x0A\x1F\x82\x32\x71\x83\xFF\x03\x6E\xBB\x7A\x25\xD6\x74\x7E\xE2\x6A\x10\x1A\x8D\x83\x06\x14\x83\xC7\x72\x10\x56\x80\x7D\x4A\x83\x6E\xE7\x7E\x6D\x40\x83\x84\x42\x88\x7E\x1E\x81\x84\x63\x80\x86\x65\x82\x86\x20\x84\x86\x69\x86\x86\x05\x85\x84\xA6\x77\x84\x16\x8C\x7B\x4B\x89\x71\x6E\x8C\x12\x2A\x70\x85\x35\x88\x77\x71\x8C\x7B\xDD\x77\x7B\x54\x83\x10\x7D\x8B\x1C\x81\x87\x81\x7F\x84\x71\x7D\x13\x88\x72\x8C\x84\xD3\x18\x88\xBC\x73\x6E\xD1\x78", + "\x87\xBC\x71\x7D\x40\x10\x89\xB3\x72\x89\x37\x14\x89\xA5\x76\x89\x34\x18\x89\xAA\x7A\x84\x8C\x83\x7B\x9F\x85\x7A\xDC\x7B\x88\x9E\x8B\x85\x0E\x82\x1C\xA1\x86\x79\xA9\x8C\x76\x8A\x87\x88\xA5\x8C\x80\xDB\x74\x87\xAE\x80\x8B\x32\x81\x56\x2B\x1B\x8A\x63\x73\x8A\xB3\x83\x75\x85\x8D\x71\xA4\x84\x8B\x73\x89\x10\x4D\x84\x13\xB8\x82\x7D\xB2\x8A\x86\xCE\x7B\x87\xB3\x73\x6E\xFE\x1B\x8B\x9D\x71\x13\xC5\x89\x87\x80\x85\x82\xCD\x84\x1C\xD1\x87\x13\xD7\x8C\x7F\x86\x88\x8C\x01\x15\x8D\xC6\x19\x8D\xD0\x86\x8A\xC2\x84\x8D\xBF\x8C\x8B\x2C\x10\x8E\xBD\x80\x00\xD1\x7C\x8C\xE5\x8F\x8C\xE9\x8F\x7C\xB8\x7F\x8A\xE6\x87\x8B\xE2\x86\x10\xC5\x88\x8E\xE7\x85\x8F\x68\x7D\x8E\x7E\x89\x8F\xC0\x8D\x8A\xD6\x82\x8F\xEE\x81\x8B\x09\x11\x7D\xF8\x85\x8B\x21\x2A\x8C\xA5\x77\x90\xFF\x0C\x90\xBA\x81\x90\xC0\x8E\x90\xA7\x82\x88\x02\x9D\x8F\x08\x93\x10\xC3\x81\x8E\x11\x9A\x8F\x02\x16\x90\x1C\x91\x10\xF0\x8F\x86\x05\x93\x1D\x2A\x71\x7D\x2A\x7D\x25\x91\x76\x10\x3E\x2A\x79\x2A\x94\x92\x44\x89\x92\x03\x1E\x8D\xC2\x1A\x72\x59\x86\x84\x61\x8B\x71\x5F\x83\x93", + "\x52\x8E\x92\xE3\x8D\x17\x9C\x8C\x76\x2A\x75\x8C\x3F\x93\x76\x41\x9C\x93\x06\x10\x22\x12\x7A\x10\x48\x9A\x93\x09\x1B\x94\xCB\x1E\x5C\x45\x7E\x74\x4E\x13\x95\x36\x74\x95\xF6\x86\x95\xD3\x85\x95\x11\x84\x15\xEC\x79\x10\x5D\x87\x7D\x5D\x9A\x87\x5E\x91\x96\x57\x1E\x15\x66\x9D\x93\x06\x1D\x7A\x6A\x97\x96\x69\x9B\x93\x09\x1A\x72\xE1\x6B\x82\x02\x12\x97\x01\x14\x97\x00\x06\x97\x78\x9F\x92\x06\x16\x97\x32\x9E\x8B\x13\x8D\x94\x0D\x1A\x10\xF4\x7A\x74\x09\x13\x98\x03\x18\x84\x00\x06\x98\x07\x12\x98\x81\x99\x10\x28\x96\x10\x5F\x2B\x79\x09\x11\x99\xF0\x7A\x10\x94\x93\x10\x4E\x90\x00\x97\x92\x10\x2B\x93\x10\x77\x29\x10\x79\x25\x98\x13\x90\x00\xA1\x90\x24\x70\x80\x9A\x8C\x90\x98\xA8\x92\x9A\x09\x1D\x99\x02\x15\x9A\x03\x1F\x98\x03\x1F\x28\xAC\x94\x98\x06\x14\x9B\xA6\x9F\x97\xB7\x99\x9A\x47\x9A\x10\xB8\x93\x10\x8A\x91\x10\xAE\x91\x10\xBF\x92\x10\xB2\x92\x10\x91\x25\x9B\xFB\x89\x10\xC9\x99\x9B\x95\x9C\x9C\xBC\x98\x99\x0A\x1D\x9C\xC0\x9D\x98\x06\x14\x9D\xC6\x9F\x10\x90\x21\x77\x21\x9D\x1A\x83\x87\x35\x71\x7A\x94\xF2\x6D\x72\x0A", + "\x10\x9E\xE1\x9A\x92\xE3\x91\x77\xD1\x37\x9E\x40\x29\x9E\x23\x99\x10\x12\x4C\x9E\xB1\x9E\x9E\x5C\x90\x9F\xF2\x93\x10\x13\x04\x9F\x0E\x78\x45\xF7\x91\x10\x14\x0A\x9F\x08\x79\x46\xFD\x94\x9A\x00\xA1\x10\xAD\x77\x4B\x03\xA6\x01\x05\xAE\x1A\x0A\x1C\x4B\x03\xA7\x01\x0B\xAA\x78\x0E\xAD\x9F\x18\x0B\xA0\x2F\x17\x4F\x03\xA9\x01\x0B\xA1\x6E\x06\x53\xA0\x1A\x0B\xA0\x50\x8E\x53\x45\x75\x8C\x2F\x1F\x95\x44\x53\xA2\x7C\x2A\x72\x42\x58\xA2\x1A\x26\x97\x40\x5C\xA2\x64\x2D\x97\x00\x0F\x54\x30\xA3\x10\x1B\x0B\xA0\xE3\x6A\x54\x03\xAC\x01\x0B\xA2\xA3\x34\xA5\x72\x83\x8D\x01\x38\xAA\x10\x3A\xAD\x9F\x1E\x0B\xA0\x69\x7E\x56\x03\xAF\x01\x48\xAA\x10\x84\x53\xA0\x20\x0D\xA4\x09\x1F\xA4\xFD\x91\x02\x0B\xAF\x09\x71\x7F\x74\xBC\x11\x9E\xDD\x98\x2F\x25\xAC\x27\x45\x18\x4B\x2F\x11\x7D\xE1\x93\x6E\x5D\xA0\x30\x2F\x13\x94\xCC\x1F\x12\x83\x87\xA6\x62\x2F\x12\x53\x8D\x1A\x69\xA2\xA6\x58\x9E\x27\x63\xA4\xA7\x68\x90\x25\x5F\xA6\x8B\x68\xA3\x83\x60\xAC\x96\xC8\x79\x10\x8A\x7A\xA5\xBE\x16\xA6\x7F\xA7\x93\x00\x04\xA2\x7C\x2C\x8E\x1A\x2F\x12\x69\x7F", + "\x95\x9B\x90\x92\x7C\x2D\xA6\x87\xA6\x10\x9F\x97\x95\x62\x33\x88\x32\xA5\x1D\x2F\x18\x9D\x01\x1F\x95\x0C\x3C\xA7\x73\xA2\xAA\x71\x77\x32\x5A\x96\x3C\x50\x8B\xA9\xDA\x1F\x12\x59\x33\x96\xB8\x37\x3A\x20\x7E\xA6\xEA\x95\xA7\x8F\x30\x72\xAA\xAB\xA5\x0A\x12\x40\xAE\xA6\x10\x30\x49\x90\x1A\x2F\x95\xB2\xA5\x74\x4B\x47\xAA\x91\x3F\x95\xB7\xAE\x1B\x2F\x1C\x9F\x62\x96\x10\x02\xAE\xAB\x64\x2D\x7A\xC1\xA5\x72\x7E\x44\xAC\x8B\x3D\x7A\xC7\xA9\x1A\x2F\x19\x4A\xBB\xA3\x10\xD8\x4E\xAC\x50\x2A\x78\xD1\xAE\x70\xDF\x44\xAD\x8F\x3A\x78\xD7\xA2\xA7\x0A\x18\xA1\xCB\xA3\x10\x1D\xAE\xAD\x7E\x2A\x72\xE1\xA8\x70\x18\x54\xAA\x1A\x2A\x72\xE7\xAA\x1B\x2F\x12\x52\x5B\x93\x10\x2F\xAE\xAE\x57\x21\x6E\xF1\xA3\x6F\x2B\xAE\xAF\xC7\x31\x6E\xF7\xAB\xA6\x0A\x17\xA2\x06\x10\x85\x3F\xA1\xA8\x64\x26\x97\x3C\x88\xAE\xE7\x42\xA3\x76\x9C\xA9\xDB\x49\x76\x99\x96\xB1\x1A\x20\x56\x4B\x1C\x27\x99\x98\x98\x1A\xB0\x52\xC3\x90\x00\xC7\x97\x25\x2F\x1A\xA4\x04\xB6\x30\x25\xBA\x99\x95\xA0\x25\x54\xA3\x10\x84\xA9\x1A\x91\xA0\x00\xC5\x96\xB2\xDB\x43\xB3\x97\xAA\xA7", + "\xDB\x49\xB3\x8B\x9D\xA8\x7C\x2C\x58\x09\x1E\x7B\x04\xB0\x9B\x02\x15\xB3\xD7\x2F\x4C\x46\xB1\x9C\x47\xBA\x10\x97\x54\xAF\x64\x2E\xA9\xA4\x9D\xB2\x59\x55\x2A\x06\x1F\x2D\x64\x2F\x12\x9C\x5A\x37\xA5\x51\xB4\x7C\x2B\x2C\x09\x18\x2A\x3E\xB9\x10\xB7\x5E\xB4\x50\x26\xB5\x03\x1E\xB5\x57\xBB\x4D\xF1\x26\x10\xA6\xA9\xB6\x09\x1D\x5B\x64\xBE\x27\x6D\xB3\x10\x66\x31\xB6\x64\x20\x95\x1D\xBA\x21\x44\x39\x10\x66\xB6\xA7\x0A\x12\x5D\x7A\x34\x5D\x5C\xBA\x37\xFC\x6B\xB7\x06\x1D\xAA\x6E\xB0\x52\xE6\x96\xA3\x52\xB1\x10\xD8\x5A\x37\xDA\x53\xB8\x79\xB4\xB0\x8B\xB2\x10\x88\xBA\xB3\xE7\x47\xB9\x02\x11\xAA\x89\xB3\x10\xE0\x51\xB7\x57\x25\xB7\x43\x3D\xB8\x76\x59\x37\x06\x1A\x39\x76\xB3\x10\xF0\x50\xBA\xD7\x28\xBA\xD4\x34\xBA\xD5\x19\x5F\x92\xB0\x25\xA6\x33\xBB\x7E\xB9\x10\x10\x6C\xBA\x94\xA9\x10\xB5\xBB\xAE\xB7\xB6\x10\x16\x6C\xBA\x50\x8C\x6F\xBD\xB3\x10\x64\xA1\x77\x1B\x6C\xBA\xB1\xA5\x3A\xE3\x74\xBA\x24\x6C\xBA\xC0\xAC\xBC\x82\xA4\xBA\x28\x6C\xBA\xD0\xA2\xBD\x98\xAD\xB9\x02\x15\x63\xAC\xB0\xAE\xD8\xB8\x91\xA4\xBA\x63\xAC\xB0\xAF\xDF", + "\xB8\x85\xA4\xBC\x63\x7A\x3E\x63\xB6\xB8\x83\x04\xB9\x3B\x7E\x34\xBA\x4E\x6C\xBA\xD5\x1B\x9E\x06\x1E\xBE\xDA\xBF\x52\xD5\x3C\xBB\xB0\xBE\x41\xF4\x36\x10\x04\x49\xBA\x02\x16\x65\xF2\xBA\x1D\xFF\xB6\x10\x2A\x40\xC0\x57\x2E\x65\xEB\xB7\x2D\x10\x49\x10\xAE\xB8\xB9\x06\x1F\x66\xAC\xB6\x97\xFC\x6D\xC0\x06\x17\x41\x08\xC6\x57\xF1\x97\xBA\xA4\xB1\x67\xAC\xB2\xA3\xFC\x6B\xC1\x03\x18\xC1\xF7\xB6\x57\x24\xC3\x10\xBA\xA5\xC2\x73\x63\xC0\xBC\x17\xC0\x06\x16\xC1\x10\xC1\x53\xBD\xA3\x10\x5A\x49\xC1\x75\x6C\xC2\xBE\x14\x45\x0B\xC1\xB2\x03\x19\x67\xAC\xB9\x76\xFC\x6A\xC3\xBE\xB6\xB3\x09\x14\x68\xAC\xB8\x98\x41\xC7\x8C\x31\xC2\x10\x86\x6C\xBA\x99\x99\xC4\xFB\xAF\xBB\x03\x18\x68\xAC\xB3\xB2\x50\xC6\x10\x71\xA8\xAF\x0A\x1A\x68\xAC\xBA\xB4\x57\xC9\x95\x25\xCE\x68\xAC\xBB\xB2\x5F\xC2\x10\x19\x98\xAD\x0A\x11\x69\xAC\xB3\xB3\x65\xC1\x10\x35\x98\xC6\x09\x1A\x69\x7A\x3C\x69\x0B\xCC\xB3\x92\xA9\x10\x56\x49\x10\xC3\xA5\xC2\xA0\x68\xC3\xA9\x1A\xAC\x03\x19\xC7\x25\xC5\x41\x35\xC6\x10\x42\xCB\xC4\x2F\x5C\x45\x06\x13\xAD\x25\xC4\x6A\x7E\xCD", + "\x1A\x60\x4B\xC3\xAB\xAA\x10\xAE\x6C\xBA\x44\xB7\xC7\x06\x11\xC9\x43\xCB\xB4\x09\x10\x6B\xAC\xB6\xB4\xFC\x6A\xC9\xC6\xB4\xBA\xB2\x6C\xBA\x50\xB1\xCA\xCD\xB9\xC1\xB4\x6C\xBA\x54\xBE\xB0\x03\x12\xCA\x02\x19\xC5\x08\xB9\x10\xB6\x6C\xBA\x60\xB4\xB0\xB0\xC1\x10\x8A\xA5\x74\xBA\x6C\xBA\x68\xBE\xCA\x02\x19\xCB\x00\x07\xC6\x12\xB6\x10\xBD\x6C\xBA\x7D\xB8\xC9\xAF\xCE\xA7\x19\xCF\x6B\x7A\x31\x6C\x0B\xCB\xB6\xC0\xC1\x10\x63\x49\x10\x5E\x49\xC1\xC5\x6F\xC8\x68\x4A\x10\xD5\xC3\xC8\x1E\x4C\xC8\xCB\xC9\xC1\x15\x4A\x48\x06\x1A\xAD\x25\xC9\x6C\xDA\xCC\x1C\xE6\xC3\x10\xC7\x42\xCE\xDA\x18\xA5\x92\xCC\x1B\xAF\x49\x10\x85\xC8\xC8\x00\x01\x0A\xA7\x3C\xB9\xD3\xC0\x00\xF3\xCB\xC8\xA4\xB2\x0A\xA7\x33\xB7\xC9\x89\x10\xFD\xC3\x10\xC3\x4E\xCE\x25\x48\xA0\xFE\xC9\xC1\xA3\x07\x3A\x86\xBB\xCF\x0A\xD6\xD0\xFB\xB5\x42\x13\xA2\xD1\x08\xD6\x40\x07\xD6\x10\x8F\x49\xC1\xA4\x08\x4B\xED\xC6\x10\x05\xD2\xC5\x59\x5D\xAD\x03\x19\x4F\x19\xC5\x0A\xB8\x43\x4F\xF1\xC8\xAC\x0A\x16\x0A\xA7\x35\xB9\xCA\xC2\x10\x2A\xDB\xC9\x3C\xC2\x10\xA7\x07\x3A\x9A\xB1\xD3", + "\x01\x13\xD3\xA3\xC9\xC1\xA8\x07\x3A\xA2\xBB\xCF\x3C\xD2\x10\x6A\xA1\x9E\xA9\x07\x3A\xA6\xB2\xD4\x6E\x95\xC2\xAA\x07\x3A\x7F\x3A\x37\x43\xDA\xCB\xA4\xBB\x0A\xA7\x3F\xC0\x03\xD6\x10\x51\xD3\xCC\xA4\xBC\x0A\xA7\x35\xBC\x57\xD3\x10\x59\xDF\xC6\xC5\xC3\x10\xAD\x00\x1B\xAE\x07\x74\x0A\x16\xBF\xFB\xC5\x4F\x09\x13\xAE\x25\xC0\x0B\xB8\x4A\xAE\x03\x1C\xD6\xDE\xC5\x42\x26\xD8\xD5\x13\xD6\x40\xFB\x46\x10\xFF\x49\xC1\xB1\x08\x4B\x7D\xD6\x10\xFA\xA5\xD7\xBE\x12\x0B\x68\xDA\x21\x01\x59\x10\x77\xD6\xCF\xB4\x07\x3A\xF4\xBB\xCF\x89\xD6\x10\xF3\xA4\xD8\xFE\x3D\xAE\x03\x13\xD9\xF6\xC5\x41\x98\xD2\x10\xFD\x49\xC1\xB5\x08\x4B\x83\xD3\x10\x91\xD9\xD9\x1E\x47\x52\x6C\xB4\xBA\xB6\x07\xD8\x64\x29\xBF\x04\xB6\xDA\x03\x15\xC0\xF6\xC8\x0B\xAA\xD0\x25\xFD\xBB\xCF\xAE\xD2\x10\xEB\xC2\xD2\x01\x1A\x0B\xB3\xDE\x27\x29\xC6\xDB\x0A\x11\xD8\xF6\xCC\x0B\xBD\xD7\x25\xB0\xDF\xD5\x02\x12\xA2\x06\x1C\x53\x19\xCE\x0B\xC5\xD7\x3C\xFD\xA3\x10\xCC\xD5\xC2\xC0\x0F\xDC\x06\x33\xB0\xD2\xD4\xBA\xC2\x06\xDD\x03\x3A\xB0\xD9\xD9\xC1\xC4\x0C\xDD\x14\x36\x54\xA7", + "\xD9\xC1\xC6\x04\xAB\x0C\xCF\xDC\xE4\xDF\xDA\xA4\xB9\x0C\xE8\xD5\x1D\x27\xC2\x10\xE3\x6B\xDE\xB8\xD4\xBA\xCC\x0F\xDE\xDA\x13\xC3\xF2\xD3\x12\xC1\xD4\xBA\xCF\x08\xDF\xBC\x17\xC8\xFB\xD9\x10\xF4\xD1\x10\x2B\xB5\xD3\x01\x12\x0D\xE2\xDE\x1B\x80\xC8\xDC\x01\x15\xA4\x03\x12\xD0\x44\xC6\x10\xD4\x0B\xE0\xA9\x15\xCF\x03\xE6\x10\x10\xE2\x10\xC7\xD3\xE1\x03\x16\x0D\x16\xED\x1A\xD7\xC3\xB9\x03\x1B\xE1\x01\x19\xDB\x1E\xE2\x10\xD8\x01\xE2\xBA\x1D\xCD\x30\xB4\xA4\xFD\xD9\xC1\xDA\x0C\xE2\xCC\x10\xCE\x19\xE5\xE2\x0A\x17\xE0\x93\xC9\x10\xDC\x07\x3A\x1B\xD4\xB0\x0D\xB2\x10\x48\x59\xC1\xDD\x08\x4B\x1C\xB1\xE1\xA4\xBE\x0D\xA9\xC4\x26\x28\xE9\xA8\x25\x1A\x10\x1D\xEC\xC9\x06\x12\x0E\x4B\xE0\x25\x15\xD2\x10\x83\x87\xE4\xF5\xD9\xC1\xE6\x05\xE5\x7E\x24\xD2\x58\xEF\xE4\x09\x12\xDC\xBA\xD0\x00\xEA\x0E\xE5\x57\x24\xD7\x60\xC3\x10\x5A\xE6\xE0\xA4\xBE\x0E\x00\xEE\x1B\x7B\xDF\xE2\x09\x18\xB2\x03\x1A\x56\x19\xC1\x0F\xB8\x46\xE7\x02\x12\xE1\x52\xE3\x10\xF2\x01\xE7\xA9\x14\xE6\x52\xD5\xE7\x50\xE4\xBA\xF5\x02\xE8\xAD\x1B\xD9\x85\xE6\x10\x7C\xE7", + "\xE2\xA4\xB8\x0F\x8A\xEA\x1B\xD3\xDB\xE6\x02\x1F\xE8\x00\x04\xE8\x7F\xE2\x10\xFB\x03\xE9\xCC\x18\xDD\x61\xE6\xE8\x8E\x94\xBA\xFE\x04\xE3\x2F\x13\xE4\x24\xE2\x10\x2F\xB2\x10\x78\xE5\xC2\x00\x0B\xA0\x06\x3B\xEA\x01\x1E\xE7\x08\xEF\xEA\xF2\x6B\xCB\x06\x11\xE4\x8D\xE3\x10\xB2\xE0\x00\x51\xE5\xEB\x04\x07\xEB\x7C\x28\xE9\x83\x8D\xEB\x4D\xE5\xEB\x07\x02\xEC\x1A\x20\xB4\xD9\xBC\xEB\x31\xE5\xC2\x0A\x0A\xEC\x64\x29\xB5\xCD\xEA\xEA\x39\xE4\xBA\x0D\x02\x6F\x31\xBD\x1A\x63\xB9\xEA\x01\x1A\x58\xB0\x78\xAC\x34\x73\xA0\x1D\x91\x9E\x83\x84\x14\x42\xB4\xB0\x44\x1F\x95\x44\x10\x85\x44\x1D\x7A\x44\x1A\x78\xF1\xE1\x9E\xF2\xEE\xA6\x67\xAF\x0F\xFC\x68\xEE\x03\x2B\xED\x04\x95\x74\xE9\xE4\xE7\xFE\xE5\xA6\x02\xF1\x77\x24\xA1\x8D\xE7\xEC\xA6\xE1\x95\xD4\x6A\xAF\x0F\xEE\xE3\xAA\x45\x7D\xF0\x68\xE3\x6F\x10\xFF\x9E\x07\x22\x89\x20\x74\x14\x17\xF7\xA7\x71\x79\xF1\x4A\xCE\x70\x5F\x9B\x15\x1F\xF0\x14\xEC\xEB\xA7\x45\x73\xF2\x64\x9E\xF1\xE1\x94\xCC\x2E\x1A\xF2\x2B\x10\xEF\x2F\x1E\xF2\x80\xAE\x70\x30\xF3\xBD\x7F\x12\xCB\xFF\x02\xEF\x70\xA4\xEF", + "\x3A\xF1\x77\x62\xDE\x12\x3D\xF4\x7B\xE1\x92\x7C\x6F\x91\xF4\x44\xFC\xF3\xE1\x91\xB1\x2E\x18\xF4\x2B\x11\x6E\x44\x1C\xF4\x2F\x1E\xF4\x39\x98\x70\x15\xB3\x14\x53\xF7\x13\x76\x94\x14\x57\xFF\x12\x59\xFA\x97\x25\x7B\xF5\x09\x17\xB0\x00\x07\xB0\xFF\x02\xA3\x44\x12\xA3\xE7\xE2\xA3\x40\x70\xC2\x8E\xA3\x20\x93\x70\x14\x69\x74\x14\x6F\xFF\x12\x20\xB3\x14\x73\xF7\x13\x88\x94\x14\x77\xF1\x9E", + }; + vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream); + } + + const wchar_t* ParserRuleName(vl::vint index) + { + static const wchar_t* results[] = { + L"RType", + L"RAttributeParameter", + L"RAttribute", + L"REnumMember", + L"REnum", + L"RStructMember", + L"RStruct", + L"RMessageRequest", + L"RMessageResponse", + L"RMessage", + L"REventRequest", + L"REvent", + L"RDeclDetail", + L"RDecl", + L"Schema", + }; + return results[index]; + } + + const wchar_t* ParserStateLabel(vl::vint index) + { + static const wchar_t* results[] = { + L"[0][RType] BEGIN ", + L"[1][RType] END [ENDING]", + L"[2][RType]< \"bool\" @ >", + L"[3][RType]< \"char\" @ >", + L"[4][RType]< \"double\" @ >", + L"[5][RType]< \"float\" @ >", + L"[6][RType]< \"int\" @ >", + L"[7][RType]< \"key\" @ >", + L"[8][RType]< \"string\" @ >", + L"[9][RType]< NAME @ >", + L"[10][RType]< RType \"[\" \"]\" @ >", + L"[11][RType]< RType \"[\" @ \"]\" >", + L"[12][RType]< RType @ \"[\" \"]\" >", + L"[13][RAttributeParameter] BEGIN ", + L"[14][RAttributeParameter] END [ENDING]", + L"[15][RAttributeParameter]CPP_NAME @", + L"[16][RAttribute] BEGIN ", + L"[17][RAttribute] END [ENDING]", + L"[18][RAttribute]< \"[\" @ ATT_NAME [ \"(\" RAttributeParameter \")\" ] \"]\" >", + L"[19][RAttribute]< \"[\" ATT_NAME @ [ \"(\" RAttributeParameter \")\" ] \"]\" >", + L"[20][RAttribute]< \"[\" ATT_NAME [ \"(\" @ RAttributeParameter \")\" ] \"]\" >", + L"[21][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter \")\" @ ] \"]\" >", + L"[22][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter \")\" ] \"]\" @ >", + L"[23][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter @ \")\" ] \"]\" >", + L"[24][REnumMember] BEGIN ", + L"[25][REnumMember] END [ENDING]", + L"[26][REnumMember]< NAME \",\" @ >", + L"[27][REnumMember]< NAME @ \",\" >", + L"[28][REnum] BEGIN ", + L"[29][REnum] END [ENDING]", + L"[30][REnum]< \"enum\" @ NAME \"{\" { REnumMember } \"}\" >", + L"[31][REnum]< \"enum\" NAME \"{\" @ { REnumMember } \"}\" >", + L"[32][REnum]< \"enum\" NAME \"{\" { REnumMember @ } \"}\" >", + L"[33][REnum]< \"enum\" NAME \"{\" { REnumMember } \"}\" @ >", + L"[34][REnum]< \"enum\" NAME @ \"{\" { REnumMember } \"}\" >", + L"[35][RStructMember] BEGIN ", + L"[36][RStructMember] END [ENDING]", + L"[37][RStructMember]< \"var\" @ NAME \":\" RType \";\" >", + L"[38][RStructMember]< \"var\" NAME \":\" @ RType \";\" >", + L"[39][RStructMember]< \"var\" NAME \":\" RType \";\" @ >", + L"[40][RStructMember]< \"var\" NAME \":\" RType @ \";\" >", + L"[41][RStructMember]< \"var\" NAME @ \":\" RType \";\" >", + L"[42][RStruct] BEGIN ", + L"[43][RStruct] END [ENDING]", + L"[44][RStruct]< \"struct\" @ NAME \"{\" { RStructMember } \"}\" >", + L"[45][RStruct]< \"struct\" NAME \"{\" @ { RStructMember } \"}\" >", + L"[46][RStruct]< \"struct\" NAME \"{\" { RStructMember @ } \"}\" >", + L"[47][RStruct]< \"struct\" NAME \"{\" { RStructMember } \"}\" @ >", + L"[48][RStruct]< \"struct\" NAME @ \"{\" { RStructMember } \"}\" >", + L"[49][RMessageRequest] BEGIN ", + L"[50][RMessageRequest] END [ENDING]", + L"[51][RMessageRequest]< \"request\" \":\" @ RType \";\" >", + L"[52][RMessageRequest]< \"request\" \":\" RType \";\" @ >", + L"[53][RMessageRequest]< \"request\" \":\" RType @ \";\" >", + L"[54][RMessageRequest]< \"request\" @ \":\" RType \";\" >", + L"[55][RMessageResponse] BEGIN ", + L"[56][RMessageResponse] END [ENDING]", + L"[57][RMessageResponse]< \"response\" \":\" @ RType \";\" >", + L"[58][RMessageResponse]< \"response\" \":\" RType \";\" @ >", + L"[59][RMessageResponse]< \"response\" \":\" RType @ \";\" >", + L"[60][RMessageResponse]< \"response\" @ \":\" RType \";\" >", + L"[61][RMessage] BEGIN ", + L"[62][RMessage] END [ENDING]", + L"[63][RMessage]< \"message\" @ NAME \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" >", + L"[64][RMessage]< \"message\" NAME \"{\" @ [ RMessageRequest ] [ RMessageResponse ] \"}\" >", + L"[65][RMessage]< \"message\" NAME \"{\" [ RMessageRequest @ ] [ RMessageResponse ] \"}\" >", + L"[66][RMessage]< \"message\" NAME \"{\" [ RMessageRequest ] [ RMessageResponse @ ] \"}\" >", + L"[67][RMessage]< \"message\" NAME \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" @ >", + L"[68][RMessage]< \"message\" NAME @ \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" >", + L"[69][REventRequest] BEGIN ", + L"[70][REventRequest] END [ENDING]", + L"[71][REventRequest]< \"request\" \":\" @ RType \";\" >", + L"[72][REventRequest]< \"request\" \":\" RType \";\" @ >", + L"[73][REventRequest]< \"request\" \":\" RType @ \";\" >", + L"[74][REventRequest]< \"request\" @ \":\" RType \";\" >", + L"[75][REvent] BEGIN ", + L"[76][REvent] END [ENDING]", + L"[77][REvent]< \"event\" @ NAME \"{\" [ REventRequest ] \"}\" >", + L"[78][REvent]< \"event\" NAME \"{\" @ [ REventRequest ] \"}\" >", + L"[79][REvent]< \"event\" NAME \"{\" [ REventRequest @ ] \"}\" >", + L"[80][REvent]< \"event\" NAME \"{\" [ REventRequest ] \"}\" @ >", + L"[81][REvent]< \"event\" NAME @ \"{\" [ REventRequest ] \"}\" >", + L"[82][RDeclDetail] BEGIN ", + L"[83][RDeclDetail] END [ENDING]", + L"[84][RDeclDetail]<< !REnum @ >>", + L"[85][RDeclDetail]<< !REvent @ >>", + L"[86][RDeclDetail]<< !RMessage @ >>", + L"[87][RDeclDetail]<< !RStruct @ >>", + L"[88][RDecl] BEGIN ", + L"[89][RDecl] END [ENDING]", + L"[90][RDecl]<< { RAttribute @ } !RDeclDetail >>", + L"[91][RDecl]<< { RAttribute } !RDeclDetail @ >>", + L"[92][Schema] BEGIN ", + L"[93][Schema] END [ENDING]", + L"[94][Schema]< RDecl @ { RDecl } >", + L"[95][Schema]< RDecl { RDecl @ } >", + }; + return results[index]; + } + + Parser::Parser() + : vl::glr::ParserBase(&GuiRemoteProtocolTokenDeleter, &GuiRemoteProtocolLexerData, &GuiRemoteProtocolParserData) + { + } + + vl::WString Parser::GetClassName(vl::vint32_t classIndex) const + { + return vl::WString::Unmanaged(GuiRemoteProtocolTypeName((GuiRemoteProtocolClasses)classIndex)); + } + + vl::vint32_t Parser::FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const + { + return -1; + } + + vl::Ptr Parser::ParseSchema(const vl::WString& input, vl::vint codeIndex) const + { + return ParseWithString(input, this, codeIndex); + } + + vl::Ptr Parser::ParseSchema(vl::collections::List& tokens, vl::vint codeIndex) const + { + return ParseWithTokens(tokens, this, codeIndex); + } +} + + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOL_ASSEMBLER.CPP +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:GuiRemoteProtocol +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + + +namespace vl::presentation::remoteprotocol +{ + +/*********************************************************************** +GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase +***********************************************************************/ + + vl::Ptr GuiRemoteProtocolAstInsReceiver::CreateAstNode(vl::vint32_t type) + { + auto cppTypeName = GuiRemoteProtocolCppTypeName((GuiRemoteProtocolClasses)type); + switch((GuiRemoteProtocolClasses)type) + { + case GuiRemoteProtocolClasses::ArrayType: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpArrayType); + case GuiRemoteProtocolClasses::Attribute: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpAttribute); + case GuiRemoteProtocolClasses::EnumDecl: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpEnumDecl); + case GuiRemoteProtocolClasses::EnumMember: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpEnumMember); + case GuiRemoteProtocolClasses::EventDecl: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpEventDecl); + case GuiRemoteProtocolClasses::EventRequest: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpEventRequest); + case GuiRemoteProtocolClasses::MessageDecl: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpMessageDecl); + case GuiRemoteProtocolClasses::MessageRequest: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpMessageRequest); + case GuiRemoteProtocolClasses::MessageResponse: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpMessageResponse); + case GuiRemoteProtocolClasses::PrimitiveType: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpPrimitiveType); + case GuiRemoteProtocolClasses::ReferenceType: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpReferenceType); + case GuiRemoteProtocolClasses::Schema: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpSchema); + case GuiRemoteProtocolClasses::StructDecl: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpStructDecl); + case GuiRemoteProtocolClasses::StructMember: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpStructMember); + default: + return vl::glr::AssemblyThrowCannotCreateAbstractType(type, cppTypeName); + } + } + + void GuiRemoteProtocolAstInsReceiver::SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::Ptr value) + { + auto cppFieldName = GuiRemoteProtocolCppFieldName((GuiRemoteProtocolFields)field); + switch((GuiRemoteProtocolFields)field) + { + case GuiRemoteProtocolFields::ArrayType_element: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpArrayType::element, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::Declaration_attributes: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpDeclaration::attributes, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::EnumDecl_members: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpEnumDecl::members, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::EventDecl_request: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpEventDecl::request, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::EventRequest_type: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpEventRequest::type, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::MessageDecl_request: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpMessageDecl::request, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::MessageDecl_response: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpMessageDecl::response, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::MessageRequest_type: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpMessageRequest::type, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::MessageResponse_type: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpMessageResponse::type, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::Schema_declarations: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpSchema::declarations, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::StructDecl_members: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpStructDecl::members, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::StructMember_type: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpStructMember::type, object, field, value, cppFieldName); + default: + return vl::glr::AssemblyThrowFieldNotObject(field, cppFieldName); + } + } + + void GuiRemoteProtocolAstInsReceiver::SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, const vl::regex::RegexToken& token, vl::vint32_t tokenIndex) + { + auto cppFieldName = GuiRemoteProtocolCppFieldName((GuiRemoteProtocolFields)field); + switch((GuiRemoteProtocolFields)field) + { + case GuiRemoteProtocolFields::Attribute_cppType: + return vl::glr::AssemblerSetTokenField(&vl::presentation::remoteprotocol::GuiRpAttribute::cppType, object, field, token, tokenIndex, cppFieldName); + case GuiRemoteProtocolFields::Attribute_name: + return vl::glr::AssemblerSetTokenField(&vl::presentation::remoteprotocol::GuiRpAttribute::name, object, field, token, tokenIndex, cppFieldName); + case GuiRemoteProtocolFields::Declaration_name: + return vl::glr::AssemblerSetTokenField(&vl::presentation::remoteprotocol::GuiRpDeclaration::name, object, field, token, tokenIndex, cppFieldName); + case GuiRemoteProtocolFields::EnumMember_name: + return vl::glr::AssemblerSetTokenField(&vl::presentation::remoteprotocol::GuiRpEnumMember::name, object, field, token, tokenIndex, cppFieldName); + case GuiRemoteProtocolFields::ReferenceType_name: + return vl::glr::AssemblerSetTokenField(&vl::presentation::remoteprotocol::GuiRpReferenceType::name, object, field, token, tokenIndex, cppFieldName); + case GuiRemoteProtocolFields::StructMember_name: + return vl::glr::AssemblerSetTokenField(&vl::presentation::remoteprotocol::GuiRpStructMember::name, object, field, token, tokenIndex, cppFieldName); + default: + return vl::glr::AssemblyThrowFieldNotToken(field, cppFieldName); + } + } + + void GuiRemoteProtocolAstInsReceiver::SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::vint32_t enumItem, bool weakAssignment) + { + auto cppFieldName = GuiRemoteProtocolCppFieldName((GuiRemoteProtocolFields)field); + switch((GuiRemoteProtocolFields)field) + { + case GuiRemoteProtocolFields::PrimitiveType_type: + return vl::glr::AssemblerSetEnumField(&vl::presentation::remoteprotocol::GuiRpPrimitiveType::type, object, field, enumItem, weakAssignment, cppFieldName); + default: + return vl::glr::AssemblyThrowFieldNotEnum(field, cppFieldName); + } + } + + const wchar_t* GuiRemoteProtocolTypeName(GuiRemoteProtocolClasses type) + { + const wchar_t* results[] = { + L"ArrayType", + L"Attribute", + L"Declaration", + L"EnumDecl", + L"EnumMember", + L"EventDecl", + L"EventRequest", + L"MessageDecl", + L"MessageRequest", + L"MessageResponse", + L"PrimitiveType", + L"ReferenceType", + L"Schema", + L"StructDecl", + L"StructMember", + L"Type", + }; + vl::vint index = (vl::vint)type; + return 0 <= index && index < 16 ? results[index] : nullptr; + } + + const wchar_t* GuiRemoteProtocolCppTypeName(GuiRemoteProtocolClasses type) + { + const wchar_t* results[] = { + L"vl::presentation::remoteprotocol::GuiRpArrayType", + L"vl::presentation::remoteprotocol::GuiRpAttribute", + L"vl::presentation::remoteprotocol::GuiRpDeclaration", + L"vl::presentation::remoteprotocol::GuiRpEnumDecl", + L"vl::presentation::remoteprotocol::GuiRpEnumMember", + L"vl::presentation::remoteprotocol::GuiRpEventDecl", + L"vl::presentation::remoteprotocol::GuiRpEventRequest", + L"vl::presentation::remoteprotocol::GuiRpMessageDecl", + L"vl::presentation::remoteprotocol::GuiRpMessageRequest", + L"vl::presentation::remoteprotocol::GuiRpMessageResponse", + L"vl::presentation::remoteprotocol::GuiRpPrimitiveType", + L"vl::presentation::remoteprotocol::GuiRpReferenceType", + L"vl::presentation::remoteprotocol::GuiRpSchema", + L"vl::presentation::remoteprotocol::GuiRpStructDecl", + L"vl::presentation::remoteprotocol::GuiRpStructMember", + L"vl::presentation::remoteprotocol::GuiRpType", + }; + vl::vint index = (vl::vint)type; + return 0 <= index && index < 16 ? results[index] : nullptr; + } + + const wchar_t* GuiRemoteProtocolFieldName(GuiRemoteProtocolFields field) + { + const wchar_t* results[] = { + L"ArrayType::element", + L"Attribute::cppType", + L"Attribute::name", + L"Declaration::attributes", + L"Declaration::name", + L"EnumDecl::members", + L"EnumMember::name", + L"EventDecl::request", + L"EventRequest::type", + L"MessageDecl::request", + L"MessageDecl::response", + L"MessageRequest::type", + L"MessageResponse::type", + L"PrimitiveType::type", + L"ReferenceType::name", + L"Schema::declarations", + L"StructDecl::members", + L"StructMember::name", + L"StructMember::type", + }; + vl::vint index = (vl::vint)field; + return 0 <= index && index < 19 ? results[index] : nullptr; + } + + const wchar_t* GuiRemoteProtocolCppFieldName(GuiRemoteProtocolFields field) + { + const wchar_t* results[] = { + L"vl::presentation::remoteprotocol::GuiRpArrayType::element", + L"vl::presentation::remoteprotocol::GuiRpAttribute::cppType", + L"vl::presentation::remoteprotocol::GuiRpAttribute::name", + L"vl::presentation::remoteprotocol::GuiRpDeclaration::attributes", + L"vl::presentation::remoteprotocol::GuiRpDeclaration::name", + L"vl::presentation::remoteprotocol::GuiRpEnumDecl::members", + L"vl::presentation::remoteprotocol::GuiRpEnumMember::name", + L"vl::presentation::remoteprotocol::GuiRpEventDecl::request", + L"vl::presentation::remoteprotocol::GuiRpEventRequest::type", + L"vl::presentation::remoteprotocol::GuiRpMessageDecl::request", + L"vl::presentation::remoteprotocol::GuiRpMessageDecl::response", + L"vl::presentation::remoteprotocol::GuiRpMessageRequest::type", + L"vl::presentation::remoteprotocol::GuiRpMessageResponse::type", + L"vl::presentation::remoteprotocol::GuiRpPrimitiveType::type", + L"vl::presentation::remoteprotocol::GuiRpReferenceType::name", + L"vl::presentation::remoteprotocol::GuiRpSchema::declarations", + L"vl::presentation::remoteprotocol::GuiRpStructDecl::members", + L"vl::presentation::remoteprotocol::GuiRpStructMember::name", + L"vl::presentation::remoteprotocol::GuiRpStructMember::type", + }; + vl::vint index = (vl::vint)field; + return 0 <= index && index < 19 ? results[index] : nullptr; + } + + vl::Ptr GuiRemoteProtocolAstInsReceiver::ResolveAmbiguity(vl::vint32_t type, vl::collections::Array>& candidates) + { + auto cppTypeName = GuiRemoteProtocolCppTypeName((GuiRemoteProtocolClasses)type); + return vl::glr::AssemblyThrowTypeNotAllowAmbiguity(type, cppTypeName); + } +} + + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOL_LEXER.CPP +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:GuiRemoteProtocol +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + + +namespace vl::presentation::remoteprotocol +{ + bool GuiRemoteProtocolTokenDeleter(vl::vint token) + { + switch((GuiRemoteProtocolTokens)token) + { + case GuiRemoteProtocolTokens::SPACE: + return true; + default: + return false; + } + } + + const wchar_t* GuiRemoteProtocolTokenId(GuiRemoteProtocolTokens token) + { + static const wchar_t* results[] = { + L"VAR", + L"ENUM", + L"STRUCT", + L"MESSAGE", + L"REQUEST", + L"RESPONSE", + L"EVENT", + L"BOOLEAN", + L"INTEGER", + L"FLOAT", + L"DOUBLE", + L"STRING", + L"CHAR", + L"KEY", + L"CPP_NAME", + L"ATT_NAME", + L"NAME", + L"OPEN_BRACE", + L"CLOSE_BRACE", + L"OPEN_ARRAY", + L"CLOSE_ARRAY", + L"OPEN", + L"CLOSE", + L"COLON", + L"SEMICOLON", + L"COMMA", + L"SPACE", + }; + vl::vint index = (vl::vint)token; + return 0 <= index && index < GuiRemoteProtocolTokenCount ? results[index] : nullptr; + } + + const wchar_t* GuiRemoteProtocolTokenDisplayText(GuiRemoteProtocolTokens token) + { + static const wchar_t* results[] = { + L"var", + L"enum", + L"struct", + L"message", + L"request", + L"response", + L"event", + L"bool", + L"int", + L"float", + L"double", + L"string", + L"char", + L"key", + nullptr, + nullptr, + nullptr, + L"{", + L"}", + L"[", + L"]", + L"(", + L")", + L":", + L";", + L",", + nullptr, + }; + vl::vint index = (vl::vint)token; + return 0 <= index && index < GuiRemoteProtocolTokenCount ? results[index] : nullptr; + } + + const wchar_t* GuiRemoteProtocolTokenRegex(GuiRemoteProtocolTokens token) + { + static const wchar_t* results[] = { + L"var", + L"enum", + L"struct", + L"message", + L"request", + L"response", + L"event", + L"bool", + L"int", + L"float", + L"double", + L"string", + L"char", + L"key", + L"(::[a-zA-Z_][a-zA-Z0-9<>]*){1,}", + L"@[a-zA-Z_][a-zA-Z0-9]*", + L"[a-zA-Z_][a-zA-Z0-9]*", + L"/{", + L"/}", + L"/[", + L"/]", + L"/(", + L"/)", + L":", + L";", + L",", + L"/s+", + }; + vl::vint index = (vl::vint)token; + return 0 <= index && index < GuiRemoteProtocolTokenCount ? results[index] : nullptr; + } + + void GuiRemoteProtocolLexerData(vl::stream::IStream& outputStream) + { + static const vl::vint dataLength = 1555; // 16760 bytes before compressing + static const vl::vint dataBlock = 256; + static const vl::vint dataRemain = 19; + static const vl::vint dataSolidRows = 6; + static const vl::vint dataRows = 7; + static const char* compressed[] = { + "\x78\x41\x00\x00\x0B\x06\x00\x00\x59\x00\x01\xAD\x01\x84\x81\x80\x16\x82\x09\x08\x84\x8A\x0B\x84\x81\x06\x87\x04\xA0\x11\x84\x88\x14\x88\x83\x14\x17\x84\x87\x86\x84\x80\x18\x83\x1C\x04\xBA\x21\x84\x8B\x1C\x90\x82\x1E\x27\x84\xBE\x0A\x94\x80\x21\x96\x82\x41\x04\x9A\x24\x8B\x2C\x98\x83\x2E\x37\x84\x9F\x3A\x94\x81\x31\x9E\x82\x62\x40\x84\x83\x33\xA4\x80\x32\xA3\x04\xE5\x09\xA4\x86\x34\xA4\x83\x33\x4F\x84\xA8\x32\xA4\x81\x35\xAA\x82\x6A\x58\x84\x8B\x3B\xAC\x80\x36\xAF\x04\xED\x21\xA4\x8E\x34\xB0\x83\x37\x67\x84\xB0\x2A\xB4\x81\x39\xB6\x82\x72\x70\x84\x93\x33\xBC\x80\x3A\xBB\x04\xF5\x39\xA4\x86\x3C\xBC\x83\x3B\x04\xF8\x04\x99\x33\xC4\x82\x3C\xC3\x04\xFB\x09\xC4\x8D\x3C\xC4\x83\x0B\x8F\x91\xC1\x90\xC1\x83\x08\x82\x0A\x04\x96\x04\x9F\x7C\xCF\x7C\x06\x82\x15\x1B\xDD\xC3\xDF\x81\x82\x06\x82\x11\x04\x92\x04\x87\xD6\xD0\x82\x03\x0D\x81\x89\x81\x82\x04\x80\x04\xD6\xB8\x81\x87\x19\xD0\x03\x04\xDE\x02\xBC\xAD\xC0\x02\xE2\xE5\x00\x83\x01\xC1\x84\x81\x09\xEE\xD1\x83\x06\x82\x10\x22\xE3\xD3\xE4\xED\xEA\xEB\x0C\xD2\xD6\xDA\xF8", + "\xE1\x82\xED\xCE\x0C\x04\xDC\xC0\x02\xF4\xF1\xF2\xF3\x80\xE5\xE8\xE7\xE3\xFB\xF1\xF4\xF6\xF5\xF0\xEF\xF2\xEE\xF4\xF9\xEE\xEF\xFB\xF8\x9D\xE2\xF9\xF5\xEB\xFF\xFB\xFA\xF1\x40\x83\x7D\x7B\x04\x81\x4A\x05\x81\x03\x81\x8B\x7B\x06\x08\xBE\x7C\x7F\x83\xDB\x76\x7F\x82\x83\x11\x8A\x86\x85\x82\x18\x82\x8A\x85\x83\x04\x5C\x0C\x87\x85\x10\xA1\x8D\x7E\x84\xFC\x54\x87\x77\x87\x00\x1D\x08\x8B\x86\x17\xAC\x89\x87\x8A\x24\xA2\x83\x85\x8C\xF8\x66\x83\x89\x8B\x04\x5E\x00\x8C\x8E\x3C\xAF\x8D\x8E\x8B\x32\x81\x9F\x3E\x8D\x25\xB4\x8A\x7F\x8E\x3E\x89\x92\x83\x07\x48\xAE\x8E\x7A\x90\x32\x84\x99\x7E\x94\xA3\x4E\x9D\x90\x8A\x12\x7F\x87\x94\x88\x50\xA1\x84\x97\x7F\x46\x9C\x66\x96\x96\x17\xA1\x0B\x96\x92\x48\x9D\x9E\x95\x98\x15\x80\x05\x8F\x99\x63\x89\x92\x08\x9C\x69\xAA\x93\x8D\x77\x51\xAC\x91\x9E\x7B\x23\x34\x94\x98\x9A\x3D\xB6\x97\x9E\x9B\x79\xB8\x9E\x76\x8B\x24\x3E\x90\xA3\xA2\x7B\xAC\x92\xA0\x75\x25\x0E\xAF\xA3\xA4\x94\x95\xA6\xA7\xA5\xD4\x66\x01\x8E\xA6\x01\x5C\xA0\x02\xA7\xA0\x84\x41\xA9\xA7\xA2\xA5\xA4\xAB\xA9\x9F\xA6\xA9\xA8\xAA", + "\xA3\xAB\xAE\xA9\xAB\xB0\xAA\xA8\xA7\x8D\x84\xA2\x8F\x96\x98\x8A\x8D\xAF\x9E\xAE\x18\xB3\xAE\xAF\xAF\xC0\x81\xB2\xB3\xB0\xC4\x85\xB6\xB3\xB1\xC8\x89\xBA\xB3\xB2\xCC\x8D\xBE\xB3\xB3\xD0\x91\xB2\xB7\xB4\xD4\x95\xB6\xB7\xB5\xD8\x99\xB7\xB7\x09\x04\x5C\xB1\x42\xB7\x00\x20\xBA\xB7\xB8\xE4\xB7\xAD\x9B\x9B\xBB\xB9\xA8\x91\x45\xE9\x9C\x91\xB2\xB9\x27\x86\xAD\x98\xAF\xF4\xAA\xBF\x9F\xB0\xF0\xB4\xA8\xB8\xA3\xF6\xBC\xB7\x84\x46\xF7\x82\xB9\xBC\x75\xE6\xAE\x8A\x09\xBF\xF5\xAD\xB2\x7C\xBE\x92\x84\xCA\x9C\xC2\x10\xC1\x4B\x09\xBF\x0C\xF2\xB0\x85\xC1\x11\xFE\xBB\xA3\x46\x1A\xC3\xC6\x9E\xC7\x55\x8F\xCA\xC1\xC2\x49\x83\x41\x7E\x0B\x8A\x95\xC5\xAF\x9A\x16\xF4\xA4\xC8\xAF\x2F\x19\xCF\x92\xC0\x0D\xD3\x78\xC7\xC8\x32\xE8\x8E\x46\xC2\x2A\xC1\x97\xCD\xC7\xFD\xB1\x09\xCD\x7C\x3D\xC5\xAB\xC9\xBC\x40\xF8\xCA\xD2\x7C\x32\x35\x9F\xB9\xCD\x21\xED\xC4\x77\x0C\x43\xC9\xD6\xD6\x80\x45\xF6\xA2\xCB\xD5\x55\xFC\xA4\x0F\x7A\xE3\xB5\x01\x8E\xD8\x01\x64\xD0\x02\xD9\x68\xC4\x49\xD9\xD9\x6A\xED\xDC\xDB\xDB\x67\xEE\xD1\xDC\xDC\x6B\xF3\xD6\xDD\xDD\x78", + "\xF2\xD3\xB2\x0D\x50\xDD\x6C\xDE\xD4\xD3\x7F\xD0\x02\xE0\x84\xC4\x45\xE1\x40\x87\xC3\xE6\xE3\xE2\x88\xCC\xEA\xE1\xE3\x90\xCF\xE2\xE5\xE2\x94\xCE\xE2\xE0\x7E\xE0\x99\xED\xB5\xDF\xE4\x9D\xE6\xB0\xC8\x47\x80\xE1\xD4\xD7\x4B\xEF\xC8\x89\xD6\x2C\xC7\xDE\xC9\xD7\x04\x77\x0C\xEA\xBB\xC0\xA0\xE8\xAE\xE8\xA1\xE4\xEA\xC4\x0E\xAF\xCB\xC4\xCC\xED\x87\x9B\xD4\xCA\x48\xA5\xC8\x90\x49\xC0\x4F\xFC\xE7\xB8\x98\xC1\xC9\xF9\x91\x49\x4B\xE8\xE7\xC6\xEF\xB9\xE6\xE1\x40\x4A\xC4\xF1\xEC\xE7\x90\xD0\xCA\xFC\xAD\x0F\x55\xCE\xF3\xA3\xBE\xD2\xD8\x8B\x4A\xF6\x67\x9E\xF5\x92\xF1\xE1\xE9\xF9\xC6\xF9\x53\xAC\x9F\x0D\xF4\xF0\xF0\xEF\xAE\xEC\xD8\xE8\xFF\x48\xF9\xF8\xF6\xEC\xFB\xBE\xE0\xF1\xFB\xA1\x4C\xCA\x7B\x7C\xF2\x2A\x7E\x61\xFC\x6A\x79\x80\xC2\x42\x08\x41\x43\x09\x3A\x05\x81\x26\x81\x2B\x70\x80\x7E\x10\x84\x82\x82\x15\x87\x81\x16\x99\x80\x06\x9B\x80\x01\x0B\x9D\x82\x83\x1F\x9C\x82\x07\xA3\x80\x84\x12\x86\x7B\x52\x97\x72\x45\x0A\xDE\x35\x73\xC8\x6D\x83\x72\x96\x71\x86\x0B\xB2\x80\x87\x19\xB6\x85\x86\x04\x98\x50\xFD\x3F\x67\x80\xDB\x61\x7A", + "\x80\xBD\x76\x7E\x01\xD5\x64\x09\xF2\x7B\x71\x87\xFC\x63\x82\x78\x45\x0E\x7F\x1E\xB3\x65\x78\x48\x83\x81\xFF\x43\x87\x42\x23\x3E\x78\x88\xC7\x7E\x3B\x11\x4D\x8C\x8B\x13\x8F\x53\x87\xD9\x78\x40\x12\x5D\x8E\x87\xEB\x7E\x67\x7A\x3C\x84\x8D\x12\x39\x78\x8A\xA4\x53\x8D\x8C\x54\x96\x69\x1B\xFA\x5A\x88\x32\xB1\x4A\x09\x46\x90\x8B\x19\xC2\x80\x8E\x0C\x4B\x0E\x8E\x66\x86\x6B\x1E\xD1\x83\x77\x3E\x8E\x89\x65\x09\x8B\x81\x03\xA0\x83\x34\x09\xB7\x3E\x84\x21\x91\x90\x24\x93\x95\x85\x4A\xA2\x86\x92\x92\x98\x92\x23\xC5\x5C\x09\x40\x9E\x77\x93\xDF\x62\x91\x1D\xF1\x87\x91\xEA\x73\x78\x8D\x61\x85\x96\xED\x4D\x09\x8E\xEB\x5E\x8D\x80\x84\x95\x7E\xC6\x4E\x00\x90\x9E\x47\x8B\x90\x6F\x8E\x47\x13\x35\x9A\x63\x39\xB0\x91\x97\xBC\x8E\x3C\x14\x08\x9A\x8E\x51\x81\x8E\x90\x28\x51\x0B\x15\xB7\x96\x99\x79\x41\x9D\x7B\xCC\x9A\x68\x1F\x82\x42\x0B\x67\x8D\x7A\x5B\x53\x11\x45\x36\x81\x2B\x9A\x00\x1D\x9F\x9B\x04\x20\x9C\x37\xE1\x94\x9D\x71\xA6\x9E\x9B\xE5\x88\x9F\x39\xE2\x9A\x9D\x76\xAC\x9F\x9D\xE9\x9E\x96\xCD\x29\x96\x9B\x3E\xB2\x9B\x74\xC0\x84", + "\x94\x19\xF7\x95\x77\x7C\xB2\x3C\x0A\xF5\x9C\x54\x3F\x85\x9E\x9E\x55\xBC\x55\x0A\xAD\x87\x97\x2B\xF3\x93\x9B\x80\xAB\x3E\x0A\xC4\x8E\x95\x2C\xEE\x83\x94\x64\xBA\x9E\x94\xBE\x57\x0A\x22\xF2\x5A\xA3\x80\x1D\xA3\x65\x1F\xB8\x3F\x47\xA3\xA4\x20\x92\x9E\xA5\xA4\x28\xA7\xA6\x4A\x80\x06\xA4\x96\xA9\xA6\xA5\x2B\xAD\xA6\x4C\xAF\xA3\xA7\x85\xAA\x48\x8C\x0D\xB7\xA2\x45\x8B\x53\xA0\x59\x85\xA6\xA1\xD7\x85\x9A\x34\xB1\x9E\x44\x2C\x00\xAD\x97\xC2\x5F\xA0\x03\x9C\xAF\xA5\xD1\x21\xA7\x3E\x35\xB0\xA6\x54\xD1\xA4\xAA\x9A\x96\xA9\xA6\x57\xB3\xA9\x56\xCF\xA2\xA9\xD4\x7F\xA2\xA7\x06\xAC\x4E\x3F\x5F\x1C\x32\xB2\x9C\x37\x1E\xEF\x1F\x1D\x00\x00\x25\x21\x80\x11\x3E\xAD\xD0\x31\xAC\x5C\xF3\xA0\x01\xB7\xB5\xAA\xAE\x77\xB4\xAC\x65\x00\x0C\x40\xBA\xA9\x31\x20\xAB\x35\x33\x65\x20\x39\x32\x82\x20\x39\x3E\x07\x54\xAE\x5D\x8B\xB8\xAE\xC6\x8A\xB5\xB1\x90\xA1\x21\x5F\x80\x0F\x38\x03\x6D\xAF\xB1\x98\xB9\xAE\x66\xF6\xA7\x37\xCC\xB6\xAD\x34\xC3\x24\x21\x65\x80\x0B\x38\xCF\x91\xB2\xB3\xBB\x39\xB3\x67\x4D\x3C\xAF\xD7\x27\xB6\xB1\x9A\xB3\x36\x66\x93", + "\xB5\x37\x80\x3E\x36\xB4\x01\x2C\x20\x6B\xC8\x31\x20\xE0\x34\xAD\x38\x04\x20", + }; + vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream); + } +} + + /*********************************************************************** .\WORKFLOWCODEGEN\GUIINSTANCELOADER_WORKFLOWCODEGEN.CPP ***********************************************************************/ diff --git a/Import/GacUICompiler.h b/Import/GacUICompiler.h index 513779cb..fd3386e5 100644 --- a/Import/GacUICompiler.h +++ b/Import/GacUICompiler.h @@ -1057,6 +1057,557 @@ namespace vl #endif +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOLAST.H +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:Ast +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_REMOTEPROTOCOL_AST_AST +#define VCZH_PRESENTATION_REMOTEPROTOCOL_AST_AST + + +namespace vl::presentation::remoteprotocol +{ + class GuiRpArrayType; + class GuiRpAttribute; + class GuiRpDeclaration; + class GuiRpEnumDecl; + class GuiRpEnumMember; + class GuiRpEventDecl; + class GuiRpEventRequest; + class GuiRpMessageDecl; + class GuiRpMessageRequest; + class GuiRpMessageResponse; + class GuiRpPrimitiveType; + class GuiRpReferenceType; + class GuiRpSchema; + class GuiRpStructDecl; + class GuiRpStructMember; + class GuiRpType; + + enum class GuiRpPrimitiveTypes + { + UNDEFINED_ENUM_ITEM_VALUE = -1, + Boolean = 0, + Integer = 1, + Float = 2, + Double = 3, + String = 4, + Char = 5, + Key = 6, + }; + + class GuiRpType abstract : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + class IVisitor : public virtual vl::reflection::IDescriptable, vl::reflection::Description + { + public: + virtual void Visit(GuiRpPrimitiveType* node) = 0; + virtual void Visit(GuiRpReferenceType* node) = 0; + virtual void Visit(GuiRpArrayType* node) = 0; + }; + + virtual void Accept(GuiRpType::IVisitor* visitor) = 0; + + }; + + class GuiRpPrimitiveType : public GuiRpType, vl::reflection::Description + { + public: + GuiRpPrimitiveTypes type = GuiRpPrimitiveTypes::UNDEFINED_ENUM_ITEM_VALUE; + + void Accept(GuiRpType::IVisitor* visitor) override; + }; + + class GuiRpReferenceType : public GuiRpType, vl::reflection::Description + { + public: + vl::glr::ParsingToken name; + + void Accept(GuiRpType::IVisitor* visitor) override; + }; + + class GuiRpArrayType : public GuiRpType, vl::reflection::Description + { + public: + vl::Ptr element; + + void Accept(GuiRpType::IVisitor* visitor) override; + }; + + class GuiRpAttribute : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::glr::ParsingToken name; + vl::glr::ParsingToken cppType; + }; + + class GuiRpDeclaration abstract : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + class IVisitor : public virtual vl::reflection::IDescriptable, vl::reflection::Description + { + public: + virtual void Visit(GuiRpEnumDecl* node) = 0; + virtual void Visit(GuiRpStructDecl* node) = 0; + virtual void Visit(GuiRpMessageDecl* node) = 0; + virtual void Visit(GuiRpEventDecl* node) = 0; + }; + + virtual void Accept(GuiRpDeclaration::IVisitor* visitor) = 0; + + vl::collections::List> attributes; + vl::glr::ParsingToken name; + }; + + class GuiRpEnumMember : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::glr::ParsingToken name; + }; + + class GuiRpEnumDecl : public GuiRpDeclaration, vl::reflection::Description + { + public: + vl::collections::List> members; + + void Accept(GuiRpDeclaration::IVisitor* visitor) override; + }; + + class GuiRpStructMember : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::glr::ParsingToken name; + vl::Ptr type; + }; + + class GuiRpStructDecl : public GuiRpDeclaration, vl::reflection::Description + { + public: + vl::collections::List> members; + + void Accept(GuiRpDeclaration::IVisitor* visitor) override; + }; + + class GuiRpMessageRequest : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::Ptr type; + }; + + class GuiRpMessageResponse : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::Ptr type; + }; + + class GuiRpMessageDecl : public GuiRpDeclaration, vl::reflection::Description + { + public: + vl::Ptr request; + vl::Ptr response; + + void Accept(GuiRpDeclaration::IVisitor* visitor) override; + }; + + class GuiRpEventRequest : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::Ptr type; + }; + + class GuiRpEventDecl : public GuiRpDeclaration, vl::reflection::Description + { + public: + vl::Ptr request; + + void Accept(GuiRpDeclaration::IVisitor* visitor) override; + }; + + class GuiRpSchema : public vl::glr::ParsingAstBase, vl::reflection::Description + { + public: + vl::collections::List> declarations; + }; +} +namespace vl::reflection::description +{ +#ifndef VCZH_DEBUG_NO_REFLECTION + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpType) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpType::IVisitor) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveType) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpReferenceType) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpArrayType) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpAttribute) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpDeclaration) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEnumMember) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEnumDecl) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpStructMember) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpStructDecl) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpMessageRequest) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpMessageResponse) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpMessageDecl) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEventRequest) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpEventDecl) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpSchema) + +#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA + + BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(vl::presentation::remoteprotocol::GuiRpType::IVisitor) + void Visit(vl::presentation::remoteprotocol::GuiRpPrimitiveType* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + void Visit(vl::presentation::remoteprotocol::GuiRpReferenceType* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + void Visit(vl::presentation::remoteprotocol::GuiRpArrayType* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + END_INTERFACE_PROXY(vl::presentation::remoteprotocol::GuiRpType::IVisitor) + + BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor) + void Visit(vl::presentation::remoteprotocol::GuiRpEnumDecl* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + void Visit(vl::presentation::remoteprotocol::GuiRpStructDecl* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + void Visit(vl::presentation::remoteprotocol::GuiRpMessageDecl* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + void Visit(vl::presentation::remoteprotocol::GuiRpEventDecl* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + + END_INTERFACE_PROXY(vl::presentation::remoteprotocol::GuiRpDeclaration::IVisitor) + +#endif +#endif + /// Load all reflectable AST types, only available when VCZH_DEBUG_NO_REFLECTION is off. + /// Returns true if this operation succeeded. + extern bool GuiRemoteProtocolAstLoadTypes(); +} +#endif + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOLAST_JSON.H +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:Ast +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_REMOTEPROTOCOL_AST_AST_JSON_VISITOR +#define VCZH_PRESENTATION_REMOTEPROTOCOL_AST_AST_JSON_VISITOR + + +namespace vl::presentation::remoteprotocol::json_visitor +{ + /// A JSON visitor, overriding all abstract methods with AST to JSON serialization code. + class AstVisitor + : public vl::glr::JsonVisitorBase + , protected virtual GuiRpType::IVisitor + , protected virtual GuiRpDeclaration::IVisitor + { + protected: + virtual void PrintFields(GuiRpArrayType* node); + virtual void PrintFields(GuiRpAttribute* node); + virtual void PrintFields(GuiRpDeclaration* node); + virtual void PrintFields(GuiRpEnumDecl* node); + virtual void PrintFields(GuiRpEnumMember* node); + virtual void PrintFields(GuiRpEventDecl* node); + virtual void PrintFields(GuiRpEventRequest* node); + virtual void PrintFields(GuiRpMessageDecl* node); + virtual void PrintFields(GuiRpMessageRequest* node); + virtual void PrintFields(GuiRpMessageResponse* node); + virtual void PrintFields(GuiRpPrimitiveType* node); + virtual void PrintFields(GuiRpReferenceType* node); + virtual void PrintFields(GuiRpSchema* node); + virtual void PrintFields(GuiRpStructDecl* node); + virtual void PrintFields(GuiRpStructMember* node); + virtual void PrintFields(GuiRpType* node); + + protected: + void Visit(GuiRpPrimitiveType* node) override; + void Visit(GuiRpReferenceType* node) override; + void Visit(GuiRpArrayType* node) override; + + void Visit(GuiRpEnumDecl* node) override; + void Visit(GuiRpStructDecl* node) override; + void Visit(GuiRpMessageDecl* node) override; + void Visit(GuiRpEventDecl* node) override; + + public: + AstVisitor(vl::stream::StreamWriter& _writer); + + void Print(GuiRpType* node); + void Print(GuiRpDeclaration* node); + void Print(GuiRpAttribute* node); + void Print(GuiRpEnumMember* node); + void Print(GuiRpStructMember* node); + void Print(GuiRpMessageRequest* node); + void Print(GuiRpMessageResponse* node); + void Print(GuiRpEventRequest* node); + void Print(GuiRpSchema* node); + }; +} +#endif + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOL_ASSEMBLER.H +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:GuiRemoteProtocol +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_REMOTEPROTOCOL_AST_ASSEMBLER +#define VCZH_PRESENTATION_REMOTEPROTOCOL_AST_ASSEMBLER + + +namespace vl::presentation::remoteprotocol +{ + enum class GuiRemoteProtocolClasses : vl::vint32_t + { + ArrayType = 0, + Attribute = 1, + Declaration = 2, + EnumDecl = 3, + EnumMember = 4, + EventDecl = 5, + EventRequest = 6, + MessageDecl = 7, + MessageRequest = 8, + MessageResponse = 9, + PrimitiveType = 10, + ReferenceType = 11, + Schema = 12, + StructDecl = 13, + StructMember = 14, + Type = 15, + }; + + enum class GuiRemoteProtocolFields : vl::vint32_t + { + ArrayType_element = 0, + Attribute_cppType = 1, + Attribute_name = 2, + Declaration_attributes = 3, + Declaration_name = 4, + EnumDecl_members = 5, + EnumMember_name = 6, + EventDecl_request = 7, + EventRequest_type = 8, + MessageDecl_request = 9, + MessageDecl_response = 10, + MessageRequest_type = 11, + MessageResponse_type = 12, + PrimitiveType_type = 13, + ReferenceType_name = 14, + Schema_declarations = 15, + StructDecl_members = 16, + StructMember_name = 17, + StructMember_type = 18, + }; + + extern const wchar_t* GuiRemoteProtocolTypeName(GuiRemoteProtocolClasses type); + extern const wchar_t* GuiRemoteProtocolCppTypeName(GuiRemoteProtocolClasses type); + extern const wchar_t* GuiRemoteProtocolFieldName(GuiRemoteProtocolFields field); + extern const wchar_t* GuiRemoteProtocolCppFieldName(GuiRemoteProtocolFields field); + + class GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase + { + protected: + vl::Ptr CreateAstNode(vl::vint32_t type) override; + void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::Ptr value) override; + void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, const vl::regex::RegexToken& token, vl::vint32_t tokenIndex) override; + void SetField(vl::glr::ParsingAstBase* object, vl::vint32_t field, vl::vint32_t enumItem, bool weakAssignment) override; + vl::Ptr ResolveAmbiguity(vl::vint32_t type, vl::collections::Array>& candidates) override; + }; +} +#endif + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOL_LEXER.H +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:GuiRemoteProtocol +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_REMOTEPROTOCOL_LEXER +#define VCZH_PRESENTATION_REMOTEPROTOCOL_LEXER + + +namespace vl::presentation::remoteprotocol +{ + enum class GuiRemoteProtocolTokens : vl::vint32_t + { + VAR = 0, + ENUM = 1, + STRUCT = 2, + MESSAGE = 3, + REQUEST = 4, + RESPONSE = 5, + EVENT = 6, + BOOLEAN = 7, + INTEGER = 8, + FLOAT = 9, + DOUBLE = 10, + STRING = 11, + CHAR = 12, + KEY = 13, + CPP_NAME = 14, + ATT_NAME = 15, + NAME = 16, + OPEN_BRACE = 17, + CLOSE_BRACE = 18, + OPEN_ARRAY = 19, + CLOSE_ARRAY = 20, + OPEN = 21, + CLOSE = 22, + COLON = 23, + SEMICOLON = 24, + COMMA = 25, + SPACE = 26, + }; + + constexpr vl::vint GuiRemoteProtocolTokenCount = 27; + extern bool GuiRemoteProtocolTokenDeleter(vl::vint token); + extern const wchar_t* GuiRemoteProtocolTokenId(GuiRemoteProtocolTokens token); + extern const wchar_t* GuiRemoteProtocolTokenDisplayText(GuiRemoteProtocolTokens token); + extern const wchar_t* GuiRemoteProtocolTokenRegex(GuiRemoteProtocolTokens token); + extern void GuiRemoteProtocolLexerData(vl::stream::IStream& outputStream); +} +#endif + +/*********************************************************************** +.\REMOTEPROTOCOL\GENERATED\GUIREMOTEPROTOCOLPARSER.H +***********************************************************************/ +/*********************************************************************** +This file is generated by: Vczh Parser Generator +From parser definition:GuiRemoteProtocol +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_REMOTEPROTOCOL_PARSER_SYNTAX +#define VCZH_PRESENTATION_REMOTEPROTOCOL_PARSER_SYNTAX + + +namespace vl::presentation::remoteprotocol +{ + enum class ParserStates + { + RType = 0, + RAttributeParameter = 13, + RAttribute = 16, + REnumMember = 24, + REnum = 28, + RStructMember = 35, + RStruct = 42, + RMessageRequest = 49, + RMessageResponse = 55, + RMessage = 61, + REventRequest = 69, + REvent = 75, + RDeclDetail = 82, + RDecl = 88, + Schema = 92, + }; + + const wchar_t* ParserRuleName(vl::vint index); + const wchar_t* ParserStateLabel(vl::vint index); + extern void GuiRemoteProtocolParserData(vl::stream::IStream& outputStream); + + class Parser + : public vl::glr::ParserBase + , protected vl::glr::automaton::IExecutor::ITypeCallback + { + protected: + vl::WString GetClassName(vl::vint32_t classIndex) const override; + vl::vint32_t FindCommonBaseClass(vl::vint32_t class1, vl::vint32_t class2) const override; + public: + Parser(); + + vl::Ptr ParseSchema(const vl::WString& input, vl::vint codeIndex = -1) const; + vl::Ptr ParseSchema(vl::collections::List& tokens, vl::vint codeIndex = -1) const; + }; +} +#endif + +/*********************************************************************** +.\REMOTEPROTOCOL\GUIREMOTEPROTOCOLCOMPILER.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI Reflection: Remote Protocol + +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_REFLECTION_REMOTEPROTOCOL_GUIREMOTEPROTOCOL +#define VCZH_PRESENTATION_REFLECTION_REMOTEPROTOCOL_GUIREMOTEPROTOCOL + + +namespace vl::presentation +{ + struct GuiRpError + { + glr::ParsingTextRange position; + WString errorMessage; + }; + + struct GuiRpSymbols + { + collections::Dictionary cppMapping; + collections::SortedList dropRepeatDeclNames; + collections::SortedList dropConsecutiveDeclNames; + collections::Dictionary enumDecls; + collections::Dictionary structDecls; + collections::Dictionary messageDecls; + collections::Dictionary eventDecls; + }; + + struct GuiRpCppConfig + { + WString headerFileName; + WString headerGuard; + WString headerInclude; + WString cppNamespace; + WString builderMacroPrefix; + }; + + extern Ptr CheckRemoteProtocolSchema(Ptr schema, collections::List& errors); + extern void GenerateRemoteProtocolHeaderFile(Ptr schema, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer); + extern void GenerateRemoteProtocolCppFile(Ptr schema, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer); +} + +#endif + /*********************************************************************** .\WORKFLOWCODEGEN\GUIINSTANCELOADER_WORKFLOWCODEGEN.H ***********************************************************************/ diff --git a/Import/VlppReflection.cpp b/Import/VlppReflection.cpp index 293ae195..02b0185c 100644 --- a/Import/VlppReflection.cpp +++ b/Import/VlppReflection.cpp @@ -4555,7 +4555,6 @@ Author: Zihan Chen (vczh) Licensed under https://github.com/vczh-libraries/License ***********************************************************************/ -#include namespace vl { diff --git a/Import/VlppReflection.h b/Import/VlppReflection.h index 4589f990..cac87bf0 100644 --- a/Import/VlppReflection.h +++ b/Import/VlppReflection.h @@ -2832,9 +2832,8 @@ Licensed under https://github.com/vczh-libraries/License #ifndef VCZH_REFLECTION_TYPES_TYPEDVALUESERIALIZERPROVIDER #define VCZH_REFLECTION_TYPES_TYPEDVALUESERIALIZERPROVIDER -#ifdef VCZH_GCC +#include #include -#endif namespace vl { diff --git a/Tools/Reflection32.bin b/Tools/Reflection32.bin index 3f650e93..d071f5f8 100644 Binary files a/Tools/Reflection32.bin and b/Tools/Reflection32.bin differ diff --git a/Tools/Reflection64.bin b/Tools/Reflection64.bin index b354b598..cc489c0c 100644 Binary files a/Tools/Reflection64.bin and b/Tools/Reflection64.bin differ diff --git a/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin b/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin index f19022c0..7548d75c 100644 Binary files a/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin and b/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin differ diff --git a/Tutorial/GacUI_Controls/UIRes/DocumentEditor.bin b/Tutorial/GacUI_Controls/UIRes/DocumentEditor.bin index b3973275..9491f31a 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/DocumentEditor.bin and b/Tutorial/GacUI_Controls/UIRes/DocumentEditor.bin differ diff --git a/Tutorial/GacUI_Controls/UIRes/DocumentEditorRibbon.bin b/Tutorial/GacUI_Controls/UIRes/DocumentEditorRibbon.bin index 888a00d1..e22280f7 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/DocumentEditorRibbon.bin and b/Tutorial/GacUI_Controls/UIRes/DocumentEditorRibbon.bin differ diff --git a/Tutorial/GacUI_Controls/UIRes/DocumentEditorToolstrip.bin b/Tutorial/GacUI_Controls/UIRes/DocumentEditorToolstrip.bin index cb82986a..c0054653 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/DocumentEditorToolstrip.bin and b/Tutorial/GacUI_Controls/UIRes/DocumentEditorToolstrip.bin differ diff --git a/Tutorial/GacUI_Controls/UIRes/Win11ToolstripMenu.bin b/Tutorial/GacUI_Controls/UIRes/Win11ToolstripMenu.bin index 6072a5b4..9ffc0fd6 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/Win11ToolstripMenu.bin and b/Tutorial/GacUI_Controls/UIRes/Win11ToolstripMenu.bin differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 index 9a9b30b2..4f22d111 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 index 986367c5..2f2e9353 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 differ