// Copyright Low Entry. Apache License, Version 2.0. #pragma once #include "CoreMinimal.h" #include "LowEntryLong.h" #include "LowEntryDouble.h" #include "LowEntryByteDataReader.generated.h" UCLASS(BlueprintType) class LOWENTRYEXTENDEDSTANDARDLIBRARY_API ULowEntryByteDataReader : public UObject { GENERATED_UCLASS_BODY() public: static ULowEntryByteDataReader* Create(const TArray& Bytes, int32 Index = 0, int32 Length = 0x7FFFFFFF); static ULowEntryByteDataReader* CreateClone(const TArray& Bytes, const int32 Position); int32 GetAndIncreasePosition(const int32 Increasement); int32 MaxElementsRemaining(const int32 MinimumSizePerElement); protected: int32 GetUinteger(); public: UPROPERTY() TArray Bytes; UPROPERTY() int32 Position = 0; /** * Clones the clone of this ByteDataReader. * * Allows you to easily read and revert the position (by cloning, reading data with the clone, and then throwing the clone away). */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader (Meta)", Meta = (DisplayName = "Get Clone")) ULowEntryByteDataReader* GetClone(); /** * Returns the current position. */ UFUNCTION(BlueprintPure, Category = "Low Entry|Extended Standard Library|Byte Data|Reader (Meta)", Meta = (DisplayName = "Get Position")) int32 GetPosition(); /** * Sets the current position. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader (Meta)", Meta = (DisplayName = "Set Position")) void SetPosition(const int32 Position_); /** * Sets the current position to 0. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader (Meta)", Meta = (DisplayName = "Reset")) void Reset(); /** * Causes Remaining to return 0. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader (Meta)", Meta = (DisplayName = "Empty")) void Empty(); /** * Returns the amount of bytes left. */ UFUNCTION(BlueprintPure, Category = "Low Entry|Extended Standard Library|Byte Data|Reader (Meta)", Meta = (DisplayName = "Get Remaining")) int32 Remaining(); /** * Gets a byte. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Byte")) uint8 GetByte(); /** * Gets an integer. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Integer")) int32 GetInteger(); /** * Gets a positive integer. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Positive Integer 1")) int32 GetPositiveInteger1(); /** * Gets a positive integer. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Positive Integer 2")) int32 GetPositiveInteger2(); /** * Gets a positive integer. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Positive Integer 3")) int32 GetPositiveInteger3(); /** * Gets a long (int64). */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Long", Keywords = "int64 integer64")) int64 GetLong(); /** * Gets a long (bytes). */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Long (bytes)")) ULowEntryLong* GetLongBytes(); /** * Gets a float. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Float")) float GetFloat(); /** * Gets a double. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Double")) double GetDouble(); /** * Gets a double (bytes). */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Double (bytes)")) ULowEntryDouble* GetDoubleBytes(); /** * Gets a boolean. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Boolean")) bool GetBoolean(); /** * Gets a String (UTF-8). */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get String (Utf 8)")) FString GetStringUtf8(); /** * Gets a byte array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Byte Array")) TArray GetByteArray(); /** * Gets an integer array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Integer Array")) TArray GetIntegerArray(); /** * Gets a positive integer array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Positive Integer 1 Array")) TArray GetPositiveInteger1Array(); /** * Gets a positive integer array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Positive Integer 2 Array")) TArray GetPositiveInteger2Array(); /** * Gets a positive integer array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Positive Integer 3 Array")) TArray GetPositiveInteger3Array(); /** * Gets a long (int64) array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Long Array", Keywords = "int64 integer64")) TArray GetLongArray(); /** * Gets a long (bytes) array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Long (bytes) Array")) TArray GetLongBytesArray(); /** * Gets a float array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Float Array")) TArray GetFloatArray(); /** * Gets a double array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Double Array")) TArray GetDoubleArray(); /** * Gets a double (byte) array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Double (bytes) Array")) TArray GetDoubleBytesArray(); /** * Gets a boolean array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get Boolean Array")) TArray GetBooleanArray(); /** * Gets a String (UTF-8) array. */ UFUNCTION(BlueprintCallable, Category = "Low Entry|Extended Standard Library|Byte Data|Reader", Meta = (DisplayName = "Get String (Utf 8) Array")) TArray GetStringUtf8Array(); int32 SafeMultiply(const int32 A, const int32 B); };