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


C++ stringw::c_str方法代码示例

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


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

示例1: showAboutText

/*
The three following functions do several stuff used by the mesh viewer. The
first function showAboutText() simply displays a messagebox with a caption and
a message text. The texts will be stored in the MessageText and Caption
variables at startup.
*/
void showAboutText()
{
	// create modal message box with the text
	// loaded from the xml file.
	Device->getGUIEnvironment()->addMessageBox(
		Caption.c_str(), MessageText.c_str());
}
开发者ID:amrzagloul,项目名称:BB10-Irrlicht-OGLES,代码行数:13,代码来源:main.cpp

示例2: getName

 /** Returns the name of this player. */
 core::stringw getName() const
 {
     #ifdef DEBUG
     assert(m_magic_number == 0xABCD1234);
     #endif
     return m_name.c_str();
 }   // getName
开发者ID:divvy81,项目名称:my-stk,代码行数:8,代码来源:player_profile.hpp

示例3: BindFunction

void BrowserWindowImpl::BindFunction(const core::stringw& name)
{
	Berkelium::WideString lval=Berkelium::WideString::point_to(name.c_str(),name.length());

	//m_window->bind(lval,Berkelium::Script::Variant());
	m_window->addBindOnStartLoading(lval,Berkelium::Script::Variant::bindFunction(lval,false));
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:7,代码来源:BrowserWindow.cpp

示例4: draw

void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position, video::SColor color, bool hcenter, bool vcenter, const core::rect<s32>* clip)
{
	if (!Driver)
		return;

	// Clear the glyph pages of their render information.
	for (u32 i = 0; i < Glyph_Pages.size(); ++i)
	{
		Glyph_Pages[i]->render_positions.clear();
		Glyph_Pages[i]->render_source_rects.clear();
	}

	// Set up some variables.
	core::dimension2d<s32> textDimension;
	core::position2d<s32> offset = position.UpperLeftCorner;

	// Determine offset positions.
	if (hcenter || vcenter)
	{
		textDimension = getDimension(text.c_str());

		if (hcenter)
			offset.X = ((position.getWidth() - textDimension.Width) >> 1) + offset.X;

		if (vcenter)
			offset.Y = ((position.getHeight() - textDimension.Height) >> 1) + offset.Y;
	}
开发者ID:niraj-rayalla,项目名称:PhysicsHelper,代码行数:27,代码来源:CGUITTFont.cpp

示例5: setCustomText

// -----------------------------------------------------------------------------
void SpinnerWidget::setCustomText(const core::stringw& text)
{
    m_customText = text;
    if (m_children.size() > 0)
    {
        m_children[1].m_element->setText(text.c_str());
    }
}
开发者ID:jubalh,项目名称:stk-code,代码行数:9,代码来源:spinner_widget.cpp

示例6: dbGetTextDimension

core::dimension2du dbGetTextDimension( const core::stringw& txt )
{

    DarkGDK_SGlobalStruct& app = DarkGDK_SGlobalStruct::getInstance();
    if (!app.Font)
		return core::dimension2du(0,0);

	return app.Font->getDimension( txt.c_str() );
}
开发者ID:benjaminhampe,项目名称:BenniSDK,代码行数:9,代码来源:libDarkGDK.cpp

示例7: fribidizeLine

core::stringw Translations::fribidizeLine(const core::stringw &str)
{
#if ENABLE_BIDI
    FriBidiChar *fribidiInput = toFribidiChar(str.c_str());
    std::size_t length = 0;
    while (fribidiInput[length])
        length++;

    // Assume right to left as start direction.
#if FRIBIDI_MINOR_VERSION==10
    // While the doc for older fribidi versions is somewhat sparse,
    // using the RIGHT-TO-LEFT EMBEDDING character here appears to
    // work correct.
    FriBidiCharType pbase_dir = L'\u202B';
#else
    FriBidiCharType pbase_dir = FRIBIDI_PAR_ON;
#endif

    // Reverse text line by line
    FriBidiChar *fribidiOutput = new FriBidiChar[length + 1];
    memset(fribidiOutput, 0, (length + 1) * sizeof(FriBidiChar));
    fribidi_boolean result = fribidi_log2vis(fribidiInput,
                                                length,
                                                &pbase_dir,
                                                fribidiOutput,
            /* gint   *position_L_to_V_list */ NULL,
            /* gint   *position_V_to_L_list */ NULL,
            /* gint8  *embedding_level_list */ NULL
                                                            );

    freeFribidiChar(fribidiInput);

    if (!result)
    {
        delete[] fribidiOutput;
        Log::error("Translations::fribidize", "Fribidi failed in 'fribidi_log2vis' =(");
        return core::stringw(str);
    }

    wchar_t *convertedString = fromFribidiChar(fribidiOutput);
    core::stringw converted_string(convertedString);
    freeFribidiChar(convertedString);
    delete[] fribidiOutput;
    return converted_string;

#else
    return core::stringw(str);
#endif // ENABLE_BIDI
}
开发者ID:TheDudeWithThreeHands,项目名称:A-StreamKart,代码行数:49,代码来源:translation.cpp

示例8: generateUniqueId

//------------------------------------------------------------------------------
PlayerProfile::PlayerProfile(const core::stringw& name) :
    m_player_group("Player", "Represents one human player"),
    m_name(name, "name", &m_player_group),
    m_is_guest_account(false, "guest", &m_player_group),
    m_use_frequency(0, "use_frequency", &m_player_group),
    m_unique_id("", "unique_id", &m_player_group)
{
#ifdef DEBUG
    m_magic_number = 0xABCD1234;
#endif
    int64_t unique_id = generateUniqueId(core::stringc(name.c_str()).c_str());

    std::ostringstream to_string;
    to_string << std::hex << unique_id;
    m_unique_id = to_string.str();
}
开发者ID:Shreesha-S,项目名称:stk-code,代码行数:17,代码来源:player.cpp

示例9: w_ngettext

/**
 * \param singular Message to translate in singular form
 * \param plural   Message to translate in plural form (can be the same as the singular form)
 * \param num      Count used to obtain the correct plural form.
 * \param context  Optional, can be set to differentiate 2 strings that are identical
 *                 in English but could be different in other languages
 */
const wchar_t* Translations::w_ngettext(const char* singular, const char* plural, int num, const char* context)
{
    const std::string& res = (context == NULL ?
                              m_dictionary.translate_plural(singular, plural, num) :
                              m_dictionary.translate_ctxt_plural(context, singular, plural, num));

    static core::stringw str_buffer;
    str_buffer = StringUtils::utf8ToWide(res);
    const wchar_t* out_ptr = str_buffer.c_str();
    if (REMOVE_BOM) out_ptr++;

#if TRANSLATE_VERBOSE
    std::wcout << L"  translation : " << out_ptr << std::endl;
#endif

    return out_ptr;
}
开发者ID:TheDudeWithThreeHands,项目名称:A-StreamKart,代码行数:24,代码来源:translation.cpp

示例10: Recreate

		void Recreate(int res, bool bold, bool italic, bool underline, const core::stringw& fontName)
		{
			if (font)
				DeleteFont(font);
			font = CreateFontW(
				res,
				0, 0, 0,
				bold ? FW_BOLD : 0,
				italic,
				underline,
				0,
				ANSI_CHARSET | ARABIC_CHARSET,
				OUT_DEFAULT_PRECIS,
				CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY,
				DEFAULT_PITCH | FF_SWISS,
				fontName.c_str());
			fontDirty = false;
		}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:19,代码来源:DynamicFontGenerator.cpp

示例11: dbText

void dbText( const core::stringw& txt, s32 x, s32 y, s32 hAlign = -1, s32 vAlign = -1 )
{
    DarkGDK_SGlobalStruct& app = DarkGDK_SGlobalStruct::getInstance();
    if (!app.Font)
		return;

	const core::dimension2du txt_size = app.Font->getDimension( txt.c_str() );

	// calculate final 2d-position for text ( top/left)
	core::position2di txt_pos(x,y);

	// horizontal align
	if (hAlign == 0)
	{
		txt_pos.X -= (s32)txt_size.Width / 2;
	}
	else if (hAlign == 1)
	{
		txt_pos.X -= (s32)txt_size.Width;
	}

	// vertical align
	if (vAlign == 0)
	{
		txt_pos.Y -= (s32)txt_size.Height / 2;
	}
	else if (vAlign == 1)
	{
		txt_pos.Y -= (s32)txt_size.Height;
	}

	DarkGDK_SText2d tmp;
	tmp.Font = app.Font;
	tmp.Text = txt;
	tmp.Position = core::recti( txt_pos, txt_size);
	tmp.FGColor = app.TextForeColor;
	tmp.BGColor = app.TextBackColor;

	app.Texts.push_back( tmp );
}
开发者ID:benjaminhampe,项目名称:BenniSDK,代码行数:40,代码来源:libDarkGDK.cpp

示例12: w_gettext

/**
 * \param original Message to translate
 * \param context  Optional, can be set to differentiate 2 strings that are identical
 *                 in English but could be different in other languages
 */
const wchar_t* Translations::w_gettext(const char* original, const char* context)
{
    if (original[0] == '\0') return L"";

#if TRANSLATE_VERBOSE
    Log::info("Translations", "Translating %s", original);
#endif

    const std::string& original_t = (context == NULL ?
                                     m_dictionary.translate(original) :
                                     m_dictionary.translate_ctxt(context, original));

    if (original_t == original)
    {
        static irr::core::stringw converted_string;
        converted_string = StringUtils::utf8ToWide(original);

#if TRANSLATE_VERBOSE
        std::wcout << L"  translation : " << converted_string << std::endl;
#endif
        return converted_string.c_str();
    }

    // print
    //for (int n=0;; n+=4)

    static core::stringw original_tw;
    original_tw = StringUtils::utf8ToWide(original_t);

    const wchar_t* out_ptr = original_tw.c_str();
    if (REMOVE_BOM) out_ptr++;

#if TRANSLATE_VERBOSE
    std::wcout << L"  translation : " << out_ptr << std::endl;
#endif

    return out_ptr;
}
开发者ID:TheDudeWithThreeHands,项目名称:A-StreamKart,代码行数:43,代码来源:translation.cpp

示例13: init

 /** Init the message text, do linebreak as required. */
 void init()
 {
     const GUIEngine::BoxRenderParams &brp =
         GUIEngine::getSkin()->getBoxRenderParams(m_render_type);
     const unsigned width = irr_driver->getActualScreenSize().Width;
     const unsigned height = irr_driver->getActualScreenSize().Height;
     const unsigned max_width = width - (brp.m_left_border +
         brp.m_right_border);
     m_text =
         GUIEngine::getGUIEnv()->addStaticText(m_message.c_str(),
         core::recti(0, 0, max_width, height));
     m_text->setRightToLeft(translations->isRTLText(m_message));
     core::dimension2du dim(m_text->getTextWidth(),
         m_text->getTextHeight());
     dim.Width += brp.m_left_border + brp.m_right_border;
     int x = (width - dim.Width) / 2;
     int y = height - int(1.5f * dim.Height);
     g_area = irr::core::recti(x, y, x + dim.Width, y + dim.Height);
     m_text->setRelativePosition(g_area);
     m_text->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_CENTER);
     m_text->grab();
     m_text->remove();
 }
开发者ID:nado,项目名称:stk-code,代码行数:24,代码来源:message_queue.cpp

示例14: draw

//! draws an text and clips it to the specified rectangle if wanted
void CGUITTFont::draw(const core::stringw& text_, const core::rect<s32>& position, video::SColor color, bool hcenter, bool vcenter, const core::rect<s32>* clip)
{
    const wchar_t* text = text_.c_str();
	if (!Driver)
		return;

	core::dimension2d<u32> textDimension;
	core::position2d<s32> offset = position.UpperLeftCorner;
	video::SColor colors[4];
	for (int i = 0;i < 4;i++){
		colors[i] = color;
	}

    if (hcenter || vcenter)
	{
		textDimension = getDimension(text);

		if (hcenter)
			offset.X = ((position.getWidth() - textDimension.Width)>>1) + offset.X;

		if (vcenter)
			offset.Y = ((position.getHeight() - textDimension.Height)>>1) + offset.Y;
	}
开发者ID:dayjaby,项目名称:ennea,代码行数:24,代码来源:CGUITTFont.cpp

示例15: setCutsceneText

//Set the cutscene text ingame GUI
void GUIGame::setCutsceneText(core::stringw text)
{
	IGUIStaticText* guitext=(IGUIStaticText*)GUIManager::getInstance()->getGUIElement(GUIManager::ST_ID_CUTSCENE_TEXT);
	guitext->setText(text.c_str());
}
开发者ID:kcuzner,项目名称:irrrpgbuilder,代码行数:6,代码来源:CUIGame.cpp


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