本文整理汇总了C++中StringRef::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::Get方法的具体用法?C++ StringRef::Get怎么用?C++ StringRef::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringRef
的用法示例。
在下文中一共展示了StringRef::Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteImageTexture
void WriteImageTexture(FILE *fph,const StringRef &name,
VFormatOptions &options,bool lightmap, bool clamp= false)
{
// texture node already defined ?
TextureDefMap::iterator found;
found = options.textureDefMap.find(name);
if ( found != options.textureDefMap.end()) { // simply use it
fprintf(fph,"USE %s\n",(const char *)(*found).second );
}
else
{ // need to define new imageTexture node
char buf[60];
sprintf(buf,"_T%d",options.textureCount);
options.textureCount++;
fprintf(fph,"DEF %s ImageTexture {\n",(const char *)buf);
if (clamp) fprintf(fph,"\trepeatS FALSE repeatT FALSE\n");
const char *ext="bmp";
if (options.usePng)
ext = "png";
if (!lightmap) {
String textureFileName;
// check and return jpg, png ..
CheckTexture(name, textureFileName);
fprintf(fph," url %c%s%c\n",0x22,textureFileName.c_str(),0x22);
} else
fprintf(fph," url %c%s.%s%c\n",0x22,name.Get(),ext,0x22);
fprintf(fph,"}\n");
// insert new node into map
options.textureDefMap.insert(TextureDefMap::value_type(name,buf));
}
}
示例2: CommandLine
//==================================================================================
int CommandParser::CommandLine(int argc,const char **argv,bool fallbackok)
{
int ret = 0;
if ( argc )
{
TokenMap::iterator found;
StringRef ref = SGET(argv[0]);
found = mTokens.find( ref );
if ( found == mTokens.end() )
{
// do case - insenstive search
for (found=mTokens.begin(); found!=mTokens.end(); ++found)
{
if ( stricmp( (*found).first.Get(), ref.Get() ) == 0 ) break;
}
}
if ( found != mTokens.end() )
{
TokenTag ttype = (*found).second;
if ( 0 )
{
for (int i=0; i<argc; i++)
{
gAllGlobals.gLog.ref()->Display("%s ", argv[i] );
}
gAllGlobals.gLog.ref()->Display("\n");
}
CommandParserInterface *cmd = ttype.GetService();
int v = cmd->CommandCallback( ttype.GetLocalToken(), argc, argv );
if ( v )
ret = v;
}
else
{
if ( mFallbacks.empty() || !fallbackok )
{
#if LOG_ERROR
if ( gAllGlobals.gLog.ref() )
{
// gAllGlobals.gLog.ref()->Display("CPARSER(%s)???\n", argv[0] );
}
#endif
}
else
{
CommandParserInterfaceVector::iterator i;
for (i=mFallbacks.begin(); i!=mFallbacks.end(); ++i)
{
CommandParserInterface *iface = (*i);
int v = iface->CommandFallback(argc,argv);
if ( v ) ret = v;
}
}
}
}
return ret;
}