本文整理汇总了C++中ContentFeatures::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentFeatures::serialize方法的具体用法?C++ ContentFeatures::serialize怎么用?C++ ContentFeatures::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentFeatures
的用法示例。
在下文中一共展示了ContentFeatures::serialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void serialize(std::ostream &os, u16 protocol_version)
{
writeU8(os, 1); // version
u16 count = 0;
std::ostringstream os2(std::ios::binary);
for(u32 i=0; i<m_content_features.size(); i++)
{
if(i == CONTENT_IGNORE || i == CONTENT_AIR
|| i == CONTENT_UNKNOWN)
continue;
ContentFeatures *f = &m_content_features[i];
if(f->name == "")
continue;
writeU16(os2, i);
// Wrap it in a string to allow different lengths without
// strict version incompatibilities
std::ostringstream wrapper_os(std::ios::binary);
f->serialize(wrapper_os, protocol_version);
os2<<serializeString(wrapper_os.str());
assert(count + 1 > count); // must not overflow
count++;
}
writeU16(os, count);
os<<serializeLongString(os2.str());
}
示例2: serialize
void serialize(std::ostream &os)
{
u16 count = 0;
std::ostringstream tmp_os(std::ios::binary);
for(u16 i=0; i<=MAX_CONTENT; i++)
{
if(i == CONTENT_IGNORE || i == CONTENT_AIR)
continue;
ContentFeatures *f = &m_content_features[i];
if(f->name == "")
continue;
writeU16(tmp_os, i);
f->serialize(tmp_os);
count++;
}
writeU16(os, count);
os<<serializeLongString(tmp_os.str());
}
示例3: serialize
void serialize(std::ostream &os)
{
writeU8(os, 1); // version
u16 count = 0;
std::ostringstream os2(std::ios::binary);
for(u16 i=0; i<=MAX_CONTENT; i++)
{
if(i == CONTENT_IGNORE || i == CONTENT_AIR)
continue;
ContentFeatures *f = &m_content_features[i];
if(f->name == "")
continue;
writeU16(os2, i);
// Wrap it in a string to allow different lengths without
// strict version incompatibilities
std::ostringstream wrapper_os(std::ios::binary);
f->serialize(wrapper_os);
os2<<serializeString(wrapper_os.str());
count++;
}
writeU16(os, count);
os<<serializeLongString(os2.str());
}