本文整理汇总了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 );
}
示例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);
}