// Copyright 2020-2024 CesiumGS, Inc. and Contributors #pragma once #include "CesiumMetadataEnum.h" #include "CesiumMetadataValueType.h" #include "UObject/ObjectMacros.h" #include #include #include #include "CesiumPropertyArray.generated.h" /** * A Blueprint-accessible wrapper for an array property in glTF metadata. */ USTRUCT(BlueprintType) struct CESIUMRUNTIME_API FCesiumPropertyArray { GENERATED_USTRUCT_BODY() private: #pragma region ArrayType template using ArrayView = CesiumGltf::PropertyArrayView; using ArrayType = swl::variant< ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>, ArrayView>>; #pragma endregion public: /** * Constructs an empty array instance with an unknown element type. */ FCesiumPropertyArray(); /** * Constructs an array instance. * @param value The property array view that will be stored in this struct * @param pEnumDefinition The enum definition this property uses, if any. */ template FCesiumPropertyArray( CesiumGltf::PropertyArrayCopy&& value, TSharedPtr pEnumDefinition = nullptr) : _value(), _elementType(TypeToMetadataValueType(pEnumDefinition)), _storage(), _pEnumDefinition(pEnumDefinition) { this->_value = std::move(value).toViewAndExternalBuffer(this->_storage); } template FCesiumPropertyArray( const CesiumGltf::PropertyArrayCopy& value, TSharedPtr pEnumDefinition = nullptr) : FCesiumPropertyArray( CesiumGltf::PropertyArrayCopy(value), pEnumDefinition) {} template FCesiumPropertyArray( const CesiumGltf::PropertyArrayView& value, TSharedPtr pEnumDefinition = nullptr) : _value(value), _elementType(TypeToMetadataValueType(pEnumDefinition)), _pEnumDefinition(pEnumDefinition) {} FCesiumPropertyArray(FCesiumPropertyArray&& rhs); FCesiumPropertyArray& operator=(FCesiumPropertyArray&& rhs); FCesiumPropertyArray(const FCesiumPropertyArray& rhs); FCesiumPropertyArray& operator=(const FCesiumPropertyArray& rhs); private: ArrayType _value; FCesiumMetadataValueType _elementType; std::vector _storage; TSharedPtr _pEnumDefinition; friend class UCesiumPropertyArrayBlueprintLibrary; };