本文整理汇总了C++中CArchive::GetObjectSchema方法的典型用法代码示例。如果您正苦于以下问题:C++ CArchive::GetObjectSchema方法的具体用法?C++ CArchive::GetObjectSchema怎么用?C++ CArchive::GetObjectSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArchive
的用法示例。
在下文中一共展示了CArchive::GetObjectSchema方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void COXChildFrameState::Serialize(CArchive& ar)
{
ASSERT_VALID(this);
// Check the version
// (If version == -1, the version is unknown, this occurs when Serialize() is called directly)
if (ar.IsLoading())
{
m_nSerializeSchemaVersionLoad = (int)ar.GetObjectSchema();
if (m_nSerializeSchemaVersion < m_nSerializeSchemaVersionLoad)
{
TRACE1("COXChildFrameState::Serialize : Unexpected schema version : %i, throwing CArchiveException\n",
m_nSerializeSchemaVersionLoad);
AfxThrowArchiveException(CArchiveException::badSchema);
}
}
// Call base class implementation
CObject::Serialize(ar);
// Serialize all data
if (ar.IsStoring())
StoreProperties(ar);
else
LoadProperties(ar);
ASSERT_VALID(this);
}
示例2: Serialize
void CSchemaObject::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if (ar.IsLoading())
{
int nVersion = ar.GetObjectSchema();
switch(nVersion)
{
case 0:
// read in previous version of
// this object
break;
case 1:
// read in current version of
// this object
break;
default:
// report unknown version of
// this object
break;
}
}
else
{
// Normal storing code goes here
}
}
示例3: Serialize
void CBigBrotherDoc::Serialize(CArchive& ar)
{
ASSERT_VALID(this);
CDocument::Serialize(ar);
ar.MapObject(this);
ar.SerializeClass(RUNTIME_CLASS(CBigBrotherDoc));
if (ar.IsStoring())
{
// Store to archive
ar << m_PingSize;
ar << m_MaxThreads;
ar << m_MaxLogTime;
ar << m_bSaveOnShutdown;
ar << m_AutoSave;
ar << m_LogFile;
ar << m_bStoreLastActivity;
ar << m_RootBrother;
m_Brotherhood.Serialize(ar);
}
else
{
UINT schema = ar.GetObjectSchema();
#ifndef NDEBUG
{
CString tmp;
tmp.Format("Doc-OSchema: %u\n",schema);
TRACE0(tmp);
}
#endif
CleanUp();
m_ThisMap.RemoveAll();
// Read from archive
ar >> m_PingSize;
ar >> m_MaxThreads;
ar >> m_MaxLogTime;
if(schema>=2){
ar >> m_bSaveOnShutdown;
ar >> m_AutoSave;
}
ar >> m_LogFile;
if(schema>=3)
ar >> m_bStoreLastActivity;
ar >> m_RootBrother;
m_Brotherhood.Serialize(ar);
// Read from archive
m_ThisMap.RemoveAll();
// Log loading
CString logLine;
logLine.Format(IDS_LOG_LOADFILE,(LPCTSTR)GetTitle());
logLine=CTime::GetCurrentTime().Format(IDS_LOG_DATEFORMAT)+" "+logLine;
LogLine(logLine);
}
示例4: Serialize
// overloading save and load procedures
void CExponent::Serialize(CArchive& ar)
{
UINT t=0;
if (ar.IsStoring())
{
if (m_Method!=NULL) t=m_Method->GetType();
ar << m_Name << m_Description << m_Grad << m_Type << m_scale << t << m_dMaxValue << m_dMinValue << m_iDirBest << m_id;
if (m_Method!=NULL) m_Method->SerializeNew(ar);
}
else
{
int nVersion = ar.GetObjectSchema();
switch(nVersion)
{
case 1:
// read in previous version of
// this object
ar >> m_Name >> m_Description >> m_Grad >> m_Type >> m_scale >> t;
break;
case 2:
ar >> m_Name >> m_Description >> m_Grad >> m_Type >> m_scale >> t >> m_dMaxValue >> m_dMinValue >> m_iDirBest;
break;
case 3:
// read in current version of
// this object
ar >> m_Name >> m_Description >> m_Grad >> m_Type >> m_scale >> t >> m_dMaxValue >> m_dMinValue >> m_iDirBest >> m_id;
break;
default:
// report unknown version of
// this object
TRACE("unknown version!!!");
break;
}
if (t)
{
CMethodFactory f;
m_Method=f.CreateObject(t);
if (nVersion<3) m_Method->Serialize(ar);
else m_Method->SerializeNew(ar);
m_Method->m_pE=this;
}
};
}