engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
FJsonObject类 参考

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 {}.

成员函数说明

◆ GetBoolField()

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.

参数
FieldNameThe name of the field to get.
返回
The field's value as a boolean.

◆ GetNumberField()

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.

参数
FieldNameThe name of the field to get.
返回
The field's value as a number.

◆ GetObjectField()

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.

参数
FieldNameThe name of the field to get.
返回
The field's value as a Json object.

◆ HasField()

bool FJsonObject::HasField ( const FString &  FieldName) const
inline

Checks whether a field with the specified name exists in the object.

参数
FieldNameThe name of the field to check.
返回
true if the field exists, false otherwise.

◆ HasTypedField()

template<EJson JsonType>
bool FJsonObject::HasTypedField ( const FString &  FieldName) const
inline

Checks whether a field with the specified name and type exists in the object.

参数
JsonTypeThe type of the field to check.
FieldNameThe name of the field to check.
返回
true if the field exists, false otherwise.

◆ RemoveField()

void FJsonObject::RemoveField ( const FString &  FieldName)

Removes the field with the specified name.

参数
FieldNameThe name of the field to remove.

◆ SetField()

void FJsonObject::SetField ( const FString &  FieldName,
const TSharedPtr< FJsonValue > &  Value 
)

Sets the value of the field with the specified name.

参数
FieldNameThe name of the field to set.
ValueThe value to set.

◆ TryGetBoolField()

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.

◆ TryGetEnumArrayField()

template<typename TEnum >
bool FJsonObject::TryGetEnumArrayField ( const FString &  FieldName,
TArray< TEnum > &  OutArray 
) const
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.

◆ TryGetField()

TSharedPtr< FJsonValue > FJsonObject::TryGetField ( const FString &  FieldName) const
inline

Attempts to get the field with the specified name.

参数
FieldNameThe name of the field to get.
返回
A pointer to the field, or nullptr if the field doesn't exist.

◆ TryGetNumberField() [1/4]

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.

◆ TryGetNumberField() [2/4]

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.

◆ TryGetNumberField() [3/4]

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.

◆ TryGetNumberField() [4/4]

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.

◆ TryGetStringArrayField()

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.

◆ TryGetStringField()

bool FJsonObject::TryGetStringField ( const FString &  FieldName,
FString &  OutString 
) const

Get the field named FieldName as a string.

Returns false if it doesn't exist or cannot be converted.


该类的文档由以下文件生成: