本文整理汇总了C++中creg::ISerializer::IsWriting方法的典型用法代码示例。如果您正苦于以下问题:C++ ISerializer::IsWriting方法的具体用法?C++ ISerializer::IsWriting怎么用?C++ ISerializer::IsWriting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类creg::ISerializer
的用法示例。
在下文中一共展示了ISerializer::IsWriting方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SerializeColor
void SerializeColor(creg::ISerializer &s, unsigned char **color)
{
if (s.IsWriting()) {
char ColorType = 0;
char ColorId = 0;
if (!ColorType)
for (int a = 0; a < teamHandler->ActiveTeams(); ++a)
if (*color==teamHandler->Team(a)->color) {
ColorType = 1;
ColorId = a;
break;
}
s.Serialize(&ColorId,sizeof(ColorId));
s.Serialize(&ColorType,sizeof(ColorType));
} else {
char ColorType;
char ColorId;
s.Serialize(&ColorId,sizeof(ColorId));
s.Serialize(&ColorType,sizeof(ColorType));
switch (ColorType) {
case 0:{
*color = DefaultColor;
break;
}
case 1:{
*color = teamHandler->Team(ColorId)->color;
break;
}
}
}
}
示例2: SerializeColor
void SerializeColor(creg::ISerializer &s, unsigned char **color)
{
if (s.IsWriting()) {
char ColorType = 0;
char ColorId = 0;
if (!ColorType) for (int a=0;a<MAX_TEAMS;a++)
if (*color==gs->Team(a)->color) {
ColorType = 1;
ColorId = a;
break;
}
s.Serialize(&ColorId,sizeof(ColorId));
s.Serialize(&ColorType,sizeof(ColorType));
} else {
char ColorType;
char ColorId;
s.Serialize(&ColorId,sizeof(ColorId));
s.Serialize(&ColorType,sizeof(ColorType));
switch (ColorType) {
case 0:{
*color = DefaultColor;
break;
}
case 1:{
*color = gs->Team(ColorId)->color;
break;
}
}
}
}
示例3: SerializeString
static void SerializeString(creg::ISerializer& s, std::string& str)
{
unsigned short size = (unsigned short)str.length();
s.Serialize(&size,2);
if (!s.IsWriting())
str.resize(size);
s.Serialize(&str[0], size);
}
示例4: Serialize
void spring_time::Serialize(creg::ISerializer& s)
{
if (s.IsWriting()) {
int y = spring_tomsecs(*this - spring_gettime());
s.SerializeInt(&y, 4);
} else {
int y;
s.SerializeInt(&y, 4);
*this = *this + spring_msecs(y);
}
}