本文整理汇总了C++中IArchive::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ IArchive::Read方法的具体用法?C++ IArchive::Read怎么用?C++ IArchive::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IArchive
的用法示例。
在下文中一共展示了IArchive::Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateWorldEventTrigger
void CWorldEventToolPal::UpdateWorldEventTrigger( void )
{
static DWORD msgHash_FindObject = CHashString(_T("FindObject")).GetUniqueID();
static DWORD msgHash_GetComponentType = CHashString(_T("GetComponentType")).GetUniqueID();
static DWORD msgHash_CreateArchive = CHashString(_T("CreateArchive")).GetUniqueID();
static DWORD msgHash_SerializeObject = CHashString(_T("SerializeObject")).GetUniqueID();
static CHashString Hash_Type = CHashString(_T("CWorldEventTrigger"));
CString buf;
m_Name.GetLBText(m_Name.GetCurSel(), buf);
CHashString hszName((TCHAR*)buf.GetBuffer());
FINDOBJECTPARAMS param;
param.hszName = &hszName;
DWORD result = m_ToolBox->SendMessage(msgHash_FindObject, sizeof(FINDOBJECTPARAMS), ¶m);
// object exists
if( param.bFound == true )
{
GETCOMPONENTTYPEPARAMS gctp;
gctp.name = &hszName;
m_ToolBox->SendMessage(msgHash_GetComponentType, sizeof(gctp), &gctp);
// it is a world event, get values from it
if ( (gctp.componenttype != NULL) && (gctp.componenttype->GetUniqueID() == Hash_Type.GetUniqueID()) )
{
CREATEARCHIVE ca;
CHashString streamType(_T("Memory"));
ca.streamData = NULL;
ca.mode = STREAM_MODE_WRITE | STREAM_MODE_READ;
ca.streamType = &streamType;
m_ToolBox->SendMessage(msgHash_CreateArchive, sizeof(CREATEARCHIVE), &ca, NULL, NULL);
IArchive *MemArchive = (ca.archive);
MemArchive->SetIsWriting(true);
MemArchive->SeekTo(0);
SERIALIZEOBJECTPARAMS sop;
sop.name = &hszName;
sop.archive = MemArchive;
m_ToolBox->SendMessage(msgHash_SerializeObject, sizeof(SERIALIZEOBJECTPARAMS), &sop, NULL, NULL);
MemArchive->SetIsWriting(false);
MemArchive->SeekTo(0);
StdString tmp;
MemArchive->Read( tmp );
m_EntityName.SetWindowText( tmp.c_str() );
MemArchive->Read( tmp );
m_EntityType.SetWindowText( tmp.c_str() );
MemArchive->Read( tmp );
m_EventName.SetWindowText( tmp.c_str() );
MemArchive->Close();
}
}
}
示例2:
void CQHState::ReadFromVersion_1_2( IArchive &ar )
{
StdString s;
ar.Read( s, _T("name") );
m_NewName = s;
ar.Read( s, _T("entryEvent") );
m_EntryEvent = s;
ar.Read( s, _T("updateEvent") );
m_UpdateEvent = s;
ar.Read( s, _T("exitEvent") );
m_ExitEvent = s;
}
示例3: GetEditorValueNames
void CQHState::ReadFromVersion_1_1( IArchive &ar )
{
static const LPCTSTR *editorValueNames = GetEditorValueNames();
StdString s;
int iTemp;
ar.Read( s, _T("name") );
m_NewName = s;
for( int i = 0; i < 4; ++i )
{
ar.Read( iTemp, editorValueNames[i] );
}
ar.Read( iTemp, _T("numSubStates") );
ar.Read( iTemp, _T("numEvents") );
ar.Read( s, _T("entryEvent") );
m_EntryEvent = s;
ar.Read( s, _T("updateEvent") );
m_UpdateEvent = s;
ar.Read( s, _T("exitEvent") );
m_ExitEvent = s;
for( int i = 4; i < 8; ++i )
{
ar.Read( iTemp, editorValueNames[i] );
}
}
示例4: 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") );
}
}
示例5: DeductCredits
int GameComponent::DeductCredits( int credits )
{
#ifdef _SHELL
// deduct hardware credits
return ::DeductCredits( credits );
#else
// deduct software credits
IArchive *archive = CreateMemoryArchive();
if (archive)
{
archive->SetIsWriting(true);
CHashString hsAttribName(_T("Credits"));
GetGlobalAttribute(&hsAttribName, archive);
archive->SetIsWriting(false);
int currCredits = 0;
archive->Read(currCredits, _T("Credits"));
currCredits -= credits;
SetGlobalAttribute(&hsAttribName, currCredits);
archive->Close();
}
return 0;
#endif
}
示例6: OnUpdateLanguageEntryParams
DWORD CGUIStaticText::OnUpdateLanguageEntryParams(DWORD size, void *param)
{
VERIFY_MESSAGE_SIZE(size, sizeof(IArchive*));
IArchive* ar = (IArchive*) param;
if (ar)
{
if (m_LanguageTextParams != NULL)
{
delete [] m_LanguageTextParams;
m_LanguageTextParams = NULL;
}
// do deep copy of archive params
UINT archiveSize = ar->SeekTo(0, SEEK_END);
if (archiveSize > 0)
{
ar->SeekTo(0, SEEK_SET);
ar->SetIsWriting(false);
m_LanguageTextParams = new BYTE[archiveSize];
ar->Read(m_LanguageTextParams, archiveSize);
m_iLangTextParamSize = archiveSize;
}
}
UpdateLanguageEntryText();
return MSG_HANDLED_STOP;
}
示例7: GetCreditCount
int GameComponent::GetCreditCount()
{
#ifdef _SHELL
// get hardware credits
return ::GetCreditCount();
#else
// get software credits
IArchive *archive = CreateMemoryArchive();
if (archive)
{
archive->SetIsWriting(true);
CHashString hsAttribName(_T("Credits"));
GetGlobalAttribute(&hsAttribName, archive);
archive->SetIsWriting(false);
int credits = 0;
archive->Read(credits, _T("Credits"));
archive->Close();
return credits;
}
return 0;
#endif
}
示例8: 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);
}
}
示例9: 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);
}
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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);
}
}
示例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);
}
}
示例14: 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);
}
}
示例15: LoadTextFile
bool CGUIStaticText::LoadTextFile(const TCHAR *szFilename)
{
if (_tcscmp(szFilename, "") != 0)
{
CREATEARCHIVE ca;
ca.mode = 0x00000001;
static CHashString type = _T("File");
ca.streamType = &type;
ca.streamData = (void*) szFilename;
static DWORD msgHash_CreateArchive = CHashString(_T("CreateArchive")).GetUniqueID();
DWORD retval = EngineGetToolBox()->SendMessage(msgHash_CreateArchive, sizeof(CREATEARCHIVE), &ca);
if ((retval == MSG_NOT_HANDLED) || (retval == MSG_ERROR) || (retval == MSG_WARNING))
{
return false;
}
IArchive *ar = ca.archive;
StdString szTemp;
unsigned int numBytes = ar->Read(szTemp);
ar->Close();
if (numBytes > 0)
{
m_szText = szTemp;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}