You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
119 lines
2.8 KiB
C++
119 lines
2.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
#if WITH_CEF3
|
|
|
|
#include "Containers/UnrealString.h"
|
|
#include "WebBrowserSingleton.h"
|
|
#include "UObject/UnrealType.h"
|
|
#include "IStructSerializerBackend.h"
|
|
#include "CEFJSScripting.h"
|
|
|
|
#if PLATFORM_WINDOWS
|
|
#include "Windows/WindowsHWrapper.h"
|
|
#include "Windows/AllowWindowsPlatformTypes.h"
|
|
#endif
|
|
|
|
#pragma push_macro("OVERRIDE")
|
|
#undef OVERRIDE // cef headers provide their own OVERRIDE macro
|
|
THIRD_PARTY_INCLUDES_START
|
|
#if PLATFORM_APPLE
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
|
#endif
|
|
#include "include/cef_values.h"
|
|
#if PLATFORM_APPLE
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
#endif
|
|
THIRD_PARTY_INCLUDES_END
|
|
#pragma pop_macro("OVERRIDE")
|
|
|
|
#if PLATFORM_WINDOWS
|
|
#include "Windows/HideWindowsPlatformTypes.h"
|
|
#endif
|
|
|
|
#endif
|
|
|
|
class FCEFJSScripting;
|
|
class IStructSerializerBackend;
|
|
struct FStructSerializerState;
|
|
class FWebJSScripting;
|
|
class UObject;
|
|
class FProperty;
|
|
class UStruct;
|
|
|
|
#if WITH_CEF3
|
|
|
|
/**
|
|
* Implements a writer for UStruct serialization using CefDictionary.
|
|
*/
|
|
class FCEFJSStructSerializerBackend
|
|
: public IStructSerializerBackend
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Creates and initializes a new instance.
|
|
* */
|
|
FCEFJSStructSerializerBackend(TSharedPtr<FCEFJSScripting> InScripting)
|
|
: Scripting(InScripting), Stack(), Result()
|
|
{ }
|
|
|
|
CefRefPtr<CefDictionaryValue> GetResult()
|
|
{
|
|
return Result;
|
|
}
|
|
|
|
public:
|
|
|
|
// IStructSerializerBackend interface
|
|
|
|
virtual void BeginArray(const FStructSerializerState& State) override;
|
|
virtual void BeginStructure(const FStructSerializerState& State) override;
|
|
virtual void EndArray(const FStructSerializerState& State) override;
|
|
virtual void EndStructure(const FStructSerializerState& State) override;
|
|
virtual void WriteComment(const FString& Comment) override;
|
|
virtual void WriteProperty(const FStructSerializerState& State, int32 ArrayIndex = 0) override;
|
|
|
|
private:
|
|
|
|
struct StackItem
|
|
{
|
|
enum {STYPE_DICTIONARY, STYPE_LIST} Kind;
|
|
FString Name;
|
|
CefRefPtr<CefDictionaryValue> DictionaryValue;
|
|
CefRefPtr<CefListValue> ListValue;
|
|
|
|
StackItem(const FString& InName, CefRefPtr<CefDictionaryValue> InDictionary)
|
|
: Kind(STYPE_DICTIONARY)
|
|
, Name(InName)
|
|
, DictionaryValue(InDictionary)
|
|
, ListValue()
|
|
{}
|
|
|
|
StackItem(const FString& InName, CefRefPtr<CefListValue> InList)
|
|
: Kind(STYPE_LIST)
|
|
, Name(InName)
|
|
, DictionaryValue()
|
|
, ListValue(InList)
|
|
{}
|
|
|
|
};
|
|
|
|
TSharedPtr<FCEFJSScripting> Scripting;
|
|
TArray<StackItem> Stack;
|
|
CefRefPtr<CefDictionaryValue> Result;
|
|
|
|
void AddNull(const FStructSerializerState& State);
|
|
void Add(const FStructSerializerState& State, bool Value);
|
|
void Add(const FStructSerializerState& State, int32 Value);
|
|
void Add(const FStructSerializerState& State, double Value);
|
|
void Add(const FStructSerializerState& State, FString Value);
|
|
void Add(const FStructSerializerState& State, UObject* Value);
|
|
};
|
|
|
|
|
|
#endif
|