From 6ef49c204c0379e81cb677908a422a9d161d5bf1 Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Fri, 16 Dec 2022 14:02:35 +0100 Subject: [PATCH] remove the enum utils class due to ANY_PACKAGE deprecation warnings in unreal engine 5.1 --- .../Private/SGUtils/SGEnumUtils.cpp | 36 ---------- .../Public/SGUtils/SGEnumUtils.h | 68 ------------------- 2 files changed, 104 deletions(-) delete mode 100644 Source/SenseGloveUtils/Private/SGUtils/SGEnumUtils.cpp delete mode 100644 Source/SenseGloveUtils/Public/SGUtils/SGEnumUtils.h diff --git a/Source/SenseGloveUtils/Private/SGUtils/SGEnumUtils.cpp b/Source/SenseGloveUtils/Private/SGUtils/SGEnumUtils.cpp deleted file mode 100644 index 009422c2..00000000 --- a/Source/SenseGloveUtils/Private/SGUtils/SGEnumUtils.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file - * - * @author Mamadou Babaei - * - * @section LICENSE - * - * (The MIT License) - * - * Copyright (c) 2020 - 2022 SenseGlove - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * @section DESCRIPTION - * - * - */ - - -#include "SGUtils/SGEnumUtils.h" \ No newline at end of file diff --git a/Source/SenseGloveUtils/Public/SGUtils/SGEnumUtils.h b/Source/SenseGloveUtils/Public/SGUtils/SGEnumUtils.h deleted file mode 100644 index e950582c..00000000 --- a/Source/SenseGloveUtils/Public/SGUtils/SGEnumUtils.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @file - * - * @author Mamadou Babaei - * - * @section LICENSE - * - * (The MIT License) - * - * Copyright (c) 2020 - 2022 SenseGlove - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * @section DESCRIPTION - * - * - */ - - -#pragma once - -#include "Containers/UnrealString.h" -#include "Misc/AssertionMacros.h" -#include "Templates/UnrealTemplate.h" -#include "UObject/Class.h" -#include "UObject/Object.h" -#include "UObject/Package.h" -#include "UObject/ObjectMacros.h" - -class SENSEGLOVEUTILS_API FSGEnumUtils -{ -public: - template - static FORCEINLINE FString ValueToName(const FString& Enum, const E Value) - { - const UEnum* EnumPtr = FindObject(ANY_PACKAGE, *Enum, true); - if (!ensureAlwaysMsgf(EnumPtr, TEXT("No such enum exists!"))) { - return FString("None"); - } - return EnumPtr->GetNameByValue(StaticCast(Value)).ToString(); - } - - template - static FORCEINLINE E NameToValue(const FString& Enum, const FString& Name) - { - const UEnum* EnumPtr = FindObject(ANY_PACKAGE, *Enum, true); - if (!ensureAlwaysMsgf(EnumPtr, TEXT("No such enum exists!"))) { - return StaticCast(0); - } - return StaticCast(EnumPtr->GetValueByName(FName(*Name))); - } -}; \ No newline at end of file