本文整理汇总了C++中IObject::Serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ IObject::Serialize方法的具体用法?C++ IObject::Serialize怎么用?C++ IObject::Serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObject
的用法示例。
在下文中一共展示了IObject::Serialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Visit
bool CWorldVisitor::Visit( IComponent * component, bool bVisitEnter )
{
IObject *theObject;
IHashString *name;
IHashString *parentName;
IHashString *type;
StdString parentType;
StdString childType;
std::string str;
theObject = dynamic_cast<IObject *>(component);
// This shouldn't happen but it does for some odd reason....
assert(theObject);
if( theObject == NULL )
{
return false;
}
name = theObject->GetName();
parentName = theObject->GetParentName();
type = theObject->GetComponentType();
//Check to see if it is a valid object (for object exclusion)
if( !CheckObject( type->GetString() ) )
{
return true;
}
else
{
if ( name == NULL )
{
name = &CHashString(_T("NULL"));
}
if( bVisitEnter == true )
{
//if( (m_pArchiver != NULL) && ( _tcscmp( type->GetString(), _T("CPhysicsObject") ) != 0 ) )
if( (m_pArchiver != NULL) )
{
// Start the Node
m_pArchiver->StartClass( type->GetString() );
// Write out the Unique ID aka Name
m_pArchiver->Write( name->GetString(), _T("Name") );
theObject->Serialize( *m_pArchiver );
}
// Removal of CPhysShape and changes to CPhysicsObject
if( _tcscmp( type->GetString(), _T("CPhysicsObject") ) == 0 )
{
CPhysObjectStruct tmpCPhysObject;
StdString CPhyShapeFile;
StdString CPhyShapeFileOld;
// if it's parent is not a CTerrainSector Object
if( _tcsstr( name->GetString(), _T("Terrain") ) == NULL )
{
static DWORD msgHash_GetModelFileName = CHashString(_T("GetModelFileName")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_GetModelFileName, sizeof(StdString*), &CPhyShapeFile, parentName, NULL );
CPhyShapeFile += _T(".psl");
}
// CTerrainSector Object
else
{
CPhyShapeFile = _T("maps\\terrain.psl");
}
IArchive *PhysObjectIn;
IArchive *PhysObjectRead;
CHashString memTypePhysObjectIn(_T("Memory"));
int PhysObjectInMemSize = 1024 * 1024 * sizeof(char);
char* PhysObjectInMemChunk = new char[PhysObjectInMemSize];
memset( PhysObjectInMemChunk, 0, PhysObjectInMemSize );
CREATEARCHIVE caPhysObjectIn;
caPhysObjectIn.mode = STREAM_MODE_READ;
caPhysObjectIn.streamData = PhysObjectInMemChunk;
caPhysObjectIn.streamSize = PhysObjectInMemSize;
caPhysObjectIn.streamType = &memTypePhysObjectIn;
static DWORD msgHash_CreateArchive = CHashString(_T("CreateArchive")).GetUniqueID();
if (m_ToolBox->SendMessage(msgHash_CreateArchive, sizeof(CREATEARCHIVE), &caPhysObjectIn) != MSG_HANDLED)
{
return true;
}
PhysObjectIn = caPhysObjectIn.archive;
CREATESTREAM csPhysObjectIn;
csPhysObjectIn.streamData = caPhysObjectIn.streamData;
csPhysObjectIn.streamSize = caPhysObjectIn.streamSize;
csPhysObjectIn.mode = STREAM_MODE_WRITE;
static DWORD msgHash_CreateStream_Memory = CHashString(_T("CreateStream_Memory")).GetUniqueID();
if (m_ToolBox->SendMessage(msgHash_CreateStream_Memory, sizeof(CREATESTREAM), &csPhysObjectIn) != MSG_HANDLED)
{
return true;
}
PhysObjectIn->Init(csPhysObjectIn.openStream);
//.........这里部分代码省略.........