本文整理汇总了C++中QSharedPointer::Parse方法的典型用法代码示例。如果您正苦于以下问题:C++ QSharedPointer::Parse方法的具体用法?C++ QSharedPointer::Parse怎么用?C++ QSharedPointer::Parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSharedPointer
的用法示例。
在下文中一共展示了QSharedPointer::Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Send
//SEND---------------------------------------------------------------------------
void MainThread::Send(QSharedPointer<IMessage> mes)
{
QString sender,receiver,message;
mes->Parse();
sender=mes->GetPart(keys.s);
qCritical()<<"sender"<<sender;
if (sender.isEmpty()||sender.contains("-"))
{
return;
}
receiver=mes->GetPart(keys.id);
qCritical()<<"receiver"<<receiver;
if (receiver.isEmpty())
{
return;
}
///-------------------- message=mes->GetPart(keys.m);//Modified Andrey 17/01/11
//mes->Delete(keys.id);///////////////////////////////////////-------------------------------------------------
mes->Delete(keys.s);//IF error then send nick in "#s/..."
//mes->AddPart("id",sender);
mes->ReplacePart(keys.id,sender);
message=mes->Unparse();
mes.clear();
qCritical()<<"sender"<<sender;
qCritical()<<"parse message is: "<<message;
QTcpSocket* sock=cl->NotTmpSocket(receiver.toInt());//now socket
if (sock!=NULL)
sock->write(qPrintable(message));
}
示例2: ListenServer
void MainWindow::ListenServer(QSharedPointer<IMessage> mes)
{
mes->Parse();
if ("ser*ver"==mes->GetPart("s"))
{
if ("good login-password"==mes->GetPart("m"))
{
MMessageBox* r=new MMessageBox("Title","Welcom",M::OkButton);
r->appear(this);
page6->appear();
}
if ("good registration"==mes->GetPart("m"))
{
MMessageBox* r=new MMessageBox("Title","Your ID : "+mes->GetPart("id"),M::OkButton);
r->appear(this);
page2->appear();
}
if(mes->GetPart("m")=="login is already used")
{
MMessageBox* r=new MMessageBox("Error!","This user online already",M::OkButton);
r->appear(this);
}
if(mes->GetPart("m")=="Error of password")
{
MMessageBox* r=new MMessageBox("Error!","Error of password",M::OkButton);
r->appear(this);
}
if(mes->GetPart("m")=="Error of login")
{
MMessageBox* r=new MMessageBox("Error!","This login doesn`t find in contacts base",M::OkButton);
r->appear(this);
}
if(mes->GetPart("m")=="Login already exist")
{
MMessageBox* r=new MMessageBox("Error!","Login already exist",M::OkButton);
r->appear(this);
}
}
else
{
if ("connect"==mes->GetPart("o"))
{
page6->Add(mes->GetPart("id"),mes->GetPart("s"),mes->GetPart("o"));
}
if ("disconnect"==mes->GetPart("o"))
{
page6->Remove(mes->GetPart("id"));
}
if (mes->GetPart("o").isEmpty())
{
qCritical()<<">>sender"<<mes->GetPart("id");
qCritical()<<">>message"<<mes->GetPart("m");
if(this->currentPage()==page7)
{
page7->Display(mes->GetPart("id"),mes->GetPart("m"));
}
else
{
page7->Display(mes->GetPart("id"),mes->GetPart("m"));
emit incomingMessage(mes->GetPart("id"));//!!!!!!!!!!!!!!!
}
}
}
mes.clear();;
}