本文整理汇总了C++中msgpack::packer::pack_map方法的典型用法代码示例。如果您正苦于以下问题:C++ packer::pack_map方法的具体用法?C++ packer::pack_map怎么用?C++ packer::pack_map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msgpack::packer
的用法示例。
在下文中一共展示了packer::pack_map方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msgpack_pack
void TileDef::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const
{
pk.pack_map(8);
PACK(TILEDEF_NAME, name);
PACK(TILEDEF_ANIMATION_TYPE, (int)animation.type);
PACK(TILEDEF_ANIMATION_ASPECT_W, animation.aspect_w);
PACK(TILEDEF_ANIMATION_ASPECT_H, animation.aspect_h);
PACK(TILEDEF_ANIMATION_LENGTH, animation.length);
PACK(TILEDEF_BACKFACE_CULLING, backface_culling);
PACK(TILEDEF_TILEABLE_VERTICAL, tileable_vertical);
PACK(TILEDEF_TILEABLE_HORIZONTAL, tileable_horizontal);
}
示例2: pack
static inline
void
pack(msgpack::packer<Stream>& packer, const Json::Value& source) {
switch(source.type()) {
case Json::objectValue: {
packer.pack_map(source.size());
const Json::Value::Members keys(source.getMemberNames());
for(auto it = keys.begin(); it != keys.end(); ++it) {
packer << *it;
pack(packer, source[*it]);
}
} break;
case Json::arrayValue: {
packer.pack_array(source.size());
for(auto it = source.begin(); it != source.end(); ++it) {
pack(packer, *it);
}
} break;
case Json::booleanValue: {
packer << source.asBool();
} break;
case Json::stringValue: {
packer << source.asString();
} break;
case Json::realValue: {
packer << source.asDouble();
} break;
case Json::intValue: {
packer << source.asLargestInt();
} break;
case Json::uintValue: {
packer << source.asLargestUInt();
} break;
case Json::nullValue: {
packer << msgpack::type::nil();
}}
}
示例3: msgpack_pack
void PointedThing::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const {
static int sizes[3] = {1, 3, 2};
int t = static_cast<int>(type);
pk.pack_map(sizes[t]);
PACK(POINTEDTHING_TYPE, t);
switch (type) {
case POINTEDTHING_NOTHING:
break;
case POINTEDTHING_NODE:
PACK(POINTEDTHING_UNDER, node_undersurface);
PACK(POINTEDTHING_ABOVE, node_abovesurface);
break;
case POINTEDTHING_OBJECT:
PACK(POINTEDTHING_OBJECT_ID, object_id);
break;
}
}