当前位置: 首页>>代码示例>>C++>>正文


C++ TSharedRef::Close方法代码示例

本文整理汇总了C++中TSharedRef::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::Close方法的具体用法?C++ TSharedRef::Close怎么用?C++ TSharedRef::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSharedRef的用法示例。


在下文中一共展示了TSharedRef::Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SavePluginDescriptor

bool FPluginHelpers::SavePluginDescriptor(const FString& NewProjectFilename, const FPluginDescriptor& PluginDescriptor)
{
	FString Text;
	TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&Text);

	Writer->WriteObjectStart();

	// Write all the simple fields

	Writer->WriteValue(TEXT("FileVersion"), PluginDescriptor.FileVersion);

	Writer->WriteValue(TEXT("FriendlyName"), PluginDescriptor.FriendlyName);
	Writer->WriteValue(TEXT("Version"), PluginDescriptor.Version);
	Writer->WriteValue(TEXT("VersionName"), PluginDescriptor.VersionName);
	Writer->WriteValue(TEXT("CreatedBy"), PluginDescriptor.CreatedBy);
	Writer->WriteValue(TEXT("CreatedByURL"), PluginDescriptor.CreatedByURL);
	Writer->WriteValue(TEXT("Category"), PluginDescriptor.Category);
	Writer->WriteValue(TEXT("Description"), PluginDescriptor.Description);
	Writer->WriteValue(TEXT("EnabledByDefault"), PluginDescriptor.bEnabledByDefault);


	// Write the module list
	FModuleDescriptor::WriteArray(Writer.Get(), TEXT("Modules"), PluginDescriptor.Modules);

	Writer->WriteObjectEnd();

	Writer->Close();

	return FFileHelper::SaveStringToFile(Text, *NewProjectFilename);
}
开发者ID:a3pelawi,项目名称:UnrealEngine,代码行数:30,代码来源:PluginHelpers.cpp

示例2: SaveCustomizedBlocks

void FMultiBoxCustomizationData::SaveCustomizedBlocks()
{
    FString SaveData;
    TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create( &SaveData );

    Writer->WriteObjectStart();
    Writer->WriteArrayStart(TEXT("CustomBlocks"));
    for (TArray<FCustomBlockTransaction>::TConstIterator It(Transactions); It; ++It)
    {
        const FCustomBlockTransaction& Transaction = *It;

        if( Transaction.Command.IsValid() )
        {
            const FUICommandInfo& Command = *Transaction.Command.Pin();

            Writer->WriteObjectStart();
            Writer->WriteValue(TEXT("CommandName"), Command.GetCommandName().ToString() );
            Writer->WriteValue(TEXT("Context"), Command.GetBindingContext().ToString() );
            Writer->WriteValue(TEXT("Index"), (float)Transaction.BlockIndex );
            Writer->WriteValue(TEXT("TransactionType"), (float)Transaction.TransactionType );
            Writer->WriteObjectEnd();
        }
    }

    Writer->WriteArrayEnd();
    Writer->WriteObjectEnd();
    Writer->Close();

    GConfig->SetString( *GetConfigSectionName(), *CustomizationName.ToString(), *FRemoteConfig::ReplaceIniCharWithSpecialChar(SaveData).ReplaceCharWithEscapedChar(), GEditorPerProjectIni );
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:30,代码来源:MultiBoxCustomization.cpp

示例3: SaveGame

bool UFlareSaveGameSystem::SaveGame(const FString SaveName, UFlareSaveGame* SaveData)
{
	bool ret = false;
	SaveLock.Lock();
	FLOGV("UFlareSaveGameSystem::SaveGame SaveName=%s", *SaveName);

	UFlareSaveWriter* SaveWriter = NewObject<UFlareSaveWriter>(this, UFlareSaveWriter::StaticClass());
	TSharedRef<FJsonObject> JsonObject = SaveWriter->SaveGame(SaveData);

	// Save the json object
	FString FileContents;
	//TSharedRef< TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>> > JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>::Create(&FileContents);
	TSharedRef< TJsonWriter<> > JsonWriter = TJsonWriterFactory<>::Create(&FileContents);

	if (FJsonSerializer::Serialize(JsonObject, JsonWriter))
	{
		JsonWriter->Close();

		ret = FFileHelper::SaveStringToFile(FileContents, *GetSaveGamePath(SaveName));
		FLOG("UFlareSaveGameSystem::SaveGame : Save done");
	}
	else
	{
		FLOGV("Fail to serialize save %s", *SaveName);
		ret = false;
	}

	SaveLock.Unlock();
	return ret;
}
开发者ID:YaSanBee,项目名称:HeliumRain,代码行数:30,代码来源:FlareSaveGameSystem.cpp

示例4: UStructToJsonObjectStringInternal

bool UStructToJsonObjectStringInternal(const TSharedRef<FJsonObject>& JsonObject, FString& OutJsonString, int32 Indent)
{
	TSharedRef<TJsonWriter<CharType, PrintPolicy> > JsonWriter = TJsonWriterFactory<CharType, PrintPolicy>::Create(&OutJsonString, Indent);
	bool bSuccess = FJsonSerializer::Serialize(JsonObject, JsonWriter);
	JsonWriter->Close();
	return bSuccess;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:7,代码来源:JsonObjectConverter.cpp

示例5: TouchStopped

void AHttpRequestCharacter::TouchStopped(ETouchIndex::Type FingerIndex, FVector Location)
{
	if (FingerIndex == ETouchIndex::Touch1)
	{
        
        /* Added for HTTP requests */
        
        // Create a writer and hold it in this FString
        FString JsonStr;
        TSharedRef< TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR> > > JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR> >::Create(&JsonStr);
        JsonWriter->WriteObjectStart();
        JsonWriter->WriteValue(TEXT("user"), TEXT("StormUnited"));
        JsonWriter->WriteObjectEnd();
        // Close the writer and finalize the output such that JsonStr has what we want
        JsonWriter->Close();
        
        TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest();
        HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8"));
        HttpRequest->SetURL(TEXT("http://localhost/configuration"));
        HttpRequest->SetVerb(TEXT("POST"));
        HttpRequest->SetContentAsString(JsonStr);
        HttpRequest->OnProcessRequestComplete().BindUObject(this, HttpCompleteCallback);
        HttpRequest->ProcessRequest();
        
        /* Added for HTTP requests */
		StopJumping();
	}
}
开发者ID:keithpurr,项目名称:Unreal_HTTP,代码行数:28,代码来源:HttpRequestCharacter.cpp

示例6: UserRequestJson

FORCEINLINE FString UserRequestJson()
{
	FString JsonStr;
	TSharedRef< TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR> > > JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR> >::Create(&JsonStr);
	JsonWriter->WriteObjectStart();
	JsonWriter->WriteValue(TEXT("devicetype"), TEXT("pc#ue4hue"));
	JsonWriter->WriteObjectEnd();
	JsonWriter->Close();
	return JsonStr;
}
开发者ID:chaiyuntian,项目名称:PhilipsHue,代码行数:10,代码来源:PhilipsHueBridge.cpp

示例7: SetLightBrightnessByGroupID

void UPhilipsHueBridge::SetLightBrightnessByGroupID(const int32 GroupID, const float Brightness)
{
	int32 Bri = (int32)(255.f*Brightness);
	FString JsonStr;
	TSharedRef< TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR> > > JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR> >::Create(&JsonStr);
	JsonWriter->WriteObjectStart();
	JsonWriter->WriteValue(TEXT("bri"), Bri);
	JsonWriter->WriteObjectEnd();
	JsonWriter->Close();
	SetLightGroupActionByIDRaw(0, JsonStr);
}
开发者ID:chaiyuntian,项目名称:PhilipsHue,代码行数:11,代码来源:PhilipsHueBridge.cpp

示例8: SaveGame

bool UFlareSaveGameSystem::SaveGame(const FString SaveName, UFlareSaveGame* SaveData)
{
	bool ret = false;
	SaveLock.Lock();
	FLOGV("UFlareSaveGameSystem::SaveGame SaveName=%s", *SaveName);

	UFlareSaveWriter* SaveWriter = NewObject<UFlareSaveWriter>(this, UFlareSaveWriter::StaticClass());
	TSharedRef<FJsonObject> JsonObject = SaveWriter->SaveGame(SaveData);

	// Save the json object
	FString FileContents;
	//TSharedRef< TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>> > JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>::Create(&FileContents);
	TSharedRef< TJsonWriter<> > JsonWriter = TJsonWriterFactory<>::Create(&FileContents);

	if (FJsonSerializer::Serialize(JsonObject, JsonWriter))
	{
		JsonWriter->Close();

		bool Compress = true;
		if(Compress)
		{
			uint32 StrLength = FCStringAnsi::Strlen(TCHAR_TO_UTF8(*FileContents));

			uint8* CompressedDataRaw = new uint8[StrLength];
			int32 CompressedSize = StrLength;

			const bool bResult = FCompression::CompressMemory((ECompressionFlags)(COMPRESS_GZIP), CompressedDataRaw, CompressedSize, TCHAR_TO_UTF8(*FileContents), StrLength);
			if (bResult)
			{
				ret = FFileHelper::SaveArrayToFile(TArrayView<const uint8>(CompressedDataRaw, CompressedSize), *GetSaveGamePath(SaveName, true));
			}

			delete[] CompressedDataRaw;
		}
		else
		{
			ret = FFileHelper::SaveStringToFile(FileContents, *GetSaveGamePath(SaveName, false));
		}
		FLOG("UFlareSaveGameSystem::SaveGame : Save done");
	}
	else
	{
		FLOGV("Fail to serialize save %s", *SaveName);
		ret = false;
	}

	SaveLock.Unlock();

	SaveListLock.Lock();
	SaveList.Remove(SaveData);
	SaveListLock.Unlock();

	return ret;
}
开发者ID:niavok,项目名称:HeliumRain,代码行数:54,代码来源:FlareSaveGameSystem.cpp

示例9: UStructToJsonObjectString

bool FJsonObjectConverter::UStructToJsonObjectString(const UStruct* StructDefinition, const void* Struct, FString& OutJsonString, int64 CheckFlags, int64 SkipFlags, int32 Indent)
{
	TSharedRef<FJsonObject> JsonObject = MakeShareable( new FJsonObject() );
	if (UStructToJsonObject(StructDefinition, Struct, JsonObject, CheckFlags, SkipFlags))
	{
		TSharedRef<TJsonWriter<> > JsonWriter = TJsonWriterFactory<>::Create(&OutJsonString, Indent);

		if (FJsonSerializer::Serialize( JsonObject, JsonWriter ))
		{
			JsonWriter->Close();
			return true;
		}
		else
		{
			UE_LOG(LogJson, Warning, TEXT("UStructToJsonObjectString - Unable to write out json"));
			JsonWriter->Close();
		}
	}

	return false;
}
开发者ID:stoneStyle,项目名称:Unreal4,代码行数:21,代码来源:JsonObjectConverter.cpp

示例10: SaveSimpleProfiles

void FLauncherProfileManager::SaveSimpleProfiles()
{
	for (TArray<ILauncherSimpleProfilePtr>::TIterator It(SimpleProfiles); It; ++It)
	{
		FString SimpleProfileFileName = FLauncherProfile::GetProfileFolder() / (*It)->GetDeviceName() + TEXT(".uslp");
		FString Text;
		TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&Text);
		(*It)->Save(Writer.Get());
		Writer->Close();
		FFileHelper::SaveStringToFile(Text, *SimpleProfileFileName);
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:12,代码来源:LauncherProfileManager.cpp

示例11: SaveJSONProfile

bool FLauncherProfileManager::SaveJSONProfile(const ILauncherProfileRef& Profile)
{
	if (Profile->GetId().IsValid())
	{
		FString Text;
		TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&Text);
		Profile->Save(Writer.Get());
		Writer->Close();
		return FFileHelper::SaveStringToFile(Text, *Profile->GetFilePath());
	}
	return false;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:12,代码来源:LauncherProfileManager.cpp

示例12: GetTableAsJSON

FString UCurveTable::GetTableAsJSON() const
{
	// use the pretty print policy since these values are usually getting dumpped for check-in to P4 (or for inspection)
	FString Result;
	TSharedRef< TJsonWriter<TCHAR, TPrettyJsonPrintPolicy<TCHAR> > > JsonWriter = TJsonWriterFactory<TCHAR, TPrettyJsonPrintPolicy<TCHAR> >::Create(&Result);
	if (!WriteTableAsJSON(JsonWriter))
	{
		return TEXT("No data in row curve!\n");
	}
	JsonWriter->Close();
	return Result;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:12,代码来源:CurveTable.cpp

示例13: SetLightColorByLightID

void UPhilipsHueBridge::SetLightColorByLightID(const int32 LightID, const FLinearColor InColor)
{
	FVector2D xy = ColorToxy(InColor);
	FString JsonStr;
	TSharedRef< TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR> > > JsonWriter = TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR> >::Create(&JsonStr);
	FString str = "[" + FString::SanitizeFloat(xy.X) + "," + FString::SanitizeFloat(xy.Y) + "]";
	JsonWriter->WriteObjectStart();
	JsonWriter->WriteRawJSONValue(TEXT("xy"), str);
	JsonWriter->WriteObjectEnd();
	JsonWriter->Close();
	SetLightStateByLightIDRaw(LightID, JsonStr);
}
开发者ID:chaiyuntian,项目名称:PhilipsHue,代码行数:12,代码来源:PhilipsHueBridge.cpp

示例14: SerializeManifest

bool FInternationalizationManifestJsonSerializer::SerializeManifest( TSharedRef< const FInternationalizationManifest > Manifest, FString& Str )
{
	TSharedRef< FJsonObject > JsonManifestObj = MakeShareable( new FJsonObject );
	bool bExecSuccessful = SerializeInternal( Manifest, JsonManifestObj );

	if(bExecSuccessful)
	{
		TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create( &Str );
		bExecSuccessful = FJsonSerializer::Serialize(JsonManifestObj, Writer);
		Writer->Close();
	}
	return bExecSuccessful;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:13,代码来源:InternationalizationManifestJsonSerializer.cpp

示例15: SerializeArchive

bool FJsonInternationalizationArchiveSerializer::SerializeArchive( TSharedRef< const FInternationalizationArchive > InternationalizationArchive, FString& Str )
{
	TSharedRef< FJsonObject > JsonArchiveObj = MakeShareable( new FJsonObject );
	bool bExecSuccessful = SerializeInternal( InternationalizationArchive, JsonArchiveObj );

	if( bExecSuccessful )
	{
		TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create( &Str );
		bExecSuccessful = FJsonSerializer::Serialize( JsonArchiveObj, Writer );
		Writer->Close();
	}
	return bExecSuccessful;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:13,代码来源:JsonInternationalizationArchiveSerializer.cpp


注:本文中的TSharedRef::Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。