本文整理汇总了C++中TSharedPtr::AsBool方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::AsBool方法的具体用法?C++ TSharedPtr::AsBool怎么用?C++ TSharedPtr::AsBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::AsBool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetArrayField
void UVaRestJsonObject::SetArrayField(const FString& FieldName, const TArray<UVaRestJsonValue*>& InArray)
{
if (!JsonObj.IsValid())
{
return;
}
TArray< TSharedPtr<FJsonValue> > ValArray;
// Process input array and COPY original values
for (auto InVal : InArray)
{
TSharedPtr<FJsonValue> JsonVal = InVal->GetRootValue();
switch (InVal->GetType())
{
case EVaJson::None:
break;
case EVaJson::Null:
ValArray.Add(MakeShareable(new FJsonValueNull()));
break;
case EVaJson::String:
ValArray.Add(MakeShareable(new FJsonValueString(JsonVal->AsString())));
break;
case EVaJson::Number:
ValArray.Add(MakeShareable(new FJsonValueNumber(JsonVal->AsNumber())));
break;
case EVaJson::Boolean:
ValArray.Add(MakeShareable(new FJsonValueBoolean(JsonVal->AsBool())));
break;
case EVaJson::Array:
ValArray.Add(MakeShareable(new FJsonValueArray(JsonVal->AsArray())));
break;
case EVaJson::Object:
ValArray.Add(MakeShareable(new FJsonValueObject(JsonVal->AsObject())));
break;
default:
break;
}
}
JsonObj->SetArrayField(FieldName, ValArray);
}
示例2: DeserializeFromJSON
//.........这里部分代码省略.........
if (JsonChunkFilesizeList.IsValid())
{
TSharedPtr< FJsonObject > JsonChunkFilesizeListObj = JsonChunkFilesizeList->AsObject();
for (auto ChunkFilesizeIt = JsonChunkFilesizeListObj->Values.CreateConstIterator(); ChunkFilesizeIt; ++ChunkFilesizeIt)
{
FGuid ChunkGuid;
int64 ChunkSize = 0;
if (FGuid::Parse(ChunkFilesizeIt.Key(), ChunkGuid))
{
FromStringBlob(ChunkFilesizeIt.Value()->AsString(), ChunkSize);
if (ChunkInfoLookup.Contains(ChunkGuid))
{
FChunkInfoData* ChunkInfoData = ChunkInfoLookup[ChunkGuid];
ChunkInfoData->FileSize = ChunkSize;
bHasChunkFilesizeList = true;
}
}
}
}
if (bHasChunkFilesizeList == false)
{
// Missing chunk list, version before we saved them compressed.. Assume chunk size
for (FChunkInfoData& ChunkInfo : Data->ChunkList)
{
ChunkInfo.FileSize = FBuildPatchData::ChunkDataSize;
}
}
// Get the bIsFileData value. The variable will exist in versions of StoresIfChunkOrFileData or later, otherwise the previous method is to check
// if ChunkHashList is empty.
TSharedPtr<FJsonValue> JsonIsFileData = JsonValueMap.FindRef(TEXT("bIsFileData"));
if (JsonIsFileData.IsValid() && JsonIsFileData->Type == EJson::Boolean)
{
Data->bIsFileData = JsonIsFileData->AsBool();
}
else
{
Data->bIsFileData = !bHasChunkHashList;
}
// Get the custom fields. This is optional, and should not fail if it does not exist
TSharedPtr< FJsonValue > JsonCustomFields = JsonValueMap.FindRef( TEXT( "CustomFields" ) );
if( JsonCustomFields.IsValid() )
{
TSharedPtr< FJsonObject > JsonCustomFieldsObj = JsonCustomFields->AsObject();
for( auto CustomFieldIt = JsonCustomFieldsObj->Values.CreateConstIterator(); CustomFieldIt && bSuccess; ++CustomFieldIt )
{
Data->CustomFields.Add(FCustomFieldData(CustomFieldIt.Key(), CustomFieldIt.Value()->AsString()));
}
}
CustomFieldLookup.Empty(Data->CustomFields.Num());
for (auto& CustomField : Data->CustomFields)
{
CustomFieldLookup.Add(CustomField.Key, &CustomField);
}
// If this is file data, fill out the guid to filename lookup, and chunk file size
if (Data->bIsFileData)
{
for (auto& FileManifest : Data->FileManifestList)
{
if (FileManifest.FileChunkParts.Num() == 1)
{
FGuid& Guid = FileManifest.FileChunkParts[0].Guid;
FileNameLookup.Add(Guid, &FileManifest.Filename);
if (ChunkInfoLookup.Contains(Guid))