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


C++ String::CString方法代码示例

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


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

示例1: HighlightItem

void RocketMenuPlugin::HighlightItem(Rocket::Core::Context *context, const Rocket::Core::String& docId, const Rocket::Core::String& elementId) {
    Rocket::Core::ElementDocument *doc = context->GetDocument(docId);
    if (doc != NULL) {
        HighlightItem(doc, elementId);
    } else {
        printf("[ROCK] RocketMenuPlugin::HighlightItem: unable to find document with id='%s'\n", docId.CString());
    }
}
开发者ID:ppiecuch,项目名称:libRocket,代码行数:8,代码来源:RocketMenuPlugin.cpp

示例2: HighlightPreviousItem

void RocketMenuPlugin::HighlightPreviousItem(Rocket::Core::Context *context, const Rocket::Core::String& docId) {
    Rocket::Core::ElementDocument *doc = NULL;
    if (docId == "") {
        ContextData *cd = GetContextData(context);
        doc = cd->current_document;
    } else {
        doc = context->GetDocument(docId);
    }
    if (doc != NULL) {
        HighlightPreviousItem(doc);
    } else {
        printf("[ROCK] RocketMenuPlugin::HighlightPreviousItem: document not found: %s\n", docId.CString());
    }
}
开发者ID:ppiecuch,项目名称:libRocket,代码行数:14,代码来源:RocketMenuPlugin.cpp

示例3: Open

	Rocket::Core::FileHandle Open( const Rocket::Core::String &filePath )
	{
		fileHandle_t fileHandle;
		FS_FOpenFileRead( filePath.CString(), &fileHandle, false );
		return ( Rocket::Core::FileHandle )fileHandle;
	}
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:6,代码来源:rocket.cpp

示例4: if


//.........这里部分代码省略.........
			out.Append( span && spanHasContent ? "</span><br />" : "<br />" );
			span = false;
			spanHasContent = false;
		}
		else if ( Q_IsColorString( p ) )
		{
			if ( span && spanHasContent )
			{
				out.Append( "</span>" );
				span = false;
				spanHasContent = false;
			}

			char rgb[32];
			int code = ColorIndex( *++p );

			Com_sprintf( rgb, sizeof( rgb ), "<span style='color: #%02X%02X%02X;'>",
			          (int)( g_color_table[ code ][ 0 ] * 255 ),
			          (int)( g_color_table[ code ][ 1 ] * 255 ),
			          (int)( g_color_table[ code ][ 2 ] * 255 ) );

			// don't add the span yet, because it might be empty
			spanstr = rgb;

			span = true;
			spanHasContent = false;
		}
		else
		{
			if ( span && !spanHasContent )
			{
				out.Append( spanstr );
				spanHasContent = true;
			}
			out.Append( *p );
		}
	}

	if ( span && spanHasContent )
	{
		out.Append( "</span>" );
	}

	// ^^ -> ^
	while ( out.Find( "^^" ) != Rocket::Core::String::npos )
	{
		out = out.Replace( "^^", "^" );
	}

	if ( parseFlags & RP_EMOTICONS )
	{
		// Parse emoticons
		size_t openBracket = 0;
		size_t closeBracket = 0;
		size_t currentPosition = 0;

		while ( 1 )
		{
			Rocket::Core::String emoticon;
			const char *path;

			openBracket = out.Find( "[", currentPosition );
			if ( openBracket == Rocket::Core::String::npos )
			{
				break;
			}

			closeBracket = out.Find( "]", openBracket );
			if ( closeBracket == Rocket::Core::String::npos )
			{
				break;
			}

			emoticon = out.Substring( openBracket + 1, closeBracket - openBracket - 1 );

			// Certain characters are invalid
			if ( emoticon.Empty() || IsInvalidEmoticon( emoticon ) )
			{
				currentPosition = closeBracket + 1;
				continue;
			}

			// TODO: Dont hardcode the extension.
			path =  va( "emoticons/%s.crn", emoticon.CString() );
			if ( FS_FOpenFileRead( path, nullptr, true ) )
			{
				out.Erase( openBracket, closeBracket - openBracket + 1 );
				path = va( "<img class='trem-emoticon' src='/emoticons/%s' />", emoticon.CString() );
				out.Insert( openBracket, path );
				currentPosition = openBracket + strlen( path ) + 1;
			}
			else
			{
				currentPosition = closeBracket + 1;
			}
		}
	}

	return out;
}
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:101,代码来源:rocket.cpp

示例5: TranslateString

	int TranslateString( Rocket::Core::String &translated, const Rocket::Core::String &input )
	{
		const char* ret = Trans_GettextGame( input.CString() );
		translated = ret;
		return 0;
	}
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:6,代码来源:rocket.cpp

示例6: LogMessage

bool RocketInterface::LogMessage(Rocket::Core::Log::Type type, const Rocket::Core::String& message)
{
    assert(Log::ptr());
    LOG << "[librocket]: " << message.CString();
    return false;
}
开发者ID:JamesLinus,项目名称:dawnengine,代码行数:6,代码来源:RocketInterface.cpp


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