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


C++ TextFile::writeText方法代码示例

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


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

示例1: cuT

	bool Geometry::TextWriter::operator()( Geometry const & geometry, TextFile & file )
	{
		bool result{ true };

		if ( geometry.getMesh() )
		{
			Logger::logInfo( m_tabs + cuT( "Writing Geometry " ) + geometry.getName() );
			result = file.writeText( cuT( "\n" ) + m_tabs + cuT( "object \"" ) + geometry.getName() + cuT( "\"\n" ) ) > 0
					   && file.writeText( m_tabs + cuT( "{\n" ) ) > 0;
			castor::TextWriter< Geometry >::checkError( result, "Geometry name" );

			if ( result )
			{
				result = MovableObject::TextWriter{ m_tabs + cuT( "\t" ) }( geometry, file );
			}

			if ( result )
			{
				result = RenderedObject::TextWriter{ m_tabs + cuT( "\t" ) }( geometry, file );
			}

			if ( result )
			{
				result = file.writeText( m_tabs + cuT( "\tmesh \"" ) + geometry.getMesh()->getName() + cuT( "\"\n" ) ) > 0;
				castor::TextWriter< Geometry >::checkError( result, "Geometry mesh" );
			}

			if ( result )
			{
				result = file.writeText( m_tabs + cuT( "\tmaterials\n" ) ) > 0
						   && file.writeText( m_tabs + cuT( "\t{\n" ) ) > 0;
				castor::TextWriter< Geometry >::checkError( result, "Geometry materials" );

				if ( result )
				{
					uint16_t index{ 0u };

					for ( auto submesh : *geometry.getMesh() )
					{
						result &= file.writeText( m_tabs + cuT( "\t\tmaterial " ) + string::toString( index++ ) + cuT( " \"" ) + geometry.getMaterial( *submesh )->getName() + cuT( "\"\n" ) ) > 0;
						castor::TextWriter< Geometry >::checkError( result, "Geometry material" );
					}

					if ( result )
					{
						result = file.writeText( m_tabs + cuT( "\t}\n" ) ) > 0;
					}
				}
			}

			if ( result )
			{
				result = file.writeText( m_tabs + cuT( "}\n" ) ) > 0;
			}
		}

		return result;
	}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:58,代码来源:Geometry.cpp

示例2: cuT

	bool UniformBuffer::TextWriter::operator()( UniformBuffer const & object, TextFile & file )
	{
		bool result = file.writeText( m_tabs + cuT( "constants_buffer \"" ) + object.getName() + cuT( "\"\n" ) ) > 0
						&& file.writeText( m_tabs + cuT( "{\n" ) ) > 0;
		checkError( result, "Frame variable buffer" );
		auto tabs = m_tabs + cuT( "\t" );

		if ( result )
		{
			for ( auto & variable : object )
			{
				if ( result )
				{
					result = file.writeText( tabs + cuT( "variable \"" ) + variable->getName() + cuT( "\"\n" ) ) > 0
						&& file.writeText( tabs + cuT( "{\n" ) ) > 0;
					checkError( result, "Frame variable buffer variable name" );
				}

				if ( result )
				{
					result = file.writeText( tabs + cuT( "\tcount " ) + string::toString( variable->getOccCount() ) + cuT( "\n" ) ) > 0;
					checkError( result, "Frame variable buffer variable occurences" );
				}

				if ( result )
				{
					result = file.writeText( tabs + cuT( "\ttype " ) + variable->getFullTypeName() + cuT( "\n" ) ) > 0;
					checkError( result, "Frame variable buffer variable type name" );
				}

				if ( result )
				{
					result = file.writeText( tabs + cuT( "\tvalue " ) + variable->getStrValue() + cuT( "\n" ) ) > 0;
					checkError( result, "Frame variable buffer variable value" );
				}

				if ( result )
				{
					result = file.writeText( tabs + cuT( "}\n" ) ) > 0;
					checkError( result, "Frame variable buffer variable end" );
				}
			}
		}

		if ( result )
		{
			result = file.writeText( m_tabs + cuT( "}\n" ) ) > 0;
			checkError( result, "Frame variable buffer end" );
		}

		return result;
	}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:52,代码来源:UniformBuffer.cpp

示例3: cuT

	bool OverlayCategory::TextWriter::operator()( OverlayCategory const & p_overlay, TextFile & p_file )
	{
		bool result = p_file.writeText( m_tabs + cuT( "\tposition " ) ) > 0
						&& Point2d::TextWriter{ String{} }( p_overlay.getPosition(), p_file )
						&& p_file.writeText( cuT( "\n" ) ) > 0;
		castor::TextWriter< OverlayCategory >::checkError( result, "OverlayCategory position" );

		if ( result )
		{
			result = p_file.writeText( m_tabs + cuT( "\tsize " ) ) > 0
					   && Point2d::TextWriter{ String{} }( p_overlay.getSize(), p_file )
					   && p_file.writeText( cuT( "\n" ) ) > 0;
			castor::TextWriter< OverlayCategory >::checkError( result, "OverlayCategory size" );
		}

		if ( result && p_overlay.getMaterial() )
		{
			result = p_file.writeText( m_tabs + cuT( "\tmaterial \"" ) + p_overlay.getMaterial()->getName() + cuT( "\"\n" ) ) > 0;
			castor::TextWriter< OverlayCategory >::checkError( result, "OverlayCategory material" );
		}

		for ( auto overlay : p_overlay.getOverlay() )
		{
			switch ( overlay->getType() )
			{
			case OverlayType::ePanel:
				result &= PanelOverlay::TextWriter( m_tabs + cuT( "\t" ) )( *overlay->getPanelOverlay(), p_file );
				break;

			case OverlayType::eBorderPanel:
				result &= BorderPanelOverlay::TextWriter( m_tabs + cuT( "\t" ) )( *overlay->getBorderPanelOverlay(), p_file );
				break;

			case OverlayType::eText:
				result &= TextOverlay::TextWriter( m_tabs + cuT( "\t" ) )( *overlay->getTextOverlay(), p_file );
				break;

			default:
				result = false;
			}
		}

		return result;
	}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:44,代码来源:OverlayCategory.cpp

示例4: cuT

	bool ShaderObject::TextWriter::operator()( ShaderObject const & p_shaderObject, TextFile & p_file )
	{
		bool result = p_file.writeText( m_tabs + p_shaderObject.getStrType() + cuT( "\n" ) ) > 0
						&& p_file.writeText( m_tabs + cuT( "{\n" ) ) > 0;

		Path pathFile = p_file.getFilePath() / cuT( "Shaders" );

		if ( !File::directoryExists( pathFile ) )
		{
			File::directoryCreate( pathFile );
		}

		bool hasFile = false;

		if ( result )
		{
			Path file = p_shaderObject.getFile();

			if ( !file.empty() )
			{
				File::copyFile( file, pathFile );
				String fileName = Path{ cuT( "Shaders" ) } / file.getFileName() + cuT( "." ) + file.getExtension();
				string::replace( fileName, cuT( "\\" ), cuT( "/" ) );
				result = p_file.writeText( m_tabs + cuT( "\tfile \"" ) + fileName + cuT( "\"\n" ) ) > 0;
				castor::TextWriter< ShaderObject >::checkError( result, "ShaderObject file" );
			}
		}

		if ( hasFile )
		{
			for ( auto it : p_shaderObject.getUniforms() )
			{
				result = Uniform::TextWriter( m_tabs + cuT( "\t" ) )( it->getBaseUniform(), p_file );
			}
		}

		if ( result )
		{
			result = p_file.writeText( m_tabs + cuT( "}\n" ) ) > 0;
		}

		return result;
	}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:43,代码来源:ShaderObject.cpp

示例5: cuT

	bool LightCategory::TextWriter::operator()( LightCategory const & p_light, TextFile & p_file )
	{
		static std::map< LightType, String > type
		{
			{ LightType::eDirectional, cuT( "directional" ) },
			{ LightType::ePoint, cuT( "point" ) },
			{ LightType::eSpot, cuT( "spot" ) },
		};

		Logger::logInfo( m_tabs + cuT( "Writing Light " ) + p_light.getLight().getName() );
		bool result = p_file.writeText( cuT( "\n" ) + m_tabs + cuT( "light \"" ) + p_light.getLight().getName() + cuT( "\"\n" ) ) > 0
						&& p_file.writeText( m_tabs + cuT( "{\n" ) ) > 0;
		castor::TextWriter< LightCategory >::checkError( result, "LightCategory name" );

		if ( result )
		{
			result = MovableObject::TextWriter{ m_tabs + cuT( "\t" ) }( p_light.getLight(), p_file );
		}

		if ( result )
		{
			result = p_file.writeText( m_tabs + cuT( "\ttype " ) + type[p_light.getLightType()] + cuT( "\n" ) ) > 0;
			castor::TextWriter< LightCategory >::checkError( result, "LightCategory type" );
		}

		if ( result )
		{
			result = p_file.writeText( m_tabs + cuT( "\tcolour " ) ) > 0
					   && Point3f::TextWriter( String{} )( p_light.getColour(), p_file )
					   && p_file.writeText( cuT( "\n" ) ) > 0;
			castor::TextWriter< LightCategory >::checkError( result, "LightCategory colour" );
		}

		if ( result )
		{
			result = p_file.writeText( m_tabs + cuT( "\tintensity " ) ) > 0
					   && Point2f::TextWriter( String{} )( p_light.getIntensity(), p_file )
					   && p_file.writeText( cuT( "\n" ) ) > 0;
			castor::TextWriter< LightCategory >::checkError( result, "LightCategory intensity" );
		}

		if ( result && p_light.getLight().isShadowProducer() )
		{
			result = p_file.writeText( m_tabs + cuT( "\tshadow_producer true\n" ) ) > 0;
			castor::TextWriter< LightCategory >::checkError( result, "LightCategory shadow producer" );
		}

		return result;
	}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:49,代码来源:LightCategory.cpp

示例6: cuT

	bool SceneNode::TextWriter::operator()( SceneNode const & node, TextFile & file )
	{
		bool result = node.getName() == cuT( "RootNode" )
			|| node.getName() == cuT( "ObjectRootNode" )
			|| node.getName() == cuT( "CameraRootNode" );

		if ( node.getName() != cuT( "RootNode" )
			 && node.getName() != cuT( "ObjectRootNode" )
			 && node.getName() != cuT( "CameraRootNode" ) )
		{
			Logger::logInfo( m_tabs + cuT( "Writing Node " ) + node.getName() );
			result = file.writeText( cuT( "\n" ) + m_tabs + cuT( "scene_node \"" ) + node.getName() + cuT( "\"\n" ) ) > 0
					   && file.writeText( m_tabs + cuT( "{\n" ) ) > 0;
			castor::TextWriter< SceneNode >::checkError( result, "Node name" );

			if ( result
				&& node.getParent()
				&& node.getParent()->getName() != cuT( "RootNode" )
				&& node.getParent()->getName() != cuT( "ObjectRootNode" )
				&& node.getParent()->getName() != cuT( "CameraRootNode" ) )
			{
				result = file.writeText( m_tabs + cuT( "\tparent \"" ) + node.getParent()->getName() + cuT( "\"\n" ) ) > 0;
				castor::TextWriter< SceneNode >::checkError( result, "Node parent name" );
			}

			if ( result )
			{
				result = file.print( 256, cuT( "%s\torientation " ), m_tabs.c_str() ) > 0
						   && Quaternion::TextWriter( String() )( node.getOrientation(), file )
						   && file.writeText( cuT( "\n" ) ) > 0;
				castor::TextWriter< SceneNode >::checkError( result, "Node orientation" );
			}

			if ( result )
			{
				result = file.print( 256, cuT( "%s\tposition " ), m_tabs.c_str() ) > 0
						   && Point3r::TextWriter( String() )( node.getPosition(), file )
						   && file.writeText( cuT( "\n" ) ) > 0;
				castor::TextWriter< SceneNode >::checkError( result, "Node position" );
			}

			if ( result )
			{
				result = file.print( 256, cuT( "%s\tscale " ), m_tabs.c_str() ) > 0
						   && Point3r::TextWriter( String() )( node.getScale(), file )
						   && file.writeText( cuT( "\n" ) ) > 0;
				castor::TextWriter< SceneNode >::checkError( result, "Node scale" );
			}

			if ( result )
			{
				result = file.writeText( m_tabs + cuT( "}\n" ) ) > 0;
				castor::TextWriter< SceneNode >::checkError( result, "Node end" );
			}
		}

		if ( result )
		{
			for ( auto const & it : node.m_children )
			{
				if ( result
					 && it.first.find( cuT( "_REye" ) ) == String::npos
					 && it.first.find( cuT( "_LEye" ) ) == String::npos )
				{
					SceneNodeSPtr node = it.second.lock();

					if ( node )
					{
						result = SceneNode::TextWriter{ m_tabs }( *node, file );
					}
				}
			}
		}

		return result;
	}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:76,代码来源:SceneNode.cpp


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