Class that handles converting Json objects to and from UStructs 更多...
#include <JsonObjectConverter.h>
Public 成员函数 | |
| DECLARE_DELEGATE_RetVal_TwoParams (TSharedPtr< FJsonValue >, CustomExportCallback, FProperty *, const void *) | |
| Optional callback that will be run when exporting a single property to Json. 更多... | |
静态 Public 成员函数 | |
| static bool | GetTextFromField (const FString &FieldName, const TSharedPtr< FJsonValue > &FieldValue, FText &TextOut) |
| Convert a Json value to text (takes some hints from the value name) | |
| static bool | GetTextFromObject (const TSharedRef< FJsonObject > &Obj, FText &TextOut) |
| Parse an FText from a json object (assumed to be of the form where keys are culture codes and values are strings) | |
| template<typename OutStructType > | |
| static bool | JsonArrayStringToUStruct (const FString &JsonString, TArray< OutStructType > *OutStructArray, int64 CheckFlags, int64 SkipFlags) |
| Converts from a json string containing an array to an array of UStructs 更多... | |
| template<typename OutStructType > | |
| static bool | JsonArrayToUStruct (const TArray< TSharedPtr< FJsonValue > > &JsonArray, TArray< OutStructType > *OutStructArray, int64 CheckFlags, int64 SkipFlags) |
| Converts from an array of json values to an array of UStructs. 更多... | |
| static bool | JsonAttributesToUStruct (const TMap< FString, TSharedPtr< FJsonValue > > &JsonAttributes, const UStruct *StructDefinition, void *OutStruct, int64 CheckFlags, int64 SkipFlags) |
| Converts a set of json attributes (possibly from within a JsonObject) to a UStruct, using importText 更多... | |
| template<typename OutStructType > | |
| static bool | JsonObjectStringToUStruct (const FString &JsonString, OutStructType *OutStruct, int64 CheckFlags, int64 SkipFlags) |
| Converts from a json string containing an object to a UStruct 更多... | |
| static bool | JsonObjectToUStruct (const TSharedRef< FJsonObject > &JsonObject, const UStruct *StructDefinition, void *OutStruct, int64 CheckFlags=0, int64 SkipFlags=0) |
| Converts from a Json Object to a UStruct, using importText 更多... | |
| template<typename OutStructType > | |
| static bool | JsonObjectToUStruct (const TSharedRef< FJsonObject > &JsonObject, OutStructType *OutStruct, int64 CheckFlags=0, int64 SkipFlags=0) |
| Templated version of JsonObjectToUStruct 更多... | |
| static bool | JsonValueToUProperty (const TSharedPtr< FJsonValue > &JsonValue, FProperty *Property, void *OutValue, int64 CheckFlags, int64 SkipFlags) |
| Converts a single JsonValue to the corresponding FProperty (this may recurse if the property is a UStruct for instance). 更多... | |
| static TSharedPtr< FJsonValue > | ObjectJsonCallback (FProperty *Property, const void *Value) |
| Utility Export Callback for having object properties expanded to full Json. | |
| static FString | StandardizeCase (const FString &StringIn) |
| FName case insensitivity can make the casing of UPROPERTIES unpredictable. 更多... | |
| template<typename CharType , template< typename > class PrintPolicy> | |
| static bool | UStructToFormattedJsonObjectString (const UStruct *StructDefinition, const void *Struct, FString &OutJsonString, int64 CheckFlags, int64 SkipFlags, int32 Indent=0, const CustomExportCallback *ExportCb=nullptr) |
| Wrapper to UStructToJsonObjectString that allows a print policy to be specified. | |
| static bool | UStructToJsonAttributes (const UStruct *StructDefinition, const void *Struct, TMap< FString, TSharedPtr< FJsonValue > > &OutJsonAttributes, int64 CheckFlags, int64 SkipFlags, const CustomExportCallback *ExportCb=nullptr) |
| Converts from a UStruct to a set of json attributes (possibly from within a JsonObject) 更多... | |
| template<typename InStructType > | |
| static TSharedPtr< FJsonObject > | UStructToJsonObject (const InStructType &InStruct, int64 CheckFlags=0, int64 SkipFlags=0, const CustomExportCallback *ExportCb=nullptr) |
| Templated version of UStructToJsonObject to try and make most of the params. 更多... | |
| static bool | UStructToJsonObject (const UStruct *StructDefinition, const void *Struct, TSharedRef< FJsonObject > OutJsonObject, int64 CheckFlags, int64 SkipFlags, const CustomExportCallback *ExportCb=nullptr) |
| Converts from a UStruct to a Json Object, using exportText 更多... | |
| template<typename InStructType > | |
| static bool | UStructToJsonObjectString (const InStructType &InStruct, FString &OutJsonString, int64 CheckFlags=0, int64 SkipFlags=0, int32 Indent=0, const CustomExportCallback *ExportCb=nullptr, bool bPrettyPrint=true) |
| Templated version; Converts from a UStruct to a json string containing an object, using exportText 更多... | |
| static bool | UStructToJsonObjectString (const UStruct *StructDefinition, const void *Struct, FString &OutJsonString, int64 CheckFlags, int64 SkipFlags, int32 Indent=0, const CustomExportCallback *ExportCb=nullptr, bool bPrettyPrint=true) |
| Converts from a UStruct to a json string containing an object, using exportText 更多... | |
Class that handles converting Json objects to and from UStructs
| FJsonObjectConverter::DECLARE_DELEGATE_RetVal_TwoParams | ( | TSharedPtr< FJsonValue > | , |
| CustomExportCallback | , | ||
| FProperty * | , | ||
| const void * | |||
| ) |
Optional callback that will be run when exporting a single property to Json.
If this returns a valid value it will be inserted into the export chain. If this returns nullptr or is not bound, it will try generic type-specific export behavior before falling back to outputting ExportText as a string.
|
inlinestatic |
Converts from a json string containing an array to an array of UStructs
| JsonString | String containing JSON formatted data. |
| OutStructArray | The UStruct array to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags. |
|
inlinestatic |
Converts from an array of json values to an array of UStructs.
| JsonArray | Array containing json values to convert. |
| OutStructArray | The UStruct array to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags. |
|
static |
Converts a set of json attributes (possibly from within a JsonObject) to a UStruct, using importText
| JsonAttributes | Json Object to copy data out of |
| StructDefinition | UStruct definition that is looked over for properties |
| OutStruct | The UStruct instance to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
|
inlinestatic |
Converts from a json string containing an object to a UStruct
| JsonString | String containing JSON formatted data. |
| OutStruct | The UStruct instance to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
|
static |
Converts from a Json Object to a UStruct, using importText
| JsonObject | Json Object to copy data out of |
| StructDefinition | UStruct definition that is looked over for properties |
| Struct | The UStruct instance to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
|
inlinestatic |
Templated version of JsonObjectToUStruct
| JsonObject | Json Object to copy data out of |
| OutStruct | The UStruct instance to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
|
static |
Converts a single JsonValue to the corresponding FProperty (this may recurse if the property is a UStruct for instance).
| JsonValue | The value to assign to this property |
| Property | The FProperty definition of the property we're setting. |
| OutValue | Pointer to the property instance to be modified. |
| CheckFlags | Only convert sub-properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip sub-properties that match any of these flags |
FName case insensitivity can make the casing of UPROPERTIES unpredictable.
Attempt to standardize output.
|
static |
Converts from a UStruct to a set of json attributes (possibly from within a JsonObject)
| StructDefinition | UStruct definition that is looked over for properties |
| Struct | The UStruct instance to copy out of |
| JsonAttributes | Map of attributes to copy in to |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
| ExportCb | Optional callback to override export behavior, if this returns null it will fallback to the default |
|
inlinestatic |
Templated version of UStructToJsonObject to try and make most of the params.
Also serves as an example use case
| InStruct | The UStruct instance to read from |
| ExportCb | Optional callback to override export behavior, if this returns null it will fallback to the default |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
|
static |
Converts from a UStruct to a Json Object, using exportText
| StructDefinition | UStruct definition that is looked over for properties |
| Struct | The UStruct instance to copy out of |
| JsonObject | Json Object to be filled in with data from the ustruct |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
| ExportCb | Optional callback to override export behavior, if this returns null it will fallback to the default |
|
inlinestatic |
Templated version; Converts from a UStruct to a json string containing an object, using exportText
| Struct | The UStruct instance to copy out of |
| JsonObject | Json Object to be filled in with data from the ustruct |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
| Indent | How many tabs to add to the json serializer |
| ExportCb | Optional callback to override export behavior, if this returns null it will fallback to the default |
| bPrettyPrint | Option to use pretty print (e.g., adds line endings) or condensed print |
|
static |
Converts from a UStruct to a json string containing an object, using exportText
| StructDefinition | UStruct definition that is looked over for properties |
| Struct | The UStruct instance to copy out of |
| JsonObject | Json Object to be filled in with data from the ustruct |
| CheckFlags | Only convert properties that match at least one of these flags. If 0 check all properties. |
| SkipFlags | Skip properties that match any of these flags |
| Indent | How many tabs to add to the json serializer |
| ExportCb | Optional callback to override export behavior, if this returns null it will fallback to the default |
| bPrettyPrint | Option to use pretty print (e.g., adds line endings) or condensed print |