本文整理汇总了C++中FileStream::writeText方法的典型用法代码示例。如果您正苦于以下问题:C++ FileStream::writeText方法的具体用法?C++ FileStream::writeText怎么用?C++ FileStream::writeText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileStream
的用法示例。
在下文中一共展示了FileStream::writeText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpEngineDocs
static bool dumpEngineDocs( const char *outputFile )
{
// Create the output stream.
FileStream stream;
if ( !stream.open( outputFile, Torque::FS::File::Write ) )
{
Con::errorf( "dumpEngineDocs - Failed to open output file." );
return false;
}
// First dump all global ConsoleDoc fragments.
for( ConsoleDocFragment* fragment = ConsoleDocFragment::smFirst; fragment != NULL; fragment = fragment->mNext )
if( !fragment->mClass )
dumpFragment( stream, fragment );
// Clear the doc groups before continuing,
smDocGroups.clear();
// Dump enumeration types.
dumpEnums( stream );
// Dump all global variables.
dumpVariables( stream );
// Now dump the global functions.
Namespace *g = Namespace::find( NULL );
while( g )
{
dumpNamespaceEntries( stream, g );
// Dump callbacks.
dumpGroupStart( stream, "Callbacks" );
dumpNamespaceEntries( stream, g, true );
dumpGroupEnd( stream );
g = g->mParent;
}
// Now dump all the classes.
dumpClasses( stream );
// Dump pre-declarations for any groups we encountered
// so that we don't have to explicitly define them.
HashTable<String,U32>::Iterator iter = smDocGroups.begin();
for ( ; iter != smDocGroups.end(); iter++ )
stream.writeText( String::ToString( "/*! @addtogroup %s */\r\n\r\n", iter->key.c_str() ) );
return true;
}
示例2: _loadShaderFromStream
bool GFXGLShader::_loadShaderFromStream( GLuint shader,
const Torque::Path &path,
FileStream *s,
const Vector<GFXShaderMacro> ¯os )
{
Vector<char*> buffers;
Vector<U32> lengths;
// The GLSL version declaration must go first!
const char *versionDecl = "#version 150\r\n";
buffers.push_back( dStrdup( versionDecl ) );
lengths.push_back( dStrlen( versionDecl ) );
if(GFXGL->mCapabilities.shaderModel5)
{
const char *extension = "#extension GL_ARB_gpu_shader5 : enable\r\n";
buffers.push_back( dStrdup( extension ) );
lengths.push_back( dStrlen( extension ) );
}
const char *newLine = "\r\n";
buffers.push_back( dStrdup( newLine ) );
lengths.push_back( dStrlen( newLine ) );
// Now add all the macros.
for( U32 i = 0; i < macros.size(); i++ )
{
if(macros[i].name.isEmpty()) // TODO OPENGL
continue;
String define = String::ToString( "#define %s %s\n", macros[i].name.c_str(), macros[i].value.c_str() );
buffers.push_back( dStrdup( define.c_str() ) );
lengths.push_back( define.length() );
}
// Now finally add the shader source.
U32 shaderLen = s->getStreamSize();
char *buffer = _handleIncludes(path, s);
if ( !buffer )
return false;
buffers.push_back(buffer);
lengths.push_back(shaderLen);
glShaderSource(shader, buffers.size(), (const GLchar**)const_cast<const char**>(buffers.address()), NULL);
#if defined(TORQUE_DEBUG) && defined(TORQUE_DEBUG_GFX)
FileStream stream;
if ( !stream.open( path.getFullPath()+"_DEBUG", Torque::FS::File::Write ) )
{
AssertISV(false, avar("GFXGLShader::initShader - failed to write debug shader '%s'.", path.getFullPath().c_str()));
}
for(int i = 0; i < buffers.size(); ++i)
stream.writeText(buffers[i]);
#endif
// Cleanup the shader source buffer.
for ( U32 i=0; i < buffers.size(); i++ )
dFree( buffers[i] );
glCompileShader(shader);
return true;
}