startAgain. c++ functions, search
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "cppFuncLibrary.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FcppflatStruct
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "FlatId", MakeStructureDefaultValue = "-1"))
|
||||
int32 FlatId;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "flatType", MakeStructureDefaultValue = "0"))
|
||||
int32 flatType;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Flat#", MakeStructureDefaultValue = "-1"))
|
||||
int32 FlatN;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Zone", MakeStructureDefaultValue = "-1"))
|
||||
int32 Zone;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "House", MakeStructureDefaultValue = "-1"))
|
||||
int32 House;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Section", MakeStructureDefaultValue = "-1"))
|
||||
int32 Section;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Floor", MakeStructureDefaultValue = "-1"))
|
||||
int32 Floor;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Rooms", MakeStructureDefaultValue = "-1"))
|
||||
int32 Rooms;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Square", MakeStructureDefaultValue = "0.000000"))
|
||||
double Square;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Price", MakeStructureDefaultValue = "0"))
|
||||
int32 Price;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "price-meter", MakeStructureDefaultValue = "0"))
|
||||
int32 price_meter;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "available", MakeStructureDefaultValue = "True"))
|
||||
bool available;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "tags"))
|
||||
TArray<bool> tags;
|
||||
|
||||
/** Please add a variable description */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "comment"))
|
||||
FString comment;
|
||||
};
|
||||
|
||||
|
||||
UCLASS()
|
||||
class GRAFFMODULE_API UcppFuncLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UFUNCTION(blueprintcallable)
|
||||
static TArray<FString> cppUniversalParser(FString string, TArray<FString> keys, FString delimiter, bool caseSensitive);
|
||||
|
||||
UFUNCTION(blueprintcallable)
|
||||
static FString cppIntToStrPad(int32 int_, int32 minDigits);
|
||||
UFUNCTION(blueprintcallable, BlueprintPure)
|
||||
static TSoftObjectPtr<UTexture2D> castSoftTex2D(TSoftObjectPtr<UObject> ptr);
|
||||
|
||||
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "*-1"))
|
||||
static double NegateF(double in);
|
||||
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Integer", meta = (CompactNodeTitle = "*-1"))
|
||||
static int32 NegateI(int32 in);
|
||||
|
||||
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "1-x"))
|
||||
static double OneMinus(double in);
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, category = "Math|Float", meta = (CompactNodeTitle = "A+=B"))
|
||||
static double AddRefF(UPARAM(ref) double& A, double B);
|
||||
|
||||
UFUNCTION(BlueprintCallable, category = "Math|Integer", meta = (CompactNodeTitle = "A+=B"))
|
||||
static int32 AddRefI(UPARAM(ref) int32& A, int32 B);
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, category = "Math|Float", meta = (CompactNodeTitle = "A-=B"))
|
||||
static double SubRefF(UPARAM(ref) double& A, double B);
|
||||
|
||||
UFUNCTION(BlueprintCallable, category = "Math|Integer", meta = (CompactNodeTitle = "A-=B"))
|
||||
static int32 SubRefI(UPARAM(ref) int32& A, int32 B);
|
||||
|
||||
/** clamp int from 0 */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "0+"))
|
||||
static int32 clamp0(int32 in);
|
||||
|
||||
/** clamp float 0 to 1 */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "sat"))
|
||||
static double saturate(double in);
|
||||
|
||||
|
||||
/** return true if int is in trueInts. Format: 2,3,4-6 */
|
||||
UFUNCTION(BlueprintCallable, Category = "Strings", meta = (Keywords = "stringSwitch"))
|
||||
static void cppssw(int32 int_, FString trueInts, bool& true_, bool& false_);
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Strings")
|
||||
static FString stringAdd(UPARAM(ref) FString& str, FString add);
|
||||
|
||||
/** find key=value line by line */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings")
|
||||
static void parseOptions(FString SourceString, FString key, FString Delimiter, FString& value, bool& found);
|
||||
|
||||
|
||||
|
||||
/** empty string eq -1 */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings", meta = (CompactNodeTitle = "strInt"))
|
||||
static int32 customStringToInt(FString string);
|
||||
|
||||
/** by default rule is OR */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings")
|
||||
static void multiContains(FString source, UPARAM(ref) TArray<FString>& substrings, bool bAnd, bool bUseCase, bool& bTrue, bool& bFalse);
|
||||
|
||||
|
||||
|
||||
/** return first index of found key and bool arr */
|
||||
UFUNCTION(BlueprintCallable, Category = "Strings")
|
||||
static void containStringSwitch(FString string, UPARAM(ref) TArray<FString>& keys, bool bUseCase, int32& bInt, TArray<bool>& bools);
|
||||
|
||||
/** remove substrings from string (replace to "") */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings")
|
||||
static FString multiRemove(FString source, UPARAM(ref) TArray<FString>& substrings, bool bUseCase);
|
||||
|
||||
/** string->"string" */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings", meta = (CompactNodeTitle = "\"str\""))
|
||||
static FString quoteString(FString string);
|
||||
|
||||
/** return value*minmult and value*maxmult */
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (Keywords = "minmax"))
|
||||
static void getRange(double value, double minMult, double maxMult, double& bMin, double& bValue, double& bMax);
|
||||
|
||||
/*sortType: 0.price min-to-max 1. max-to-min 2.square min-to-max 3. max-to-min 4.floor min-to-max 5. max-to-min*/
|
||||
UFUNCTION(blueprintcallable, category = "Widget|Search")
|
||||
static void updateFilterList(TArray<FcppflatStruct> flats, int floorMin, int floorMax, float sqMin, float sqMax, int priceMin, int priceMax, TArray<bool> houses, TArray<bool> sections, TArray<bool> rooms, int sortType, TArray<FcppflatStruct>& filtered);
|
||||
|
||||
private:
|
||||
|
||||
static bool inRange(float in, float min, float max);
|
||||
static bool inRange(int in, int min, int max);
|
||||
/*return true if no true in array*/
|
||||
static bool boolGet(TArray<bool> arr, int index);
|
||||
static void minmaxInRange(TArray<int>arr, int min, int max, int& minid, int& maxid);
|
||||
static void minmaxInRange(TArray<float>arr, int min, int max, int& minid, int& maxid);
|
||||
};
|
||||
Reference in New Issue
Block a user