MatureJsonListHelpers.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. // Clear Before Copyright 2024 Tracer Interactive, LLC. All Rights Reserved.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "Delegates/DelegateCombinations.h"
  5. #include "Kismet/BlueprintFunctionLibrary.h"
  6. #include "MatureJsonValue.h"
  7. #include "MatureJsonObject.h"
  8. #include "MatureJsonList.h"
  9. #include "MatureJsonListHelpers.generated.h"
  10. UCLASS()
  11. class MATUREJSON_API UMatureJsonListHelpers : public UBlueprintFunctionLibrary
  12. {
  13. GENERATED_BODY()
  14. public:
  15. UFUNCTION(BlueprintPure, Category = "Mature Json")
  16. static void Remove(UPARAM(ref) FMatureJsonList& JList, const int index,const int num = 1);
  17. UFUNCTION(BlueprintPure, Category = "Mature Json")
  18. static FMatureJsonValue GetValue(const FMatureJsonList& JList,const int index);
  19. UFUNCTION(BlueprintPure, Category = "Mature Json")
  20. static int Size(const FMatureJsonList& JList);
  21. UFUNCTION(BlueprintPure, Category = "Mature Json")
  22. static bool IsEmpty(const FMatureJsonList& JList);
  23. UFUNCTION(BlueprintPure, Category = "Mature Json")
  24. static void Clear(UPARAM(ref) FMatureJsonList& JList);
  25. // Clear Before Copy an array of booleans to a JSON array.
  26. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Boolean Array To List"), Category = "Mature Json|Array")
  27. static FMatureJsonList FromBooleanArray(const TArray<bool>& Value);
  28. // Clear Before Copy an array of floats to a JSON array.
  29. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Float Array To List"), Category = "Mature Json|Array")
  30. static FMatureJsonList FromFloatArray(const TArray<float>& Value);
  31. // Clear Before Copy an array of integers to a JSON array.
  32. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Integer Array To List"), Category = "Mature Json|Array")
  33. static FMatureJsonList FromIntegerArray(const TArray<int32>& Value);
  34. // Clear Before Copy an array of strings to a JSON array.
  35. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy String Array To List"), Category = "Mature Json|Array")
  36. static FMatureJsonList FromStringArray(const TArray<FString>& Value);
  37. // Clear Before Copy an array of date/times to a JSON array.
  38. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Date/Time Array To List"), Category = "Mature Json|Array|Engine")
  39. static FMatureJsonList FromDateTimeArray(const TArray<FDateTime>& Value);
  40. // Clear Before Copy an array of GUIDs to a JSON array.
  41. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy GUID Array To List"), Category = "Mature Json|Array|Engine")
  42. static FMatureJsonList FromGuidArray(const TArray<FGuid>& Value);
  43. // Clear Before Copy an array of colors to a JSON array.
  44. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Color Array To List"), Category = "Mature Json|Array|Engine")
  45. static FMatureJsonList FromColorArray(const TArray<FColor>& Value);
  46. // Clear Before Copy an array of linear colors to a JSON array.
  47. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Linear Color Array To List"), Category = "Mature Json|Array|Engine")
  48. static FMatureJsonList FromLinearColorArray(const TArray<FLinearColor>& Value);
  49. // Clear Before Copy an array of rotators to a JSON array.
  50. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Rotator Array To List"), Category = "Mature Json|Array|Engine")
  51. static FMatureJsonList FromRotatorArray(const TArray<FRotator>& Value);
  52. // Clear Before Copy an array of transforms to a JSON array.
  53. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Transform Array To List"), Category = "Mature Json|Array|Engine")
  54. static FMatureJsonList FromTransformArray(const TArray<FTransform>& Value);
  55. // Clear Before Copy an array of vectors to a JSON array.
  56. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Vector Array To List"), Category = "Mature Json|Array|Engine")
  57. static FMatureJsonList FromVectorArray(const TArray<FVector>& Value);
  58. // Clear Before Copy an array of JSON objects to a JSON array.
  59. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Object Array To List"), Category = "Mature Json|Array")
  60. static FMatureJsonList FromObjectArray(const TArray<FMatureJsonObject>& Value);
  61. // Clear Before Copy an array of JSON value to a JSON array.
  62. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Copy Object Array To List"), Category = "Mature Json|Array")
  63. static FMatureJsonList FromValueArray(const TArray<FMatureJsonValue>& Value);
  64. // Add an booleans to a JSON array.
  65. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Boolean To List"), Category = "Mature Json|Array")
  66. static int AddBoolean(FMatureJsonList JList, const bool Value);
  67. // Add an floats to a JSON array.
  68. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Float To List"), Category = "Mature Json|Array")
  69. static int AddFloat(FMatureJsonList JList, const float Value);
  70. // Add an integers to a JSON array.
  71. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Integer To List"), Category = "Mature Json|Array")
  72. static int AddInteger(FMatureJsonList JList, const int32 Value);
  73. // Add an strings to a JSON array.
  74. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add String To List"), Category = "Mature Json|Array")
  75. static int AddString(FMatureJsonList JList, const FString& Value);
  76. // Add an date/times to a JSON array.
  77. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Date/Time To List"), Category = "Mature Json|Array|Engine")
  78. static int AddDateTime(FMatureJsonList JList, const FDateTime& Value);
  79. // Add an GUIDs to a JSON array.
  80. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add GUID To List"), Category = "Mature Json|Array|Engine")
  81. static int AddGuid(FMatureJsonList JList, const FGuid& Value);
  82. // Add an colors to a JSON array.
  83. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Color To List"), Category = "Mature Json|Array|Engine")
  84. static int AddColor(FMatureJsonList JList, const FColor& Value);
  85. // Add an linear colors to a JSON array.
  86. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Linear Color To List"), Category = "Mature Json|Array|Engine")
  87. static int AddLinearColor(FMatureJsonList JList, const FLinearColor& Value);
  88. // Add an rotators to a JSON array.
  89. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Rotator To List"), Category = "Mature Json|Array|Engine")
  90. static int AddRotator(FMatureJsonList JList, const FRotator& Value);
  91. // Add an transforms to a JSON array.
  92. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Transform To List"), Category = "Mature Json|Array|Engine")
  93. static int AddTransform(FMatureJsonList JList, const FTransform& Value);
  94. // Add an vectors to a JSON array.
  95. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Vector To List"), Category = "Mature Json|Array|Engine")
  96. static int AddVector(FMatureJsonList JList, const FVector& Value);
  97. // Add an JSON objects to a JSON array.
  98. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  99. static int AddObject(FMatureJsonList JList, const FMatureJsonObject& Value);
  100. // Add an JSON value to a JSON array.
  101. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  102. static int AddValue(FMatureJsonList JList, const FMatureJsonValue& Value);
  103. // Add an JSON value to a JSON array.
  104. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  105. static int AddNull(FMatureJsonList JList);
  106. // Add an JSON value to a JSON array.
  107. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  108. static int AddList(FMatureJsonList JList, const FMatureJsonList& Value);
  109. // merge an JSON value to a JSON array.
  110. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  111. static FMatureJsonList MergeList(FMatureJsonList JList, const FMatureJsonList& Value);
  112. // Convert a JSON value valueto a boolean.
  113. UFUNCTION(BlueprintPure, Category = "Mature Json|Array")
  114. static bool GetBoolean(UPARAM(ref) FMatureJsonList& Value, int index);
  115. // Convert a JSON value valueto a float.
  116. UFUNCTION(BlueprintPure, Category = "Mature Json|Array")
  117. static float GetFloat(UPARAM(ref) FMatureJsonList& Value, int index);
  118. // Convert a JSON value valueto an integer.
  119. UFUNCTION(BlueprintPure, Category = "Mature Json|Array")
  120. static int32 GetInteger(UPARAM(ref) FMatureJsonList& Value, int index);
  121. // Convert a JSON value valueto a string.
  122. UFUNCTION(BlueprintPure, Category = "Mature Json|Array")
  123. static FString GetString(UPARAM(ref) FMatureJsonList& Value, int index);
  124. // Convert a JSON value valueto a date/time.
  125. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  126. static FDateTime GetDateTime(UPARAM(ref) FMatureJsonList& Value, int index);
  127. // Convert a JSON value valueto a GUID.
  128. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  129. static FGuid GetGuid(UPARAM(ref) FMatureJsonList& Value, int index);
  130. // Convert a JSON value valueto a color.
  131. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  132. static FColor GetColor(UPARAM(ref) FMatureJsonList& Value, int index);
  133. // Convert a JSON value valueto a linear color.
  134. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  135. static FLinearColor GetLinearColor(UPARAM(ref) FMatureJsonList& Value, int index);
  136. // Convert a JSON value valueto a linear color.
  137. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  138. static FRotator GetRotator(UPARAM(ref) FMatureJsonList& Value, int index);
  139. // Convert a JSON value valueto a linear color.
  140. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  141. static FVector GetVector(UPARAM(ref) FMatureJsonList& Value, int index);
  142. // Convert a JSON value valueto a linear color.
  143. UFUNCTION(BlueprintPure, Category = "Mature Json|Array|Engine")
  144. static FTransform GetTransform(UPARAM(ref) FMatureJsonList& Value, int index);
  145. // Convert a JSON value valueto a JSON object.
  146. UFUNCTION(BlueprintPure, Category = "Mature Json|Array")
  147. static FMatureJsonObject GetObject(UPARAM(ref) FMatureJsonList& Value, int index);
  148. // Convert a JSON value valueto a JSON array.
  149. UFUNCTION(BlueprintPure, Category = "Mature Json|Array")
  150. static FMatureJsonList GetList(UPARAM(ref) FMatureJsonList& Value, int index);
  151. // Update an booleans to a JSON array by index .
  152. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Boolean To List"), Category = "Mature Json|Array")
  153. static FMatureJsonList UpdateBoolean(FMatureJsonList JList, const int index, const bool Value);
  154. // Update an floats to a JSON array by index .
  155. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Float To List"), Category = "Mature Json|Array")
  156. static FMatureJsonList UpdateFloat(FMatureJsonList JList, const int index, const float Value);
  157. // Update an integers to a JSON array by index .
  158. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Integer To List"), Category = "Mature Json|Array")
  159. static FMatureJsonList UpdateInteger(FMatureJsonList JList, const int index, const int32 Value);
  160. // Update an strings to a JSON array by index .
  161. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add String To List"), Category = "Mature Json|Array")
  162. static FMatureJsonList UpdateString(FMatureJsonList JList, const int index, const FString& Value);
  163. // Update an date/times to a JSON array by index .
  164. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Date/Time To List"), Category = "Mature Json|Array|Engine")
  165. static FMatureJsonList UpdateDateTime(FMatureJsonList JList, const int index, const FDateTime& Value);
  166. // Update an GUIDs to a JSON array by index .
  167. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add GUID To List"), Category = "Mature Json|Array|Engine")
  168. static FMatureJsonList UpdateGuid(FMatureJsonList JList, const int index, const FGuid& Value);
  169. // Update an colors to a JSON array by index .
  170. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Color To List"), Category = "Mature Json|Array|Engine")
  171. static FMatureJsonList UpdateColor(FMatureJsonList JList, const int index, const FColor& Value);
  172. // Update an linear colors to a JSON array by index .
  173. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Linear Color To List"), Category = "Mature Json|Array|Engine")
  174. static FMatureJsonList UpdateLinearColor(FMatureJsonList JList, const int index, const FLinearColor& Value);
  175. // Update an rotators to a JSON array by index .
  176. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Rotator To List"), Category = "Mature Json|Array|Engine")
  177. static FMatureJsonList UpdateRotator(FMatureJsonList JList, const int index, const FRotator& Value);
  178. // Update an transforms to a JSON array by index .
  179. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Transform To List"), Category = "Mature Json|Array|Engine")
  180. static FMatureJsonList UpdateTransform(FMatureJsonList JList, const int index, const FTransform& Value);
  181. // Update an vectors to a JSON array by index .
  182. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Vector To List"), Category = "Mature Json|Array|Engine")
  183. static FMatureJsonList UpdateVector(FMatureJsonList JList, const int index, const FVector& Value);
  184. // Update an JSON objects to a JSON array by index .
  185. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  186. static FMatureJsonList UpdateObject(FMatureJsonList JList, const int index, const FMatureJsonObject& Value);
  187. // Update an JSON value to a JSON array by index .
  188. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  189. static FMatureJsonList UpdateValue(FMatureJsonList JList, const int index, const FMatureJsonValue& Value);
  190. // Update an JSON value to a JSON array by index .
  191. UFUNCTION(BlueprintCallable, meta = (DisplayName = "Add Object To List"), Category = "Mature Json|Array")
  192. static FMatureJsonList UpdateNull(FMatureJsonList JList, const int index);
  193. };