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


C++ IArchive::Write方法代码示例

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


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

示例1: SerializeStaticItemBool

void COptionTreeWrapper::SerializeStaticItemBool(IArchive &ar, COptionTreeItem *item, bool read)
{
	bool bVal;
	COptionTreeItemStatic *otiStatic;
	CString text;

	otiStatic = dynamic_cast<COptionTreeItemStatic*>(item);
	if(otiStatic == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemStatic: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if(read)
	{
		ar.Read(bVal);
		otiStatic->SetStaticText( bVal ? _T("true") : _T("false")  );
	}
	else
	{
		text = otiStatic->GetStaticText();
		if (_tcscmp( text, _T("true") ) == 0)
			ar.Write(true);
		else
			ar.Write(false);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:29,代码来源:COptionTreeWrapper.cpp

示例2: Serialize

void CQHState::Serialize( IArchive &ar )
{
	if( ar.IsReading() )
	{
		float fVersion;
		ar.Read( fVersion, _T("version") );

		if( 1.2f == fVersion )
		{
			ReadFromVersion_1_2( ar );
		}
		else if( 1.1f == fVersion )
		{
			ReadFromVersion_1_1( ar );
		}
		else if( 1.0f == fVersion )
		{
			ReadFromVersion_1_0( ar );
		}
		else
		{
			LPCTSTR fmt = _T("%s(%d): Unsupported version (%f) of state machine state");
			m_ToolBox->Log( LOGERROR, fmt, __FILE__, __LINE__, fVersion );
			return;
		}
	}
	else
	{
		ar.Write( m_fCurrentVersion, _T("version") );
		ar.Write( m_Name.GetString(), _T("name") );
		ar.Write( m_EntryEvent.GetString(), _T("entryEvent") );
		ar.Write( m_UpdateEvent.GetString(), _T("updateEvent") );
		ar.Write( m_ExitEvent.GetString(), _T("exitEvent") );
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:35,代码来源:QHState.cpp

示例3: CreateScene

void CModelViewRender::CreateScene()
{
    Vec3 v3Zero(0.0f, 0.0f, 0.0f);
    EulerAngle eZero;
    Vec3 v3Scale(1.0f,1.0f,1.0f);
    StdString szEntityType(_T("EditorObject"));

    IArchive *pArchive = CreateMemoryArchive();
    pArchive->Write(_T("EditorObject"), _T("EntityType"));
    pArchive->Write(v3Zero, _T("Position"));
    pArchive->Write(eZero, _T("Rotation"));
    pArchive->Write(v3Scale, _T("Scale"));
    pArchive->SetIsWriting(false);

    // Create Instance of CEntity
    static CHashString hszEntity(_T("CEntity"));
    CreateEEObject(&m_hszSceneName, &hszEntity, m_hszEntityName, pArchive);

    pArchive->Close();

    m_v3Position.Set(0, 0, 0);
    m_v3CameraPos.Set(0.0f, 0.0f, 200.0f);
    m_v3Rotation.Set(0.0f, 0.0f, 0.0f);

    LoadModel();
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:26,代码来源:ModelViewRender.cpp

示例4: Serialize

void CDetailObject::Serialize( IArchive &ar )
{
	StdString temp;
	if(ar.IsReading())
	{
		ar.Read(temp, "LayerLink");
		m_LayerLink = temp.c_str();
		ar.Read(temp, "ModelName");
		m_ModelName = temp.c_str();
		ar.Read(m_XCoverage, "XCoverage");
		ar.Read(m_YCoverage, "YCoverage");
		ar.Read(m_XRandomness, "XRandomness");
		ar.Read(m_YRandomness, "YRandomness");
		ar.Read(m_MinScale, "MinScale");
		ar.Read(m_MinScale, "MaxScale");
		ar.Read(m_MinYaw, "MinYaw");
		ar.Read(m_MaxYaw, "MaxYaw");
	}
	else
	{
		ar.Write(m_LayerLink.GetString(), "LayerLink");
		ar.Write(m_ModelName.GetString(), "ModelName");
		ar.Write(m_XCoverage, "XCoverage");
		ar.Write(m_YCoverage, "YCoverage");
		ar.Write(m_XRandomness, "XRandomness");
		ar.Write(m_YRandomness, "YRandomness");
		ar.Write(m_MinScale, "MinScale");
		ar.Write(m_MinScale, "MaxScale");
		ar.Write(m_MinYaw, "MinYaw");
		ar.Write(m_MaxYaw, "MaxYaw");
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:32,代码来源:DetailObject.cpp

示例5: LoadModel

void CModelViewRender::LoadModel()
{
    ASSERT(GetDocument() != NULL);
    CString strPath = GetDocument()->GetPathName();
    LPCTSTR szPath = strPath;
    TCHAR extStr[_MAX_EXT];
    TCHAR fileName[_MAX_FNAME];
    _tsplitpath(szPath, NULL, NULL, fileName, extStr);

    if (strPath.IsEmpty())
    {
        m_ToolBox->Log(LOGWARNING, _T("%s(%i):LoadModel shouldn't have been called with NULL path\n"), __FILE__, __LINE__);
        return;
    }

    StdString szFilename = fileName;
    szFilename += extStr;
    m_hszModelName = szFilename;

    CFileVersionSetter setter( _T("2.5") );

    if (0 == _tcsicmp(extStr, _T(".cfg")))
    {
        IArchive *pArchive = CreateMemoryArchive();
        if (pArchive != NULL)
        {
            pArchive->Write(szPath, _T("Filepath"));
            pArchive->SetIsWriting(false);
            static CHashString hszCal3DRenderObject(_T("Cal3DRenderObject"));
            CreateEEObject(&m_hszEntityName, &hszCal3DRenderObject, m_hszModelName, pArchive);
            FillAnimationList();
            pArchive->Close();
        }
    }
    else if (0 == _tcsicmp(extStr, _T(".hrc")))
    {
        IArchive *pArchive = CreateMemoryArchive();
        if (pArchive != NULL)
        {
            pArchive->Write(szPath);
            pArchive->SetIsWriting(false);
            static CHashString hszCal3DRenderObject(_T("CHierarchicalModel"));
            CreateEEObject(&m_hszEntityName, &hszCal3DRenderObject, m_hszModelName, pArchive);
            pArchive->Close();
        }
    }
    else
    {
        m_ToolBox->Log(LOGWARNING, _T("%s(%i):LoadModel was passed %s extension, which is not recognized\n"), __FILE__, __LINE__, extStr);
    }
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:51,代码来源:ModelViewRender.cpp

示例6: SerializeStaticItemDouble

void COptionTreeWrapper::SerializeStaticItemDouble(IArchive &ar, COptionTreeItem *item, bool read)
{
	double dVal;
	COptionTreeItemStatic *otiStatic;
	TCHAR buff[50];
	CString text;

	otiStatic = dynamic_cast<COptionTreeItemStatic*>(item);
	if(otiStatic == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemStatic: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if(read)
	{
		ar.Read(dVal);
		_stprintf(buff, "%g", dVal);
		otiStatic->SetStaticText(buff);
	}
	else
	{
		text = otiStatic->GetStaticText();
		dVal = _tstof(text);

		ar.Write(dVal);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:30,代码来源:COptionTreeWrapper.cpp

示例7: SerializeStaticItemInt

void COptionTreeWrapper::SerializeStaticItemInt(IArchive &ar, COptionTreeItem *item, bool read)
{
	int iVal;
	COptionTreeItemStatic *otiStatic;
	TCHAR buffer[50];
	CString text;

	otiStatic = dynamic_cast<COptionTreeItemStatic*>(item);
	if(otiStatic == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemStatic: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if(read)
	{
		ar.Read(iVal);
		_itot(iVal, buffer, 10);
		otiStatic->SetStaticText(buffer);
	}
	else
	{
		text = otiStatic->GetStaticText();
		iVal = _tstoi(text);
		ar.Write(iVal);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:29,代码来源:COptionTreeWrapper.cpp

示例8: SerializeEditItemString

void COptionTreeWrapper::SerializeEditItemString(IArchive &ar, COptionTreeItem *item, bool read)
{	
	StdString szString;
	COptionTreeItemEdit *otiEdit;
	
	CString szItem;
	otiEdit = dynamic_cast<COptionTreeItemEdit*>(item);
	if(otiEdit == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemEdit: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}

	otiEdit->CreateEditItem(0, NULL);

	if (read)
	{
		ar.Read(szString);
		otiEdit->SetEditText(szString.c_str());
	}
	else
	{
		otiEdit->GetWindowText(szItem);
		ar.Write(szItem);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:29,代码来源:COptionTreeWrapper.cpp

示例9: SerializeEditItemDouble

void COptionTreeWrapper::SerializeEditItemDouble(IArchive &ar, COptionTreeItem *item, bool read)
{
	double dVal;
	COptionTreeItemEdit *otiEdit;

	otiEdit = dynamic_cast<COptionTreeItemEdit*>(item);
	
	if(otiEdit == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemEdit: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}

	otiEdit->CreateEditItem(OT_EDIT_NUMERICAL, NULL);

	if(read)
	{
		ar.Read(dVal);
		otiEdit->SetEditDouble(dVal);
	}
	else
	{
		otiEdit->GetEditDouble(dVal);
		ar.Write(dVal);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:29,代码来源:COptionTreeWrapper.cpp

示例10: GetType

DWORD CSchemaItem::GetType( DATABASEATTRIBUTEPARAMS *databaseAttributeParams )
{
	DWORD retVal = MSG_NOT_HANDLED;
	if( databaseAttributeParams != NULL )
	{
		
		if( databaseAttributeParams->m_AttributeTypeArchive != NULL )
		{
			IArchive *ar = databaseAttributeParams->m_AttributeTypeArchive;
			ar->SetIsWriting( true );
			ar->SeekTo( 0 );
			ar->Write( m_hszType.GetString() );
		}
		else
		{
			m_ToolBox->Log( LOGWARNING, _T("No archive specified for GetAttributeType.\n") );
		}

		retVal = MSG_HANDLED_STOP;
	}
	else
	{
		m_ToolBox->Log( LOGWARNING, _T("Attribute parameters not defined.\n") );
	}

	return retVal;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:27,代码来源:SchemaItem.cpp

示例11: SerializeStaticItemString

void COptionTreeWrapper::SerializeStaticItemString(IArchive &ar, COptionTreeItem *item, bool read)
{
	StdString szString;
	COptionTreeItemStatic *otiStatic = dynamic_cast<COptionTreeItemStatic*>(item);

	CString szItem;
	if(otiStatic == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemStatic: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if(read)
	{
		ar.Read(szString);
		otiStatic->SetStaticText(szString.c_str());
	}
	else
	{
		szItem = otiStatic->GetStaticText();
		ar.Write(szItem);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:25,代码来源:COptionTreeWrapper.cpp

示例12: SerializeCheckBoxItem

void COptionTreeWrapper::SerializeCheckBoxItem(IArchive &ar, COptionTreeItem *item, bool read)
{
	bool bVal;
	COptionTreeItemCheckBox *otiCheckBox;

	otiCheckBox = dynamic_cast<COptionTreeItemCheckBox*>(item);
	if(otiCheckBox == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemCheckBox: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if(read)
	{
		ar.Read(bVal);
		otiCheckBox->SetCheck(bVal);
	}
	else
	{
		bVal = (otiCheckBox->GetCheck() != 0);
		ar.Write(bVal);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:25,代码来源:COptionTreeWrapper.cpp

示例13: SerializeSpinnerItemDouble

void COptionTreeWrapper::SerializeSpinnerItemDouble(IArchive &ar, COptionTreeItem *item, bool read)
{
	double dVal;
	COptionTreeItemSpinner *otiSpinner;

	otiSpinner = dynamic_cast<COptionTreeItemSpinner*>(item);
	if (otiSpinner == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemSpinner: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if (read)
	{
		ar.Read(dVal);
		otiSpinner->SetEditDouble(dVal);
	}
	else
	{
		otiSpinner->GetEditDouble(dVal);
		ar.Write(dVal);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:25,代码来源:COptionTreeWrapper.cpp

示例14: CreateAndFillArchive

IArchive* CGUIStaticText::CreateAndFillArchive()
{
	if (m_LanguageTextParams)
	{
		CREATEARCHIVE ca;
		static CHashString memType(_T("Memory"));

		ca.mode = STREAM_MODE_WRITE | STREAM_MODE_READ;
		ca.streamData = NULL;
		ca.streamSize = 0;
		ca.streamType = &memType;
		static DWORD msgHash_CreateArchive = CHashString(_T("CreateArchive")).GetUniqueID();
		m_ToolBox->SendMessage(msgHash_CreateArchive, sizeof(CREATEARCHIVE), &ca);

		IArchive *ar = ca.archive;
		if (ar)
		{
			ar->SetIsWriting(true);
			ar->SeekTo(0);
			ar->Write(m_LanguageTextParams, m_iLangTextParamSize);
		}
		return ar;
	}
	else
	{
		return NULL;
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:28,代码来源:CGUIStaticText.cpp

示例15: SerializeRadioItem

void COptionTreeWrapper::SerializeRadioItem(IArchive &ar, COptionTreeItem *item, bool read)
{
	StdString szVal;
	COptionTreeItemRadio *otiRadio;
	OT_RADIO_NODE *node;
	int index;

	otiRadio = dynamic_cast<COptionTreeItemRadio*>(item);
	if (item == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemRadio: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if (read)
	{
		ar.Read(szVal);
		node = otiRadio->Node_FindNode(szVal.c_str());
		if (node != NULL)
		{	
			otiRadio->Node_UnCheckAll();
			node->m_bChecked = true;
		}	
	}
	else
	{
		index = otiRadio->Node_GetChecked();
		node = otiRadio->Node_FindNode(index);
		ar.Write(node->m_strText);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:33,代码来源:COptionTreeWrapper.cpp


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