当前位置: 首页>>代码示例>>C++>>正文


C++ MessagePtr::decode方法代码示例

本文整理汇总了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();
    }
}
开发者ID:nikchi,项目名称:ChatTxt,代码行数:63,代码来源:Client.cpp


注:本文中的MessagePtr::decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。