Files
UnrealEngineUWP/Engine/Plugins/Runtime/Metasound/Source/MetasoundFrontend/Public/MetasoundDocumentInterface.h
rob gay 20d85c7fd2 Fix for uninitialized builder registry getter causing crash in tests
#rb trivial
#rnx

[CL 27897384 by rob gay in ue5-main branch]
2023-09-14 17:47:02 -04:00

70 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "UObject/Interface.h"
#include "MetasoundFrontendDocument.h"
#include "MetasoundFrontendDocumentModifyDelegates.h"
#include "Templates/Function.h"
#include "MetasoundDocumentInterface.generated.h"
// Forward Declarations
struct FMetaSoundFrontendDocumentBuilder;
// UInterface for all MetaSound UClasses that implement a MetaSound document
// as a means for accessing data via code, scripting, execution, or node
// class generation.
UINTERFACE(BlueprintType, meta = (CannotImplementInterfaceInBlueprint))
class METASOUNDFRONTEND_API UMetaSoundDocumentInterface : public UInterface
{
GENERATED_BODY()
};
class METASOUNDFRONTEND_API IMetaSoundDocumentInterface : public IInterface
{
GENERATED_BODY()
public:
// Returns read-only reference to the the MetaSoundFrontendDocument
// containing all MetaSound runtime & editor data.
virtual const FMetasoundFrontendDocument& GetDocument() const = 0;
// Returns the parent class registered with the MetaSound UObject registry.
virtual const UClass& GetBaseMetaSoundUClass() const = 0;
private:
virtual FMetasoundFrontendDocument& GetDocument() = 0;
friend struct FMetaSoundFrontendDocumentBuilder;
};
namespace Metasound::Frontend
{
class METASOUNDFRONTEND_API IDocumentBuilderRegistry
{
public:
// Invalidates the cache of a given document's builder should one be registered, causing it to be rebuilt. Not recommended
// for general use, and is only available in case the document is modified by a system other than an active, registered builder
// (ex. via the soft deprecated controller/handle API).
virtual void InvalidateDocumentCache(const FMetasoundFrontendClassName& InClassName) const = 0;
static IDocumentBuilderRegistry* Get();
static IDocumentBuilderRegistry& GetChecked();
protected:
static void Set(TUniqueFunction<IDocumentBuilderRegistry&()>&& InGetInstance);
};
class METASOUNDFRONTEND_API IMetaSoundDocumentBuilderRegistry : public IDocumentBuilderRegistry
{
public:
UE_DEPRECATED(5.4, "Public exposition of modify delegates no longer available to discourage unsafe manipulation of builder document cache")
virtual const FDocumentModifyDelegates* FindModifyDelegates(const FMetasoundFrontendClassName& InClassName) const = 0;
UE_DEPRECATED(5.4, "Use 'IDocumentBuilderRegistry' instead")
static IMetaSoundDocumentBuilderRegistry& GetChecked();
};
} // namespace Metasound::Frontend