本文整理汇总了C++中StringBuilder::get_buffer方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuilder::get_buffer方法的具体用法?C++ StringBuilder::get_buffer怎么用?C++ StringBuilder::get_buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuilder
的用法示例。
在下文中一共展示了StringBuilder::get_buffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringBuilder
StringBuilder *MatchRecorder::export_str_player() {
int flag = 0; // 什么也不做
/* if (_penalty_count > 0) // 点球大战计数器
{
_reverse = 0; // 方向进攻方向
if (_penalty_count % 2 == 0) {
flag = 1; // player_id 取反
}
}*/
StringBuilder *str = new StringBuilder(40*1024); // 压缩前长度
MsgMatchPlayerRoundData msg;//= new MsgMatchRoundData();
msg.mid = 1;
msg.player_count = RECORDER_PLAYER_COUNT;
str->append((const char*) &msg, sizeof(msg) - sizeof(void*));
for (int i = 0; i < RECORDER_PLAYER_COUNT; ++i) {
PlayerRoundInfo info;
info.time_sacle_numbers = _players_frames[i].size();
info.pid = (*_players_frames[i].begin())->get_player_id();
info.cond = (*_players_frames[i].begin())->get_player_cond();
str->append((const char*) &info, sizeof(info) - sizeof(void*));
save_data(_players_frames[i].begin(), _players_frames[i].end(), str,
_reverse, _is_half, flag);
}
((MsgMatchPlayerRoundData*) str->get_buffer())->msg_size = str->len();
return str;
}