• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ common::Stream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中common::Stream的典型用法代码示例。如果您正苦于以下问题:C++ Stream类的具体用法?C++ Stream怎么用?C++ Stream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Stream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: serialize

 int WriteDataMessage::serialize(common::Stream& output) const
 {
   if (has_lease())
   {
     ds_.push_back(ULONG_LONG_MAX);
     ds_.push_back(static_cast<uint64_t>(version_));
     ds_.push_back(static_cast<uint64_t>(lease_id_));
   }
   int64_t pos = 0;
   int32_t iret = write_data_info_.serialize(output.get_free(), output.get_free_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     output.pour(write_data_info_.length());
     iret = output.set_vint64(ds_);
   }
   if (common::TFS_SUCCESS == iret
       && write_data_info_.length_ > 0)
   {
     iret = output.set_bytes(data_, write_data_info_.length_);
   }
   // reparse, avoid push verion&lease again when clone twice;
   if (common::TFS_SUCCESS == iret)
   {
     parse_special_ds(ds_, version_, lease_id_);
   }
   return iret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:27,代码来源:write_data_message.cpp


示例2: Load

	bool PackedFile::Load( const char * filename, bool onlyFirst )
	{
		Common::FileStream fs;
		fs.Open(filename);
		uint size = (uint)fs.Size();

		Common::Stream st;
		st.append_zero(size);
		fs.Read((byte *)st, size);
		fs.Close();

		_data.clear();

		std::string magicStr;
		st>>magicStr;
		if( magicStr != "Warcraft III recorded game\x01A" )
		{
			return false;
		}

		uint HeaderVersion;
		uint DecompressedSize;
		uint NumBlocks;
		st += 4;						// header size
		st += 4;						// compressed file size
		st >> HeaderVersion;			// header version
		st >> DecompressedSize;			// decompressed file size
		st >> NumBlocks;				// number of blocks

		if( HeaderVersion == 0 )
		{
			st += 2;					// unknown
			st >> (ushort&)_gameVersion;	// version number
		}
开发者ID:KimimaroTsukimiya,项目名称:w3hostbot,代码行数:34,代码来源:PackedFile.cpp


示例3: serialize

 int BlockFileInfoMessage::serialize(common::Stream& output)  const
 {
   int32_t iret = output.set_int32(block_id_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = output.set_int32(fileinfo_list_.size());
   }
   if (common::TFS_SUCCESS == iret)
   {
     common::FILE_INFO_LIST::const_iterator iter = fileinfo_list_.begin();
     for (; iter != fileinfo_list_.end(); ++iter)
     {
       int64_t pos = 0;
       iret = (*iter).serialize(output.get_free(), output.get_free_length(), pos);
       if (common::TFS_SUCCESS == iret)
       {
         output.pour((*iter).length());
       }
       else
       {
         break;
       }
     }
   }
   return iret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:26,代码来源:block_info_message.cpp


示例4: deserialize

 int BlockFileInfoMessage::deserialize(common::Stream& input)
 {
   int32_t size = 0;
   int32_t iret = input.get_int32(reinterpret_cast<int32_t*> (&block_id_));
   if (common::TFS_SUCCESS == iret)
   {
     iret = input.get_int32(&size);
   }
   if (common::TFS_SUCCESS == iret)
   {
     common::FileInfo info;
     for (int32_t i = 0; i < size; ++i)
     {
       int64_t pos = 0;
       iret = info.deserialize(input.get_data(), input.get_data_length(), pos);
       if (common::TFS_SUCCESS == iret)
       {
         input.drain(info.length());
         fileinfo_list_.push_back(info);
       }
       else
       {
         break;
       }
     }
   }
   return iret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:28,代码来源:block_info_message.cpp


示例5: get_counter_map

 int AccessStatInfoMessage::get_counter_map(common::Stream& input, COUNTER_TYPE & map)
 {
   int32_t size = 0;
   int32_t iret = input.get_int32(&size);
   if (common::TFS_SUCCESS == iret)
   {
     common::Throughput t;
     int64_t pos = 0;
     int32_t id = 0;
     for (int32_t i = 0; i < size; ++i)
     {
       iret = input.get_int32(&id);
       if (common::TFS_SUCCESS != iret)
         break;
       pos = 0;
       iret = t.deserialize(input.get_data(), input.get_data_length(), pos);
       if (common::TFS_SUCCESS != iret)
         break;
       else
       {
         input.drain(t.length());
         map.insert(COUNTER_TYPE::value_type(id, t));
       }
     }
   }
   return iret;
 }
开发者ID:610152753,项目名称:tfs-1.4,代码行数:27,代码来源:server_status_message.cpp


示例6: set_counter_map

 int AccessStatInfoMessage::set_counter_map(common::Stream& output, const COUNTER_TYPE & map, int32_t from_row,
     int32_t return_row, int32_t size) const
 {
   int32_t iret = output.set_int32(size);
   if (common::TFS_SUCCESS == iret)
   {
     if (size > 0)
     {
       int64_t pos = 0;
       int32_t count = 0;
       COUNTER_TYPE::const_iterator iter = map.begin();
       for (; iter != map.end(); ++iter, ++count)
       {
         if (count <= from_row)
           continue;
         if (count > from_row + return_row)
           break;
         iret = output.set_int32(iter->first);
         if (common::TFS_SUCCESS != iret)
           break;
         pos = 0;
         iret = const_cast<common::Throughput*>(&iter->second)->serialize(output.get_free(), output.get_free_length(), pos);
         if (common::TFS_SUCCESS == iret)
           output.pour(iter->second.length());
         else
           break;
       }
     }
   }
   return iret;
 }
开发者ID:610152753,项目名称:tfs-1.4,代码行数:31,代码来源:server_status_message.cpp


示例7: serialize

 int GetFamilyInfoMessage::serialize(common::Stream& output)  const
 {
   int32_t ret = output.set_int32(mode_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = output.set_int64(family_id_);
   }
   return ret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:9,代码来源:family_info_message.cpp


示例8: deserialize

 int GetFamilyInfoMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(&mode_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int64(&family_id_);
   }
   return ret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:9,代码来源:family_info_message.cpp


示例9: deserialize

 int DumpPlanResponseMessage::deserialize(common::Stream& input)
 {
   int32_t iret = common::TFS_SUCCESS;
   if (input.get_data_length() > 0)
   {
     data_.writeBytes(input.get_data(), input.get_data_length());
   }
   return iret;
 }
开发者ID:0huah0,项目名称:tfs,代码行数:9,代码来源:dump_plan_message.cpp


示例10: serialize

 int ReportCheckBlockMessage::serialize(common::Stream& output) const
 {
   int64_t pos = 0;
   int ret = param_.serialize(output.get_free(), output.get_free_length(), pos);
   if (TFS_SUCCESS == ret)
   {
     output.pour(param_.length());
   }
   return ret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:10,代码来源:checkserver_message.cpp


示例11: deserialize

 int MasterAndSlaveHeartMessage::deserialize(common::Stream& input)
 {
   int64_t pos = 0;
   int32_t iret = ns_identity_.deserialize(input.get_data(), input.get_data_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     input.drain(ns_identity_.length());
   }
   return iret;
 }
开发者ID:610152753,项目名称:tfs-1.4,代码行数:10,代码来源:heart_message.cpp


示例12: serialize

 int ShowServerInformationMessage::serialize(common::Stream& output) const 
 {
   int64_t pos = 0;
   int32_t iret = param.serialize(output.get_free(), output.get_free_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     output.pour(param.length());
   }
   return iret;
 }
开发者ID:610152753,项目名称:tfs-1.4,代码行数:10,代码来源:server_status_message.cpp


示例13: deserialize

 int ShowServerInformationMessage::deserialize(common::Stream& input)
 {
   int64_t pos = 0;
   int32_t iret = param.deserialize(input.get_data(), input.get_data_length(),  pos);
   if (common::TFS_SUCCESS == iret)
   {
     input.drain(pos);
   }
   return iret;
 }
开发者ID:610152753,项目名称:tfs-1.4,代码行数:10,代码来源:server_status_message.cpp


示例14: deserialize

 int ReportCheckBlockMessage::deserialize(common::Stream& input)
 {
   int64_t pos = 0;
   int ret = param_.deserialize(input.get_data(), input.get_data_length(), pos);
   if (TFS_SUCCESS == ret)
   {
     input.drain(param_.length());
   }
   return ret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:10,代码来源:checkserver_message.cpp


示例15: serialize

 int MasterAndSlaveHeartMessage::serialize(common::Stream& output) const 
 {
   int64_t pos = 0;
   int32_t iret = ns_identity_.serialize(output.get_free(), output.get_free_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     output.pour(length());
   }
   return iret;
 }
开发者ID:610152753,项目名称:tfs-1.4,代码行数:10,代码来源:heart_message.cpp


示例16: deserialize

 int ClientCmdMessage::deserialize(common::Stream& input)
 {
   int64_t pos = 0;
   int32_t iret = info_.deserialize(input.get_data(), input.get_data_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     input.drain(info_.length());
   }
   return iret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:10,代码来源:client_cmd_message.cpp


示例17: serialize

 int ClientCmdMessage::serialize(common::Stream& output) const
 {
   int64_t pos = 0;
   int32_t iret = info_.serialize(output.get_free(), output.get_free_length(), pos);
   if (common::TFS_SUCCESS == iret)
   {
     output.pour(info_.length());
   }
   return iret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:10,代码来源:client_cmd_message.cpp


示例18: deserialize

 int RespHeartMessage::deserialize(common::Stream& input)
 {
   int32_t ret = input.get_int32(&status_);
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&heart_interval_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&max_mr_network_bandwith_mb_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int32(&max_rw_network_bandwith_mb_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int8(&ns_role_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int8(&enable_old_interface_);
   }
   if (common::TFS_SUCCESS == ret)
   {
     ret = input.get_int8(&enable_version_check_);
   }
   if (common::TFS_SUCCESS == ret && input.get_data_length() > 0)
   {
     ret = input.get_int32(&verify_index_reserved_space_ratio_);
   }
   return ret;
 }
开发者ID:alimy,项目名称:tfs,代码行数:33,代码来源:heart_message.cpp


示例19:

    int ReadRawdataRespMessageV2::serialize(common::Stream& output) const
    {
      int ret = output.set_int32(length_);
      if (TFS_SUCCESS == ret)
      {
        if ((length_ > 0) && (NULL != data_))
        {
          ret = output.set_bytes(data_, length_);
        }
      }

      return ret;
    }
开发者ID:alimy,项目名称:tfs,代码行数:13,代码来源:read_data_message_v2.cpp


示例20: serialize

 int GetTableFromRtsResponseMessage::serialize(common::Stream& output) const 
 {
   int32_t iret = output.set_int64(version_);
   if (common::TFS_SUCCESS == iret)
   {
     iret = output.set_int64(length_);
   }
   if (common::TFS_SUCCESS == iret)
   {
     iret = output.set_bytes(tables_, length_);
   }
   return iret;
 }
开发者ID:0huah0,项目名称:tfs,代码行数:13,代码来源:get_tables_from_rts_message.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ common::String类代码示例发布时间:2022-05-31
下一篇:
C++ common::Serializer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap