本文整理汇总了C++中MessagePtr::decode方法的典型用法代码示例。如果您正苦于以下问题:C++ MessagePtr::decode方法的具体用法?C++ MessagePtr::decode怎么用?C++ MessagePtr::decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessagePtr
的用法示例。
在下文中一共展示了MessagePtr::decode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onReadBody
void Client::onReadBody(MessagePtr msg, const error_code& error)
{
// make sure everything was successful
if (!error && msg->decode())
{
// list of found messages
bool found = false;
boost::unique_lock<boost::mutex> slock(mSMutex);
for (auto iter = mSent.begin(); iter != mSent.end() && !found; ++iter)
{
if (!strcmp(iter->c_str(), msg->body()))
{
found = true;
mSent.erase(iter);
}
}
// prints the body
if (!found)
{
printf("%s\n", msg->body());
if(0==strncmp(msg->body(),"/banksy",7))
{
printf("%s\n", " .s$$$Ss.");
printf("%s\n", " .8, $$$. _. . ..sS$$$$$' ...,.;");
printf("%s\n", "o. ,@.. 88 =.$'$' ' ..sS$$$$$$$$$$$$s. _;''");
printf("%s\n", " @@@[email protected]@@. .88. ` ` ""l. .sS$$.._.sS$$$$$$$$$$$$S'''");
printf("%s\n", " [email protected]@@[email protected]@.8888o. .s$$$$$$$$$$$$$$$$$$$$$'");
printf("%s\n", " .:`@@@@33333. .>$$$$$$$$$$$$$$$$$$$$'");
printf("%s\n", " .: `@@@@333' ..>$$$$$$$$$$$$$$$$$$$'");
printf("%s\n", " : `@@333. `., s$$$$$$$$$$$$$$$$$'");
printf("%s\n", " : `@33 $$ S.s$$$$$$$$$$$$$$$$$'");
printf("%s\n", " .S `Y ..` ,'$' `$$$$$$$$$$$$$$");
printf("%s\n", " $s . ..S$s, . .`$$$$$$$$$$$$.");
printf("%s\n", " $s ., ,s ,$$$$,,sS$s.$$$$$$$$$$$$$.");
printf("%s\n", " / /$$SsS.s. ..s$$$$$$$$$$$$$$$$$$$$$$$$$.");
printf("%s\n", " /`.`$$$$$dN.ssS$$'`$$$$$$$$$$$$$$$$$$$$$$$.");
printf("%s\n", " / `$$$$$$$$$' `$$$$$$$$$$$$$$$$$$$$$$.");
printf("%s\n", " / | `S$$S$' `$$$$$$$$$$$$$$$$$$$$$$.");
printf("%s\n", " / / $$$$$$$$$$$$$$$$$$$$$.");
printf("%s\n", " `$$$$$$$$$$$$$$$$$$$$$s.");
printf("%s\n", " $$$'' .?T$$$$$$$");
printf("%s\n", " .$' ... ?$$# ");
printf("%s\n", " ! -=S$$$$$s");
printf("%s\n", " .! -=s$$' `$=-_ :");
printf("%s\n", " , .$$$' `$, .|");
printf("%s\n", " , .$$$' . ,");
printf("%s\n", " , ..$$$'");
printf("%s\n", " .s$$$' `s .");
printf("%s\n", " . .s$$$$' $s. ..$s");
printf("%s\n", " . .s$$$$' `$s=s$$$");
printf("%s\n", " .$$$$' , $$s");
}
}
// start listening for the next message
listen();
}
else // error
{
printf("Error reading body\n");
kill();
}
}