本文整理汇总了C++中PropWriteStream::addLongString方法的典型用法代码示例。如果您正苦于以下问题:C++ PropWriteStream::addLongString方法的具体用法?C++ PropWriteStream::addLongString怎么用?C++ PropWriteStream::addLongString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropWriteStream
的用法示例。
在下文中一共展示了PropWriteStream::addLongString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void ItemAttribute::serialize(PropWriteStream& stream) const
{
bool ok;
if(m_data.type() == typeid(std::string))
{
stream.addByte((uint8_t)STRING);
stream.addLongString(getString(ok));
}
else if(m_data.type() == typeid(int32_t))
{
stream.addByte((uint8_t)INTEGER);
stream.addLong(getInteger(ok));
}
else if(m_data.type() == typeid(float))
{
stream.addByte((uint8_t)FLOAT);
stream.addLong(getFloat(ok));
}
else if(m_data.type() == typeid(bool))
{
stream.addByte((uint8_t)BOOLEAN);
stream.addByte(getBoolean(ok));
}
else
std::clog << "[ItemAttribute::serialize]: Invalid data type." << std::endl;
}
示例2: serialize
void ItemAttribute::serialize(PropWriteStream& stream) const
{
stream.addByte((uint8_t)type);
switch(type)
{
case STRING:
stream.addLongString(*getString());
break;
case INTEGER:
stream.addLong(*(uint32_t*)getInteger());
break;
case FLOAT:
stream.addLong(*(uint32_t*)getFloat());
break;
case BOOLEAN:
stream.addByte(*(uint8_t*)getBoolean());
default:
break;
}
}