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


C++ CObj::Serialize方法代码示例

本文整理汇总了C++中CObj::Serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ CObj::Serialize方法的具体用法?C++ CObj::Serialize怎么用?C++ CObj::Serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CObj的用法示例。


在下文中一共展示了CObj::Serialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Serialize

bool CLayout::Serialize(CArchive& ar)
{
	CString ExpectedName = "CLayout";
	int     Version      = 5;

	if (!SerializeClassHeader(ExpectedName, Version, ar))
		return false;

	g_pFrame = this;
	if(ar.IsLoading())
	{
		ar >> identifier >> m_w >> m_h >> m_Name >> m_clr >> m_unboundedScrolling >> application_background;
		
		m_ObjectFrameIsLockedTo = 0;
		m_oTemporyBehaviorInfo=0;	// used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
		m_pTempMovExt=0;	// used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
		m_oControlBehaviorInfo=0;	// If you tell a Behavior to be in control of the frame editor this is used
		m_pControlBehaviorExt=0;// If you tell a Behavior to be in control of the frame editor this is used
		m_pControlBehaviorData=0;	// If you tell a Behavior to be in control of the frame editor, this is used to serialize to once unlocked.
		m_pControlBehaviorDataSize=0;
		m_ParentObjectFrameIsLockedTo=0;

		objects.RemoveAll();
		long objCnt;

		ar >> objCnt;
		CObj *o;
		int i;
		for (i = 0; i < objCnt; i++) 
		{
			long nKey;
			ar >> nKey;
			o = new CObj();

			if (!o->Serialize(ar))
				return false;

			objects.SetAt(nKey, o);
		}

		ar >> objCnt;
		CLayer *layer;
		for (i = 0; i < objCnt; i++)
		{
			layer = new CLayer("", LAYER_NORMAL);

			if (!layer->Serialize(ar))
				return false;

			layers.AddTail(layer);
			if (i == 1)
				current_layer = layer;
		}

		if (Version < 4)
		{
			// add non-layout layer if one doesn't exist
			if (layers.GetHead()->m_layerType != LAYER_NONFRAME)
			{
				CString layer_name;
				layer_name.Format("Non-layout");
				CLayer* nonlayout_layer = new CLayer(layer_name, LAYER_NONFRAME);
				nonlayout_layer->m_state = LAYSTATE_HIDDEN;

				nonlayout_layer->m_layerID = application->m_layerID++;
				layers.AddHead(nonlayout_layer);
			}
		}

		ar >> temporary_event_sheet_id;

		// This changed in v2; make sure the function knows
		if (Version >= 2)
			layoutKeys.Serialize(ar, true);
		else
			layoutKeys.Serialize(ar, false);

		// V3: save grid details
		if (Version >= 3) {
			ar >> m_Grid >> m_SnapMovements >> m_SnapResize >> m_GridWidth >> m_GridHeight;
		}
开发者ID:aolko,项目名称:construct,代码行数:81,代码来源:CLayout.cpp


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