本文整理汇总了C++中CoreObject::deserialize方法的典型用法代码示例。如果您正苦于以下问题:C++ CoreObject::deserialize方法的具体用法?C++ CoreObject::deserialize怎么用?C++ CoreObject::deserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreObject
的用法示例。
在下文中一共展示了CoreObject::deserialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
Item::e_sercode Item::deserialize( Stream *file, VMachine *vm )
{
byte type = FLC_ITEM_NIL;
if ( file->read((byte *) &type, 1 ) == 0 )
return sc_eof;
if( ! file->good() )
return sc_ferror;
switch( type )
{
case FLC_ITEM_NIL:
setNil();
return sc_ok;
case FLC_ITEM_UNB:
setUnbound();
return sc_ok;
case FLC_ITEM_BOOL:
{
byte bval;
file->read( (byte *) &bval, sizeof( bval ) );
if ( file->good() ) {
setBoolean( bval != 0 );
return sc_ok;
}
return sc_ferror;
}
return sc_ok;
case FLC_ITEM_INT:
{
int64 val;
file->read( (byte *) &val, sizeof( val ) );
if ( file->good() ) {
setInteger(endianInt64(val) );
return sc_ok;
}
return sc_ferror;
}
break;
case FLC_ITEM_RANGE:
{
int64 val1;
int64 val2;
int64 val3;
//byte isOpen;
file->read( (byte *) &val1, sizeof( val1 ) );
file->read( (byte *) &val2, sizeof( val2 ) );
file->read( (byte *) &val3, sizeof( val3 ) );
//file->read( (byte *) &isOpen, sizeof( isOpen ) );
val1 = endianInt64( val1 );
val2 = endianInt64( val2 );
val3 = endianInt64( val3 );
if ( file->good() ) {
setRange( new CoreRange( val1, val2, val3 ) );
return sc_ok;
}
return sc_ferror;
}
break;
case FLC_ITEM_NUM:
{
numeric val;
file->read( (byte *) &val, sizeof( val ) );
if ( file->good() ) {
setNumeric( endianNum( val ) );
return sc_ok;
}
return sc_ferror;
}
break;
case FLC_ITEM_LBIND:
{
int32 id;
file->read( (byte*) &id, sizeof(id) );
String name;
if ( ! name.deserialize( file ) )
return file->bad() ? sc_ferror : sc_invformat;
setLBind( new CoreString( name ) );
}
break;
case FLC_ITEM_STRING:
{
CoreString *cs = new CoreString;
setString( cs );
if ( ! cs->deserialize( file ) )
{
return file->bad() ? sc_ferror : sc_invformat;
}
//.........这里部分代码省略.........