本文整理汇总了C++中QSharedPointer::Send方法的典型用法代码示例。如果您正苦于以下问题:C++ QSharedPointer::Send方法的具体用法?C++ QSharedPointer::Send怎么用?C++ QSharedPointer::Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSharedPointer
的用法示例。
在下文中一共展示了QSharedPointer::Send方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendNotification
void RpcHandler::SendNotification(const QSharedPointer<ISender> &to,
const QString &method, const QVariant &data)
{
int id = IncrementId();
QVariantList container = Request::BuildNotification(id, method, data);
QByteArray msg;
QDataStream stream(&msg, QIODevice::WriteOnly);
stream << container;
qDebug() << "RpcHandler: Sending notification" << id << "for" << method <<
"to" << to->ToString();
to->Send(msg);
}
示例2: SendRequest
int RpcHandler::SendRequest(const QSharedPointer<ISender> &to,
const QString &method, const QVariant &data,
const QSharedPointer<ResponseHandler> &cb, bool timeout)
{
int id = IncrementId();
qint64 ctime = Utils::Time::GetInstance().MSecsSinceEpoch();
TimerCallback *callback = new TimerCallback(this, &RpcHandler::Timeout, id);
Utils::TimerEvent timer = Utils::Timer::GetInstance().QueueCallback(callback,
TimeoutDelta);
_requests[id] = QSharedPointer<RequestState>(
new RequestState(to, cb, ctime, timer, timeout));
QVariantList container = Request::BuildRequest(id, method, data);
QByteArray msg;
QDataStream stream(&msg, QIODevice::WriteOnly);
stream << container;
qDebug() << "RpcHandler: Sending request" << id << "for" << method <<
"to" << to->ToString();
to->Send(msg);
return id;
}