MetaSoul

Loading...
Searching...
No Matches
ESMessageConvert.h
Go to the documentation of this file.
1#pragma once
2
3#include "Dom/JsonValue.h"
4#include "Dom/JsonObject.h"
5#include "EmoShapeSubSystem/EmoShapeIOLib/Public/sio_client.h"
6#include "ESMessageConvert.generated.h"
7
8 DECLARE_LOG_CATEGORY_EXTERN(SocketIO, Log, All);
9
10USTRUCT(BlueprintType)
11struct EMOSHAPESUBSYSTEM_API FEmoShapeConnectParams
12{
13 GENERATED_USTRUCT_BODY();
14
16 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = SocketIOConnectionParams)
17 FString AddressAndPort;
18
20 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = SocketIOConnectionParams)
21 TMap<FString, FString> Query;
22
24 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = SocketIOConnectionParams)
25 TMap<FString, FString> Headers;
26
28 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = SocketIOConnectionParams)
29 FString Path;
30
31 FEmoShapeConnectParams()
32 {
33 AddressAndPort = TEXT("http://localhost:3000");
34 Path = TEXT("socket.io");
35 }
36};
37
38UCLASS()
39class EMOSHAPESUBSYSTEM_API UESMessageConvert : public UObject
40{
41 GENERATED_BODY()
42 public:
43
44 //To from:
45
46 //emoshapeio::message <-> FJsonValue
47 static TSharedPtr<FJsonValue> ToJsonValue(const emoshapeio::message::ptr& Message);
48 static emoshapeio::message::ptr ToSIOMessage(const TSharedPtr<FJsonValue>& JsonValue);
49
50 //std::string <-> FString
51 static std::string StdString(FString UEString);
52 static FString FStringFromStd(std::string StdString);
53
54 static std::map<std::string, std::string> JsonObjectToStdStringMap(TSharedPtr<FJsonObject> InObject);
55 static TMap<FString, FString> JsonObjectToFStringMap(TSharedPtr<FJsonObject> InObject);
56 static std::map<std::string, std::string> FStringMapToStdStringMap(const TMap<FString, FString>& InMap);
57};
DECLARE_LOG_CATEGORY_EXTERN
DECLARE_LOG_CATEGORY_EXTERN(SocketIO, Log, All)
UESMessageConvert
Definition ESMessageConvert.h:40
emoshapeio::message::ptr
std::shared_ptr< message > ptr
Definition sio_message.h:37
sio_client.h
FEmoShapeConnectParams
Definition ESMessageConvert.h:12
FEmoShapeConnectParams::GENERATED_USTRUCT_BODY
GENERATED_USTRUCT_BODY()