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


C++ TextWriter::WriteAllToStream方法代码示例

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


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

示例1: SavePersistentData

void EdApp::SavePersistentData()
{
	// Save layout
	{
		QFile		file(ED_PATH_TO_APP_LAYOUT);
		file.open(QIODevice::WriteOnly);
		if( !file.isOpen() ) {
			mxWarnf("Failed to save layout to file '%s'.\n",ED_PATH_TO_APP_LAYOUT);
			return;
		}

		QDataStream	stream( &file );
		this->SerializeWidgetLayout(stream);
	}

	// Save current settings
	{
		FileWriter	file( ED_PATH_TO_APP_SETTINGS );
		if( file.IsOpen() )
		{
			TextWriter	archive;

			EdSystem::Get().settings.Serialize( archive );

			EdSystem::Get().Event_SerializeAppData( archive );

			archive.WriteAllToStream( file );
		}
	}
}
开发者ID:S-V,项目名称:Lollipop,代码行数:30,代码来源:app.cpp

示例2: Save

//-----------------------------------------------------------------------------
bool EdProject::Save()
{
	mxPutf("Saving project '%s'\n",m_name.ToChars());

	// serialize engine environment
	{
		ANSICHAR	levelFilePath[FS_MAX_PATH];
		F_Compose_File_Path( m_fullFilePath, PROJ_LEVEL_FILE_EXTENSION, levelFilePath );

		FileWriter	fileStream( levelFilePath );
		if( !fileStream.IsOpen() ) {
			return false;
		}

		TextObjectWriter	serializer;

		SEngineSaveArgs		saveArgs;
		saveArgs.serializer = &serializer;

		gEngine.SaveState( saveArgs );

		// write comment
		// @todo: project build options, engine version, etc.
		{
			const UINT numWorlds = Global_Level_Editor::Get().Num();

			String		comment;
			comment.Format("// Level file for \"%s\" (%u world(s))\n//",
				m_name.ToChars(), numWorlds );

			serializer.SetRootComment( comment );
		}

		serializer.WriteAllToStream( fileStream );
	}


	// Serialize project data
	{
		FileWriter	fileStream( m_fullFilePath );
		if( !fileStream.IsOpen() ) {
			return false;
		}

		TextWriter	serializer;
		{
			{
				serializer.Serialize_String( "Path_To_Asset_Database", m_assetDbFilePath );

				if( !m_assetDbFilePath.IsEmpty() )
				{
					m_assetMgr.SaveToFile( m_assetDbFilePath );
				}
			}
			EdSystem::Get().Event_SerializeProjectData( serializer );
		}
		serializer.WriteAllToStream( fileStream );
	}

	return true;
}
开发者ID:S-V,项目名称:Lollipop,代码行数:62,代码来源:project_manager.cpp


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