本文整理汇总了C++中Notification::SetError方法的典型用法代码示例。如果您正苦于以下问题:C++ Notification::SetError方法的具体用法?C++ Notification::SetError怎么用?C++ Notification::SetError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::SetError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestAllocateNotificationMessage
TEST_RESULT TestAllocateNotificationMessage()
{
std::cout << "create noti with no cid" << std::endl;
{
std::stringstream messageToBeSent;
Message * noti = new AllocateNotification("gutentag");
noti->Write(messageToBeSent);
std::cout << messageToBeSent.str() << std::endl;
}
std::cout << "create noti with cid" << std::endl;
{
std::stringstream messageToBeSent;
Message * noti = new AllocateNotification("gutentag", 15);
noti->Write(messageToBeSent);
std::cout << messageToBeSent.str() << std::endl;
}
std::cout << "create noti with error" << std::endl;
{
std::stringstream messageToBeSent;
Notification * noti = new AllocateNotification("gutentag", 15);
noti->SetError(ERRORCODE_WRONG_CHANNELID, "crab happened");
noti->Write(messageToBeSent);
std::cout << messageToBeSent.str() << std::endl;
}
std::cout << "create Allocate noti with error and cid" << std::endl;
{
std::stringstream messageToBeSent;
AllocateNotification * noti = new AllocateNotification("gutentag", 15);
noti->SetError(ERRORCODE_WRONG_CHANNELID, "crab happened 2");
noti->Write(messageToBeSent);
std::cout << messageToBeSent.str() << std::endl;
pugi::xml_document* doc = new pugi::xml_document();
ParseResponse(doc, ( char*)(messageToBeSent.str().c_str()));
AllocateNotification * res = new AllocateNotification(doc);
std::cout << "channel id" << res->GetChannelId() << std::endl;
ErrorCode errc;
const char * errstr;
res->GetError(errc, errstr);
std::string messageName = res->GetMessageName();
std::cout << "message name" << messageName << std::endl;
std::cout << "err code" << errc << std::endl;
std::cout << "err str" << errstr << std::endl;
}
std::cout << "test static functionality" << std::endl;
{
std::stringstream messageToBeSent;
AllocateNotification * noti = new AllocateNotification("gutentag", 25);
noti->SetError(ERRORCODE_WRONG_CHANNELID, "crab happened 3");
noti->Write(messageToBeSent);
std::cout << messageToBeSent.str() << std::endl;
pugi::xml_document* doc = new pugi::xml_document();
ParseResponse(doc, ( char*)(messageToBeSent.str().c_str()));
if (Notification::NOTIFICATIONTTYPE_ALLOCATE == Notification::GetNotificationType(doc))
std::cout << "type obtained properly" << std::endl;
std::cout << "tag" << Notification::GetNotificationTag(doc) << std::endl;
}
return PASSED;
}