Files
UnrealEngine/Engine/Source/Runtime/JsonUtilities/Private/JsonObjectStructInterface.cpp
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

33 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "JsonObjectStructInterface.h"
#include "Misc/TransactionallySafeCriticalSection.h"
#include "Async/UniqueLock.h"
namespace JsonObjectStructInterface
{
static FTransactionallySafeCriticalSection GStructConvertersMapCriticalSection;
static TMap<const UScriptStruct*, const IJsonObjectStructConverter*> GStructConvertersMap;
}
void FJsonObjectStructInterfaceRegistry::RegisterStructConverter(const UScriptStruct* ScriptStruct, const IJsonObjectStructConverter* ConverterInterface)
{
UE::TUniqueLock Lock(JsonObjectStructInterface::GStructConvertersMapCriticalSection);
JsonObjectStructInterface::GStructConvertersMap.Add(ScriptStruct, ConverterInterface);
}
void FJsonObjectStructInterfaceRegistry::UnregisterStructConverter(const UScriptStruct* ScriptStruct)
{
UE::TUniqueLock Lock(JsonObjectStructInterface::GStructConvertersMapCriticalSection);
JsonObjectStructInterface::GStructConvertersMap.Remove(ScriptStruct);
}
namespace UE::Json::Private
{
const IJsonObjectStructConverter* GetStructConverterInterface(const UScriptStruct* ScriptStruct)
{
UE::TUniqueLock Lock(JsonObjectStructInterface::GStructConvertersMapCriticalSection);
return JsonObjectStructInterface::GStructConvertersMap.FindRef(ScriptStruct);
}
}