8#include "CoreMinimal.h"
9#include "UObject/Class.h"
10#include "Kismet/BlueprintFunctionLibrary.h"
20#include "EnumUtilities.generated.h"
32 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
33 static EFoliageTypes ConvertStringToFoliageType(
const FString& String);
35 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
36 static FString ConvertFoliageTypeToString(
EFoliageTypes FoliageType);
38 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
39 static EPropTypes ConvertStringToPropType(
const FString& String);
41 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
42 static FString ConvertPropTypeToString(
EPropTypes PropType);
44 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
45 static ESensorTypes ConvertStringToSensorType(
const FString& String);
47 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
48 static FString ConvertSensorTypeToString(
ESensorTypes Sensortype);
50 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
51 static EVehicleTypes ConvertStringToVehicleType(
const FString& String);
53 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
54 static FString ConvertVehicleTypeToString(
EVehicleTypes VehicleType);
56 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
57 static EWalkerType ConvertStringToWalkerType(
const FString& String);
59 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
60 static FString ConvertWalkerTypeToString(
EWalkerType WalkerType);
62 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
63 static EWalkerAction ConvertStringToWalkerActionType(
const FString& String);
65 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
66 static FString ConvertWalkerActionTypeToString(
EWalkerAction WalkerAction);
68 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
69 static EWalkerEndAction ConvertStringToWalkerEndActionType(
const FString& String);
71 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
72 static FString ConvertWalkerEndActionTypeToString(
EWalkerEndAction WalkerEndAction);
74 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
75 static EQualityLevel ConvertStringToQualityLevel(
const FString& String);
77 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
78 static FString ConvertQualityLevelToString(
EQualityLevel QualityLevel);
80 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
81 static EAntiAliasing ConvertStringToAntiAliasingMethod(
const FString& String);
83 UFUNCTION(BlueprintCallable, Category =
"Agrarsense Conversion Utilities")
84 static FString ConvertAntiAliasingMethodToString(
EAntiAliasing AntiAliasingMethod);
89 template <
typename TEnum>
92 TMap<TEnum, FString> EnumMap;
95 UEnum* Enum = FindObject<UEnum>(
nullptr, *EnumTypeName,
true);
98 for (int32 EnumIndex = 0; EnumIndex < Enum->NumEnums(); EnumIndex++)
100 TEnum EnumValue =
static_cast<TEnum
>(Enum->GetValueByIndex(EnumIndex));
101 FString EnumName = Enum->GetNameStringByIndex(EnumIndex);
103 EnumMap.Add(EnumValue, EnumName);
110 template <
typename TEnum>
113 TMap<FString, TEnum> EnumMap;
116 UEnum* Enum = FindObject<UEnum>(
nullptr, *EnumTypeName,
true);
119 for (int32 EnumIndex = 0; EnumIndex < Enum->NumEnums(); EnumIndex++)
121 TEnum EnumValue =
static_cast<TEnum
>(Enum->GetValueByIndex(EnumIndex));
122 FString EnumName = Enum->GetNameStringByIndex(EnumIndex);
124 EnumMap.Add(EnumName, EnumValue);
140 template <
typename TEnum>
143 UEnum* Enum = FindObject<UEnum>(
nullptr, *EnumTypeName,
true);
146 int32 EnumIndex = Enum->GetIndexByName(FName(*EnumString));
147 if (EnumIndex != INDEX_NONE)
149 return static_cast<TEnum
>(Enum->GetValueByIndex(EnumIndex));
static TMap< TEnum, FString > CreateEnumStringMap(const FString &EnumTypeName)
static TMap< FString, TEnum > CreateStringEnumMap(const FString &EnumTypeName)
static TEnum ConvertStringToEnum(const FString &EnumString, const FString &EnumTypeName)