A Json Object is a structure holding an unordered set of name/value pairs. 更多...
#include <JsonObject.h>
Public 成员函数 | |
| const TArray< TSharedPtr< FJsonValue > > & | GetArrayField (const FString &FieldName) const |
| Get the field named FieldName as an array. | |
| bool | GetBoolField (const FString &FieldName) const |
| Gets the field with the specified name as a boolean. 更多... | |
| FORCEINLINE int32 | GetIntegerField (const FString &FieldName) const |
| Gets a numeric field and casts to an int32 | |
| double | GetNumberField (const FString &FieldName) const |
| Gets the field with the specified name as a number. 更多... | |
| const TSharedPtr< FJsonObject > & | GetObjectField (const FString &FieldName) const |
| Gets the field with the specified name as a Json object. 更多... | |
| FString | GetStringField (const FString &FieldName) const |
| Get the field named FieldName as a string. | |
| bool | HasField (const FString &FieldName) const |
| Checks whether a field with the specified name exists in the object. 更多... | |
| template<EJson JsonType> | |
| bool | HasTypedField (const FString &FieldName) const |
| Checks whether a field with the specified name and type exists in the object. 更多... | |
| void | RemoveField (const FString &FieldName) |
| Removes the field with the specified name. 更多... | |
| void | SetArrayField (const FString &FieldName, const TArray< TSharedPtr< FJsonValue > > &Array) |
| Set an array field named FieldName and value of Array | |
| void | SetBoolField (const FString &FieldName, bool InValue) |
| Set a boolean field named FieldName and value of InValue | |
| void | SetField (const FString &FieldName, const TSharedPtr< FJsonValue > &Value) |
| Sets the value of the field with the specified name. 更多... | |
| void | SetNumberField (const FString &FieldName, double Number) |
| Add a field named FieldName with Number as value | |
| void | SetObjectField (const FString &FieldName, const TSharedPtr< FJsonObject > &JsonObject) |
| Set an ObjectField named FieldName and value of JsonObject | |
| void | SetStringField (const FString &FieldName, const FString &StringValue) |
| Add a field named FieldName with value of StringValue | |
| bool | TryGetArrayField (const FString &FieldName, const TArray< TSharedPtr< FJsonValue > > *&OutArray) const |
| Try to get the field named FieldName as an array, or return false if it's another type | |
| bool | TryGetBoolField (const FString &FieldName, bool &OutBool) const |
| Get the field named FieldName as a string. 更多... | |
| template<typename TEnum > | |
| bool | TryGetEnumArrayField (const FString &FieldName, TArray< TEnum > &OutArray) const |
| Get the field named FieldName as an array of enums. 更多... | |
| TSharedPtr< FJsonValue > | TryGetField (const FString &FieldName) const |
| Attempts to get the field with the specified name. 更多... | |
| bool | TryGetNumberField (const FString &FieldName, double &OutNumber) const |
| Get the field named FieldName as a number. 更多... | |
| bool | TryGetNumberField (const FString &FieldName, int32 &OutNumber) const |
| Get the field named FieldName as a number, and makes sure it's within int32 range. 更多... | |
| bool | TryGetNumberField (const FString &FieldName, int64 &OutNumber) const |
| Get the field named FieldName as a number. 更多... | |
| bool | TryGetNumberField (const FString &FieldName, uint32 &OutNumber) const |
| Get the field named FieldName as a number, and makes sure it's within uint32 range. 更多... | |
| bool | TryGetObjectField (const FString &FieldName, const TSharedPtr< FJsonObject > *&OutObject) const |
| Try to get the field named FieldName as an object, or return false if it's another type | |
| bool | TryGetStringArrayField (const FString &FieldName, TArray< FString > &OutArray) const |
| Get the field named FieldName as an array of strings. 更多... | |
| bool | TryGetStringField (const FString &FieldName, FString &OutString) const |
| Get the field named FieldName as a string. 更多... | |
A Json Object is a structure holding an unordered set of name/value pairs.
In a Json file, it is represented by everything between curly braces {}.
| bool FJsonObject::GetBoolField | ( | const FString & | FieldName | ) | const |
Gets the field with the specified name as a boolean.
Ensures that the field is present and is of type Json number.
| FieldName | The name of the field to get. |
| double FJsonObject::GetNumberField | ( | const FString & | FieldName | ) | const |
Gets the field with the specified name as a number.
Ensures that the field is present and is of type Json number.
| FieldName | The name of the field to get. |
| const TSharedPtr< FJsonObject > & FJsonObject::GetObjectField | ( | const FString & | FieldName | ) | const |
Gets the field with the specified name as a Json object.
Ensures that the field is present and is of type Json number.
| FieldName | The name of the field to get. |
|
inline |
Checks whether a field with the specified name exists in the object.
| FieldName | The name of the field to check. |
|
inline |
Checks whether a field with the specified name and type exists in the object.
| JsonType | The type of the field to check. |
| FieldName | The name of the field to check. |
| void FJsonObject::RemoveField | ( | const FString & | FieldName | ) |
Removes the field with the specified name.
| FieldName | The name of the field to remove. |
| void FJsonObject::SetField | ( | const FString & | FieldName, |
| const TSharedPtr< FJsonValue > & | Value | ||
| ) |
Sets the value of the field with the specified name.
| FieldName | The name of the field to set. |
| Value | The value to set. |
| bool FJsonObject::TryGetBoolField | ( | const FString & | FieldName, |
| bool & | OutBool | ||
| ) | const |
Get the field named FieldName as a string.
Returns false if it doesn't exist or cannot be converted.
|
inline |
Get the field named FieldName as an array of enums.
Returns false if it doesn't exist or any member is not a string.
|
inline |
Attempts to get the field with the specified name.
| FieldName | The name of the field to get. |
| bool FJsonObject::TryGetNumberField | ( | const FString & | FieldName, |
| double & | OutNumber | ||
| ) | const |
Get the field named FieldName as a number.
Returns false if it doesn't exist or cannot be converted.
| bool FJsonObject::TryGetNumberField | ( | const FString & | FieldName, |
| int32 & | OutNumber | ||
| ) | const |
Get the field named FieldName as a number, and makes sure it's within int32 range.
Returns false if it doesn't exist or cannot be converted.
| bool FJsonObject::TryGetNumberField | ( | const FString & | FieldName, |
| int64 & | OutNumber | ||
| ) | const |
Get the field named FieldName as a number.
Returns false if it doesn't exist or cannot be converted.
| bool FJsonObject::TryGetNumberField | ( | const FString & | FieldName, |
| uint32 & | OutNumber | ||
| ) | const |
Get the field named FieldName as a number, and makes sure it's within uint32 range.
Returns false if it doesn't exist or cannot be converted.
| bool FJsonObject::TryGetStringArrayField | ( | const FString & | FieldName, |
| TArray< FString > & | OutArray | ||
| ) | const |
Get the field named FieldName as an array of strings.
Returns false if it doesn't exist or any member cannot be converted.
Get the field named FieldName as a string.
Returns false if it doesn't exist or cannot be converted.