您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wstring_to_utf8str函数代码示例

51自学网 2021-06-03 10:08:24
  C++
这篇教程C++ wstring_to_utf8str函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wstring_to_utf8str函数的典型用法代码示例。如果您正苦于以下问题:C++ wstring_to_utf8str函数的具体用法?C++ wstring_to_utf8str怎么用?C++ wstring_to_utf8str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: if

// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.// Otherwise returns input and channel 0.LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel){	if (mesg[0] == '/'		&& mesg[1] == '/')	{		// This is a "repeat channel send"		*channel = mLastSpecialChatChannel;		return mesg.substr(2, mesg.length() - 2);	}	else if (mesg[0] == '/'			 && mesg[1]			 && ( LLStringOps::isDigit(mesg[1]) 				|| mesg[1] == '-' ))	{		// This a special "/20" speak on a channel		S32 pos = 0;		if(mesg[1] == '-')			pos++;		// Copy the channel number into a string		LLWString channel_string;		llwchar c;		do		{			c = mesg[pos+1];			channel_string.push_back(c);			pos++;		}		while(c && pos < 64 && LLStringOps::isDigit(c));				// Move the pointer forward to the first non-whitespace char		// Check isspace before looping, so we can handle "/33foo"		// as well as "/33 foo"		while(c && iswspace(c))		{			c = mesg[pos+1];			pos++;		}				mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);		if(mesg[1] == '-')			mLastSpecialChatChannel = -mLastSpecialChatChannel;		*channel = mLastSpecialChatChannel;		return mesg.substr(pos, mesg.length() - pos);	}	else	{		// This is normal chat.		*channel = 0;		return mesg;	}}
开发者ID:Apelsin,项目名称:EffervescenceViewer,代码行数:53,


示例2: stripChannelNumber

// <dogmode>void LLChatBar::sendChat( EChatType type ){	if (mInputEditor)	{		LLWString text = mInputEditor->getConvertedText();		if (!text.empty())		{			// store sent line in history, duplicates will get filtered			if (mInputEditor) mInputEditor->updateHistory();			S32 channel = 0;			stripChannelNumber(text, &channel);						std::string utf8text = wstring_to_utf8str(text);//+" and read is "+llformat("%f",readChan)+" and undone is "+llformat("%d",undoneChan)+" but actualy channel is "+llformat("%d",channel);			// Try to trigger a gesture, if not chat to a script.			std::string utf8_revised_text;			if (0 == channel)			{				convert_roleplay_text(utf8text);				// discard returned "found" boolean				LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);			}			else			{				utf8_revised_text = utf8text;			}			utf8_revised_text = utf8str_trim(utf8_revised_text);			EChatType nType(type == CHAT_TYPE_OOC ? CHAT_TYPE_NORMAL : type);			if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, nType))			{				// Chat with animation#if SHY_MOD //Command handler				if(!SHCommandHandler::handleCommand(true, utf8_revised_text, gAgentID, (LLViewerObject*)gAgentAvatarp))//returns true if handled#endif //shy_mod				sendChatFromViewer(utf8_revised_text, nType, TRUE);			}		}	}	childSetValue("Chat Editor", LLStringUtil::null);	gAgent.stopTyping();	// If the user wants to stop chatting on hitting return, lose focus	// and go out of chat mode.	if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))	{		stopChat();	}}
开发者ID:Apelsin,项目名称:EffervescenceViewer,代码行数:52,


示例3: getChildList

BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen){	for (child_list_const_iter_t child_iter = getChildList()->begin();			child_iter != getChildList()->end(); ++child_iter)	{		LLView *viewp = *child_iter;		S32 local_x = x - viewp->getRect().mLeft;		S32 local_y = y - viewp->getRect().mBottom;		if( viewp->pointInView(local_x, local_y) 			&& viewp->getVisible() 			&& viewp->getEnabled()			&& viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen ) )		{			return TRUE;		}	}	if( mSegments.empty() )	{		return TRUE;	}	const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );	if( cur_segment )	{		BOOL has_tool_tip = FALSE;		if( cur_segment->getStyle()->getIsEmbeddedItem() )		{			LLWString wtip;			has_tool_tip = getEmbeddedItemToolTipAtPos(cur_segment->getStart(), wtip);			msg = wstring_to_utf8str(wtip);		}		else		{			has_tool_tip = cur_segment->getToolTip( msg );		}		if( has_tool_tip )		{			// Just use a slop area around the cursor			// Convert rect local to screen coordinates			S32 SLOP = 8;			localPointToScreen( 				x - SLOP, y - SLOP, 				&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );			sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;			sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;		}	}	return TRUE;}
开发者ID:Ratany,项目名称:SingularityViewer,代码行数:50,


示例4: stripChannelNumber

void LLNearbyChatBar::sendChat( EChatType type ){	if (mChatBox)	{		LLWString text = mChatBox->getConvertedText();		if (!text.empty())		{			// store sent line in history, duplicates will get filtered			mChatBox->updateHistory();			// Check if this is destined for another channel			S32 channel = 0;			stripChannelNumber(text, &channel);						std::string utf8text = wstring_to_utf8str(text);			// Try to trigger a gesture, if not chat to a script.			std::string utf8_revised_text;			if (0 == channel)			{				// discard returned "found" boolean				LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);			}			else			{				utf8_revised_text = utf8text;			}			utf8_revised_text = utf8str_trim(utf8_revised_text);			type = processChatTypeTriggers(type, utf8_revised_text);			if (!utf8_revised_text.empty())			{				// Chat with animation				sendChatFromViewer(utf8_revised_text, type, TRUE);			}		}		mChatBox->setText(LLStringExplicit(""));	}	gAgent.stopTyping();	// If the user wants to stop chatting on hitting return, lose focus	// and go out of chat mode.	if (gSavedSettings.getBOOL("CloseChatOnReturn"))	{		stopChat();	}}
开发者ID:Katharine,项目名称:kittyviewer,代码行数:49,


示例5: LL_DEBUGS

void LLFloaterAutoReplaceSettings::onSaveEntry(){	LL_DEBUGS("AutoReplace")<<"called"<<LL_ENDL;		if ( ! mPreviousKeyword.empty() )	{		// delete any existing value for the key that was editted		LL_INFOS("AutoReplace")			<< "list '" << mSelectedListName << "' "			<< "removed '" << mPreviousKeyword			<< "'" << LL_ENDL;		mSettings.removeEntryFromList( mPreviousKeyword, mSelectedListName );	}	LLWString keyword     = mKeyword->getWText();	LLWString replacement = mReplacement->getWText();	if ( mSettings.addEntryToList(keyword, replacement, mSelectedListName) )	{		// insert the new keyword->replacement pair		LL_INFOS("AutoReplace")			<< "list '" << mSelectedListName << "' "			<< "added '" << wstring_to_utf8str(keyword)			<< "' -> '" << wstring_to_utf8str(replacement)			<< "'" << LL_ENDL;		updateReplacementsList();	}	else	{		LLNotificationsUtil::add("InvalidAutoReplaceEntry");		LL_WARNS("AutoReplace")<<"invalid entry "							   << "keyword '" << wstring_to_utf8str(keyword)							   << "' replacement '" << wstring_to_utf8str(replacement)							   << "'" << LL_ENDL;	}}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:36,


示例6: llmin

// Copies escaped URL to clipboardvoid LLURLLineEditor::copyEscapedURLToClipboard(){	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );	S32 length = llabs( mSelectionStart - mSelectionEnd );	const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));	LLWString text_to_copy;	// *HACK: Because LLSLURL is currently broken we cannot use it to check if unescaped_text is a valid SLURL (see EXT-8335).	if (LLStringUtil::startsWith(unescaped_text, "http://")) // SLURL		text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));	else // human-readable location		text_to_copy = utf8str_to_wstring(unescaped_text);			gClipboard.copyFromString( text_to_copy );}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:16,


示例7: stripChannelNumber

void LLChatBar::sendChat( EChatType type ){	if (mInputEditor)	{		LLWString text = mInputEditor->getConvertedText();		if (!text.empty())		{			// store sent line in history, duplicates will get filtered			if (mInputEditor) mInputEditor->updateHistory();			// Check if this is destined for another channel			S32 channel = mChanCtrlEnabled ? (S32)(mChannelControl->get()) : 0;			stripChannelNumber(text, &channel);						std::string utf8text = wstring_to_utf8str(text);			// Try to trigger a gesture, if not chat to a script.			std::string utf8_revised_text;			if (0 == channel)			{				// discard returned "found" boolean				gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);			}			else			{				utf8_revised_text = utf8text;			}			utf8_revised_text = utf8str_trim(utf8_revised_text);			if (!utf8_revised_text.empty())			{				// Chat with animation				sendChatFromViewer(utf8_revised_text, type, TRUE);			}		}	}	childSetValue("Chat Editor", LLStringUtil::null);	gAgent.stopTyping();	// If the user wants to stop chatting on hitting return, lose focus	// and go out of chat mode.	if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))	{		stopChat();	}}
开发者ID:meta7,项目名称:Meta7-Viewer-Imprud-refactor,代码行数:48,


示例8: if

bool GrowlManager::onLLNotification(const LLSD& notice){	if(notice["sigtype"].asString() != "add")		return false;	LLNotificationPtr notification = LLNotifications::instance().find(notice["id"].asUUID());	std::string name = notification->getName();	LLSD substitutions = notification->getSubstitutions();	if(gGrowlManager->mNotifications.find(name) != gGrowlManager->mNotifications.end())	{		GrowlNotification* growl_notification = &gGrowlManager->mNotifications[name];		std::string body = "";		std::string title = "";		if(growl_notification->useDefaultTextForTitle)			title = notification->getMessage();		else if(growl_notification->growlTitle != "")		{			title = growl_notification->growlTitle;			LLStringUtil::format(title, substitutions);		}		if(growl_notification->useDefaultTextForBody)			body = notification->getMessage();		else if(growl_notification->growlBody != "")		{			body = growl_notification->growlBody;			LLStringUtil::format(body, substitutions);		}		//TM:FS no need to log whats sent to growl		//LL_INFOS("GrowlLLNotification") << "Notice: " << title << ": " << body << LL_ENDL;		if(name == "ObjectGiveItem" || name == "ObjectGiveItemUnknownUser" || name == "UserGiveItem" || name == "SystemMessageTip")		{			LLUrlMatch urlMatch;			LLWString newLine = utf8str_to_wstring(body);			LLWString workLine = utf8str_to_wstring(body);			while (LLUrlRegistry::instance().findUrl(workLine, urlMatch) && !urlMatch.getUrl().empty())			{				LLWStringUtil::replaceString(newLine, utf8str_to_wstring(urlMatch.getUrl()), utf8str_to_wstring(urlMatch.getLabel()));				// Remove the URL from the work line so we don't end in a loop in case of regular URLs!				// findUrl will always return the very first URL in a string				workLine = workLine.erase(0, urlMatch.getEnd() + 1);			}			body = wstring_to_utf8str(newLine);		}		gGrowlManager->notify(title, body, growl_notification->growlName);	}	return false;}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:47,


示例9: wstring_to_utf8str

void LLFloaterIMPanel::sendMsg(){	if (!gAgent.isGodlike() 		&& (mDialog == IM_NOTHING_SPECIAL)		&& mOtherParticipantUUID.isNull())	{		llinfos << "Cannot send IM to everyone unless you're a god." << llendl;		return;	}	if (mInputEditor)	{		LLWString text = mInputEditor->getConvertedText();		if(!text.empty())		{			// store sent line in history, duplicates will get filtered			if (mInputEditor) mInputEditor->updateHistory();			// Truncate and convert to UTF8 for transport			std::string utf8_text = wstring_to_utf8str(text);			utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);						if ( mSessionInitialized )			{				LLIMModel::sendMessage(utf8_text,								mSessionUUID,								mOtherParticipantUUID,								mDialog);			}			else			{				//queue up the message to send once the session is				//initialized				mQueuedMsgsForInit.append(utf8_text);			}		}		LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT);		mInputEditor->setText(LLStringUtil::null);	}	// Don't need to actually send the typing stop message, the other	// client will infer it from receiving the message.	mTyping = FALSE;	mSentTypingState = TRUE;}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:47,


示例10: handleUnicodeCharHere

bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char){	bool result = false;		if (mMediaSource)	{		// only accept 'printable' characters, sigh...		if (uni_char >= 32 // discard 'control' characters			&& uni_char != 127) // SDL thinks this is 'delete' - yuck.		{			LLSD native_key_data;			mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data);		}	}		return result;}
开发者ID:djdevil1989,项目名称:Luna-Viewer,代码行数:17,


示例11: utf8str_to_wstring

void LLTextBox::setWrappedText(const LLStringExplicit& in_text, F32 max_width){	if (max_width < 0.0)	{		max_width = (F32)getRect().getWidth();	}	LLWString wtext = utf8str_to_wstring(in_text);	LLWString final_wtext;	LLWString::size_type  cur = 0;;	LLWString::size_type  len = wtext.size();	while (cur < len)	{		LLWString::size_type end = wtext.find('/n', cur);		if (end == LLWString::npos)		{			end = len;		}				LLWString::size_type runLen = end - cur;		if (runLen > 0)		{			LLWString run(wtext, cur, runLen);			LLWString::size_type useLen =				mFontGL->maxDrawableChars(run.c_str(), max_width, runLen, TRUE);			final_wtext.append(wtext, cur, useLen);			cur += useLen;		}		if (cur < len)		{			if (wtext[cur] == '/n')			{				cur += 1;			}			final_wtext += '/n';		}	}	std::string final_text = wstring_to_utf8str(final_wtext);	setText(final_text);}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:45,


示例12: apply

void LLPanelEmerald::apply(){	LLTextEditor* im = sInstance->getChild<LLTextEditor>("im_response");	LLWString im_response;	if (im) im_response = im->getWText(); 	LLWStringUtil::replaceTabsWithSpaces(im_response, 4);	LLWStringUtil::replaceChar(im_response, '/n', '^');	LLWStringUtil::replaceChar(im_response, ' ', '%');	glggHunSpell->setNewHighlightSetting(gSavedSettings.getBOOL("EmeraldSpellDisplay"));	gSavedPerAccountSettings.setString("EmeraldInstantMessageResponse", std::string(wstring_to_utf8str(im_response)));	//gSavedPerAccountSettings.setString(	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageResponseMuted", childGetValue("EmeraldInstantMessageResponseMuted").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageResponseFriends", childGetValue("EmeraldInstantMessageResponseFriends").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageResponseMuted", childGetValue("EmeraldInstantMessageResponseMuted").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageResponseAnyone", childGetValue("EmeraldInstantMessageResponseAnyone").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageShowResponded", childGetValue("EmeraldInstantMessageShowResponded").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageShowOnTyping", childGetValue("EmeraldInstantMessageShowOnTyping").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageResponseRepeat", childGetValue("EmeraldInstantMessageResponseRepeat").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageResponseItem", childGetValue("EmeraldInstantMessageResponseItem").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageAnnounceIncoming", childGetValue("EmeraldInstantMessageAnnounceIncoming").asBoolean());	gSavedPerAccountSettings.setBOOL("EmeraldInstantMessageAnnounceStealFocus", childGetValue("EmeraldInstantMessageAnnounceStealFocus").asBoolean());	if(((gSavedSettings.getU32("RenderQualityPerformance")>=3) && gSavedSettings.getBOOL("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("VertexShaderEnable")) && childGetValue("EmeraldShadowsON").asBoolean())	{		gSavedSettings.setBOOL("RenderUseFBO", childGetValue("EmeraldShadowsON").asBoolean());		gSavedSettings.setBOOL("RenderDeferred", childGetValue("EmeraldShadowsON").asBoolean());	}	else if(!childGetValue("EmeraldShadowsON").asBoolean())	{		if(gSavedSettings.getBOOL("RenderDeferred"))		{			gSavedSettings.setBOOL("RenderDeferred", childGetValue("EmeraldShadowsON").asBoolean());			gSavedSettings.setBOOL("RenderUseFBO", childGetValue("EmeraldShadowsON").asBoolean());		}	}	else if(((gSavedSettings.getU32("RenderQualityPerformance")<3) && !gSavedSettings.getBOOL("WindLightUseAtmosShaders") && !gSavedSettings.getBOOL("VertexShaderEnable")) && childGetValue("EmeraldShadowsON").asBoolean())	{		childSetValue("EmeraldShadowsON",false);		LLNotifications::instance().add("NoShadows");		llwarns<<"Attempt to enable shadow rendering while graphics settings not on ultra!"<<llendl;	}	gSavedSettings.setBOOL("EmeraldShadowsToggle", childGetValue("EmeraldShadowsON").asBoolean());	gSavedSettings.setU32("EmeraldUseOTR", (U32)childGetValue("EmeraldUseOTR").asReal());	gLggBeamMaps.forceUpdate();}
开发者ID:zwagoth,项目名称:Emerald-SVN-History,代码行数:45,


示例13: wstring_to_utf8str

void LLIMFloater::sendMsg(){    if (!gAgent.isGodlike()            && (mDialog == IM_NOTHING_SPECIAL)            && mOtherParticipantUUID.isNull())    {        llinfos << "Cannot send IM to everyone unless you're a god." << llendl;        return;    }    if (mInputEditor)    {        LLWString text = mInputEditor->getConvertedText();        if(!text.empty())        {            // Truncate and convert to UTF8 for transport            std::string utf8_text = wstring_to_utf8str(text);            utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);            if (mSessionInitialized)            {                LLIMModel::sendMessage(utf8_text, mSessionID,                                       mOtherParticipantUUID,mDialog);            }            else            {                //queue up the message to send once the session is initialized                mQueuedMsgsForInit.append(utf8_text);            }            mInputEditor->setText(LLStringUtil::null);            updateMessages();        }        else if (gSavedSettings.getBOOL("CloseIMOnEmptyReturn"))        {            // Close if we're the child of a floater            closeFloater();        }    }}
开发者ID:OS-Development,项目名称:VW.Zen,代码行数:41,


示例14: wstring_to_utf8str

void DOHexEditor::paste(){	if(!canPaste()) return;	std::string clipstr = wstring_to_utf8str(gClipboard.getPasteWString());	const char* clip = clipstr.c_str();	std::vector<U8> new_data;	if(mInData)	{		int len = strlen(clip);		for(int i = 0; (i + 1) < len; i += 2)		{			int c = 0;			if(sscanf(&(clip[i]), "%02X", &c) != 1) break;			new_data.push_back(U8(c));		}	}	else	{		int len = strlen(clip);		for(int i = 0; i < len; i++)		{			U8 c = 0;			if(sscanf(&(clip[i]), "%c", &c) != 1) break;			new_data.push_back(c);		}	}	U32 start = mCursorPos;	if(!mHasSelection)		insert(start, new_data, TRUE);	else	{		start = getProperSelectionStart();		overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE);	}	moveCursor(start + new_data.size(), FALSE);}
开发者ID:AGoodPerson,项目名称:Ascent,代码行数:40,


示例15: getWChar

std::string LLViewerTextEditor::getEmbeddedText(){#if 1	// New version (Version 2)	mEmbeddedItemList->copyUsedCharsToIndexed();	LLWString outtextw;	for (S32 i=0; i<(S32)getWText().size(); i++)	{		llwchar wch = getWChar(i);		if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )		{			S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);			wch = FIRST_EMBEDDED_CHAR + index;		}		outtextw.push_back(wch);	}	std::string outtext = wstring_to_utf8str(outtextw);	return outtext;#else	// Old version (Version 1)	mEmbeddedItemList->copyUsedCharsToIndexed();	std::string outtext;	for (S32 i=0; i<(S32)mWText.size(); i++)	{		llwchar wch = mWText[i];		if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )		{			S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);			wch = 0x80 | index % 128;		}		else if (wch >= 0x80)		{			wch = LL_UNKNOWN_CHAR;		}		outtext.push_back((U8)wch);	}	return outtext;#endif}
开发者ID:Ratany,项目名称:SingularityViewer,代码行数:39,


示例16:

//Generate highlight color segments for this paragraph.  Pass in default color of paragraph.void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) {	LLSD paragraph_color_segments;	LLColor4 lcolor=color;		paragraph_color_segments[0]["text"] =wstring_to_utf8str(mParagraphText);	LLSD color_sd = color.getValue();	paragraph_color_segments[0]["color"]=color_sd;	for(LLSD::array_const_iterator color_segment_it = paragraph_color_segments.beginArray();		color_segment_it != paragraph_color_segments.endArray();		++color_segment_it)	{					LLSD color_llsd = (*color_segment_it)["color"];		std::string color_str  = (*color_segment_it)["text"].asString();		ParagraphColorSegment color_segment;				color_segment.mColor.setValue(color_llsd);		color_segment.mNumChars = color_str.length();				mParagraphColorSegments.push_back(color_segment);	}}
开发者ID:Xara,项目名称:Astra-Viewer-2,代码行数:25,


示例17: wstring_to_utf8str

void LLUIString::insert(S32 charidx, const LLWString& wchars){	mWResult.insert(charidx, wchars);	mResult = wstring_to_utf8str(mWResult);}
开发者ID:Boy,项目名称:rainbow,代码行数:5,


示例18: wstring_to_utf8str

void LLChatBar::onInputEditorKeystroke(){	LLWString raw_text;	if (mInputEditor) raw_text = mInputEditor->getWText();	// Can't trim the end, because that will cause autocompletion	// to eat trailing spaces that might be part of a gesture.	LLWStringUtil::trimHead(raw_text);	S32 length = raw_text.length();	//if( (length > 0) && (raw_text[0] != '/') )  // forward slash is used for escape (eg. emote) sequences// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)	if ( (length > 0) && (raw_text[0] != '/') && (!gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) )// [/RLVa:KB]	{		gAgent.startTyping();	}	else	{		gAgent.stopTyping();	}	/* Doesn't work -- can't tell the difference between a backspace	   that killed the selection vs. backspace at the end of line.	if (length > 1 		&& text[0] == '/'		&& key == KEY_BACKSPACE)	{		// the selection will already be deleted, but we need to trim		// off the character before		std::string new_text = raw_text.substr(0, length-1);		mInputEditor->setText( new_text );		mInputEditor->setCursorToEnd();		length = length - 1;	}	*/	KEY key = gKeyboard->currentKey();	// Ignore "special" keys, like backspace, arrows, etc.	if (length > 1 		&& raw_text[0] == '/'		&& key < KEY_SPECIAL)	{		// we're starting a gesture, attempt to autocomplete		std::string utf8_trigger = wstring_to_utf8str(raw_text);		std::string utf8_out_str(utf8_trigger);		if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))		{			if (mInputEditor)			{				std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());				mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part				S32 outlength = mInputEditor->getLength(); // in characters							// Select to end of line, starting from the character				// after the last one the user typed.				mInputEditor->setSelection(length, outlength);			}		}		//LL_INFOS() << "GESTUREDEBUG " << trigger 		//	<< " len " << length		//	<< " outlen " << out_str.getLength()		//	<< LL_ENDL;	}}
开发者ID:Apelsin,项目名称:EffervescenceViewer,代码行数:70,


示例19: stripChannelNumber

void LLChatBar::sendChat( EChatType type ){	if (mInputEditor)	{		LLWString text = mInputEditor->getConvertedText();		if (!text.empty())		{			// store sent line in history, duplicates will get filtered			if (mInputEditor) mInputEditor->updateHistory();			// Check if this is destined for another channel			S32 channel = mChanCtrlEnabled ? (S32)(mChannelControl->get()) : 0;			stripChannelNumber(text, &channel);						std::string utf8text = wstring_to_utf8str(text);			// Try to trigger a gesture, if not chat to a script.			std::string utf8_revised_text;			if (0 == channel)			{				if (gSavedSettings.getBOOL("AutoCloseOOC"))				{					// Try to find any unclosed OOC chat (i.e. an opening					// double parenthesis without a matching closing double					// parenthesis.					if (utf8text.find("((") != -1 && utf8text.find("))") == -1)					{						if (utf8text.at(utf8text.length() - 1) == ')')						{							// cosmetic: add a space first to avoid a closing triple parenthesis							utf8text += " ";						}						// add the missing closing double parenthesis.						utf8text += "))";					}				}				// Convert MU*s style poses into IRC emotes here.				if (gSavedSettings.getBOOL("AllowMUpose") && utf8text.find(":") == 0 && utf8text.length() > 3)				{					if (utf8text.find(":'") == 0)					{						utf8text.replace(0, 1, "/me");	 				}					else if (isalpha(utf8text.at(1)))	// Do not prevent smileys and such.					{						utf8text.replace(0, 1, "/me ");					}				}				// discard returned "found" boolean				gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);			}			else			{				utf8_revised_text = utf8text;			}			utf8_revised_text = utf8str_trim(utf8_revised_text);			if (!utf8_revised_text.empty())			if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type))			{				// Chat with animation				sendChatFromViewer(utf8_revised_text, type, TRUE);			}		}	}	childSetValue("Chat Editor", LLStringUtil::null);	gAgent.stopTyping();	// If the user wants to stop chatting on hitting return, lose focus	// and go out of chat mode.	if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))	{		stopChat();	}}
开发者ID:kow,项目名称:pleiaviewer,代码行数:80,


示例20: childSetValue

// Update controls based on current settingsvoid LLPrefsAscentChat::refresh(){    //Chat --------------------------------------------------------------------------------    // time format combobox    LLComboBox* combo = getChild<LLComboBox>("time_format_combobox");    if (combo)    {        combo->setCurrentByIndex(mTimeFormat);    }    // date format combobox    combo = getChild<LLComboBox>("date_format_combobox");    if (combo)    {        combo->setCurrentByIndex(mDateFormat);    }    childSetValue("AscentInstantMessageResponseAnyone",  mIMResponseAnyone);    childSetValue("AscentInstantMessageResponseFriends", mIMResponseFriends);    childSetValue("AscentInstantMessageResponseMuted",   mIMResponseMuted);    childSetValue("AscentInstantMessageShowOnTyping",    mIMShowOnTyping);    childSetValue("AscentInstantMessageShowResponded",   mIMShowResponded);    childSetValue("AscentInstantMessageResponseRepeat",  mIMResponseRepeat);    childSetValue("AscentInstantMessageResponseItem",    mIMResponseItem);    LLWString auto_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("AscentInstantMessageResponse") );    LLWStringUtil::replaceChar(auto_response, '^', '/n');    LLWStringUtil::replaceChar(auto_response, '%', ' ');    childSetText("im_response", wstring_to_utf8str(auto_response));    //Text Options ------------------------------------------------------------------------    combo = getChild<LLComboBox>("SpellBase");    if (combo != NULL)     {        combo->removeall();        std::vector<std::string> names = glggHunSpell->getDicts();        for (int i = 0; i < (int)names.size(); i++)         {            combo->add(names[i]);        }        combo->setSimple(gSavedSettings.getString("SpellBase"));    }    combo = getChild<LLComboBox>("EmSpell_Avail");    if (combo != NULL)     {        combo->removeall();        combo->add("");        std::vector<std::string> names = glggHunSpell->getAvailDicts();        for (int i = 0; i < (int)names.size(); i++)         {            combo->add(names[i]);        }        combo->setSimple(std::string(""));    }    combo = getChild<LLComboBox>("EmSpell_Installed");    if (combo != NULL)     {        combo->removeall();        combo->add("");        std::vector<std::string> names = glggHunSpell->getInstalledDicts();        for (int i = 0; i < (int)names.size(); i++)         {            combo->add(names[i]);        }        combo->setSimple(std::string(""));    }    childSetEnabled("KeywordsList",        mKeywordsOn);    childSetEnabled("KeywordsInChat",      mKeywordsOn);    childSetEnabled("KeywordsInIM",        mKeywordsOn);    childSetEnabled("KeywordsChangeColor", mKeywordsOn);    childSetEnabled("KeywordsColor",       mKeywordsOn);    childSetEnabled("KeywordsPlaySound",   mKeywordsOn);    childSetEnabled("KeywordsSound",       mKeywordsOn);    childSetValue("KeywordsOn",          mKeywordsOn);    childSetValue("KeywordsList",        mKeywordsList);    childSetValue("KeywordsInChat",      mKeywordsInChat);    childSetValue("KeywordsInIM",        mKeywordsInIM);    childSetValue("KeywordsChangeColor", mKeywordsChangeColor);    LLColorSwatchCtrl* colorctrl = getChild<LLColorSwatchCtrl>("KeywordsColor");    colorctrl->set(LLColor4(mKeywordsColor),TRUE);    childSetValue("KeywordsPlaySound",   mKeywordsPlaySound);    childSetValue("KeywordsSound",       mKeywordsSound);//.........这里部分代码省略.........
开发者ID:samiam123,项目名称:SingularityViewer,代码行数:101,


示例21: getUpdatedWResult

void LLUIString::insert(S32 charidx, const LLWString& wchars){	getUpdatedWResult().insert(charidx, wchars);	mResult = wstring_to_utf8str(getUpdatedWResult());}
开发者ID:jimjesus,项目名称:kittyviewer,代码行数:5,


示例22: rawstr_to_utf8

std::string rawstr_to_utf8(const std::string& raw){	LLWString wstr(utf8str_to_wstring(raw));	return wstring_to_utf8str(wstr);}
开发者ID:Beeks,项目名称:Ascent,代码行数:5,


示例23: wstring_to_utf8str

std::ostream& operator<<(std::ostream &s, const LLWString &wstr){	std::string utf8_str = wstring_to_utf8str(wstr);	s << utf8_str;	return s;}
开发者ID:Beeks,项目名称:Ascent,代码行数:6,



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


C++ wtap_dump_file_write函数代码示例
C++ wstring函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。