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


C++ TextView::Insert方法代码示例

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


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

示例1: Update

void MainView::Update(void)
{
 			cout << "Updating textOutputView" << endl;	 					
// First we get the infomation taken from the IRC server and put into "buf" is added to the textOutputView
//	We then check the incoming data to see if it contains the PING command from the server.			
			int i;
			string bufstring;
			bufstring = buf;					
			i = bufstring.find("PING");
			cout << "Ping?\n" << endl;
			cout << i << endl;
			cout << bufstring << endl;
			if (i == -1) {
				cout << "No Ping" << endl;
				}
//	If it does we return the message "Pong nick\n", The Ping is sent from the server to check that 
//	we are still receiving messages
//	However due Ping being mentioned in the MOTD from freenode here is a dirty hack to get round this,
//	it only checks if the PING command is not equal to -1 (-1 is returned when Ping isn't mentioned)
//	and less then 80. (80 not 10 as it allows you to test the function by sending a PRIVMSG with Ping
//	embedded.					
			else if (i !=-1) {
				if (i < 80) {
					cout << "Yes Ping" << endl;
					sendmessage = "PONG " + nick + end;		
					messagetosend = 1;
					}
				else {
					cout << "No Ping" << endl;
					}
				}
//	Once the Ping command is done we now need to cut down the message to contain just the nick
//	of the sender and also the message itself.	Now this gets a little stuck with the MOTD from
//	the server so we only turn it on once we have joined a channel. (when erase = 1)
			if (erase ==1){
				string bufstring1;
				string bufstring2;						
				string bufstring3;							
				bufstring1 = buf;
				string find1 = "!";
				string::size_type pos = bufstring1.find (find1,0);
				string find2 = "#";									
				string::size_type pos1 = bufstring1.find (find2,0);
				int pos2, totallength;
				pos2 = pos1 - pos;				
				bufstring2 = bufstring1.erase (pos, pos2);	
				const char* bufchar;					
				bufchar = bufstring2.c_str();				
				textOutputView->Insert(bufchar, true);		
				}
			else {
				textOutputView->Insert(buf, true);	
				}
			if( m_CommThread )
			m_CommThread->PostMessage( MSG_TOLOOPER_START, m_CommThread, m_CommThread ); 											
		
}
开发者ID:peekaye,项目名称:Syllable-sIRC,代码行数:57,代码来源:sIRC32.cpp

示例2: SendMsg

void MainView::SendMsg (void)
{
	textfrominput = textInputView->GetBuffer()[0].const_str();
	cout << "Text from input: " << textfrominput << endl;
	messagetosend = 1;		
	sendmessage = priv + channel + " :" + textfrominput + end;	
	Message *msg1 = new Message(MSG_TOLOOPER_START);
	Mail("Commthread", msg1);	
	string printinputmessage = nick + channel + " : " + textfrominput + end;	
	cout << printinputmessage << endl;	
	const char* msgupdate;
	msgupdate = printinputmessage.c_str();	
	textOutputView->Insert(msgupdate, true);
	textInputView->Clear(true);	
}
开发者ID:peekaye,项目名称:Syllable-sIRC,代码行数:15,代码来源:sIRC32.cpp


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