当前位置: 首页>>代码示例>>C++>>正文


C++ CArchive::GetObjectSchema方法代码示例

本文整理汇总了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);
	}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:28,代码来源:OXChildFrameState.cpp

示例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
   }
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:29,代码来源:carchive--getobjectschema_1.cpp

示例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);
	}
开发者ID:Anonymousvn,项目名称:bigbrother,代码行数:55,代码来源:BigBrotherDoc.cpp

示例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;
		}
	};
}
开发者ID:sudakov,项目名称:DSS-UTES,代码行数:45,代码来源:Exponent.cpp


注:本文中的CArchive::GetObjectSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。