本文整理汇总了C++中sf::Archive::getRuntimeVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ Archive::getRuntimeVersion方法的具体用法?C++ Archive::getRuntimeVersion怎么用?C++ Archive::getRuntimeVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Archive
的用法示例。
在下文中一共展示了Archive::getRuntimeVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void RemoteException::serialize(SF::Archive &ar)
{
if (ar.getRuntimeVersion() <= 5)
{
int errorId = mError.getErrorId();
ar
& mWhat
& mContext
& errorId
& mSubSystemError
& mSubSystem
& mRemoteExceptionType;
if (ar.isRead())
{
mError.setErrorId(errorId);
}
}
else
{
ar
& mWhat
& mContext
& mError
& mSubSystemError
& mSubSystem
& mRemoteExceptionType;
}
}
示例2: serializeEncodedString
inline void serializeEncodedString(SF::Archive & ar, std::basic_string<C,T,A> & ws)
{
if (ar.getRuntimeVersion() < 8)
{
serializeString(ar, ws);
return;
}
RCF_ASSERT_GTEQ(ar.getRuntimeVersion() , 8);
if (ar.isRead())
{
int encodingType = 0;
ar & encodingType;
if (encodingType == 8)
{
// UTF-8 serialization.
std::string s;
ar & s;
ws = RcfBoost::boost::from_utf8(s);
}
else
{
// Native wchar_t serialization.
RCF_VERIFY(
encodingType == sizeof(wchar_t),
RCF::Exception(
RCF::_RcfError_WcharSizeMismatch(sizeof(wchar_t), encodingType)));
serializeString(ar, ws);
}
}
else if (ar.isWrite())
{
bool useNativeWstringSerialization = SF::getCurrentNativeWstringSerialization();
int encodingType = sizeof(wchar_t);
if (useNativeWstringSerialization)
{
encodingType = sizeof(wchar_t);
}
else
{
encodingType = 8;
}
ar & encodingType;
if (encodingType == 8)
{
// UTF-8 serialization.
std::string s = RcfBoost::boost::to_utf8(ws);
ar & s;
}
else
{
// Native wchar_t serialization.
RCF_VERIFY(
encodingType == sizeof(wchar_t),
RCF::Exception(
RCF::_RcfError_WcharSizeMismatch(sizeof(wchar_t), encodingType)));
serializeString(ar, ws);
}
}
}