本文整理汇总了C++中IArchive类的典型用法代码示例。如果您正苦于以下问题:C++ IArchive类的具体用法?C++ IArchive怎么用?C++ IArchive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IArchive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: serialize
void serialize(IArchive& ar, pfemp1_antibody_t& antibodies)
{
ar.startObject();
ar.labelElement("minor") & antibodies.minor;
ar.labelElement("major") & antibodies.major;
ar.endObject();
}
示例8: 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);
}
}
示例9: serialize
void BaseIntervention::serialize(IArchive& ar, BaseIntervention* obj)
{
BaseIntervention& intervention = *obj;
ar.labelElement("cost_per_unit" ) & intervention.cost_per_unit;
ar.labelElement("expired" ) & intervention.expired;
ar.labelElement("dont_allow_duplicates") & intervention.dont_allow_duplicates;
}
示例10: Send
bool NetSystem::Send(const UI32 nSocket, const IArchive & msg) {
if (nSocket >= 65335) { //如何控制这个端口的范围
LOG_ERROR("NetSystem::Send nSocket : %d", nSocket);
Assert(false);
return false;
}
LinkInfo * pLinkInfo = m_linkmanage.FindLinkBySocket(nSocket);
if (NULL == pLinkInfo) {
LOG_ERROR("NetSystem::Send LinkInfo is NULL");
Assert(false);
return false;
}
pLinkInfo->m_sendstream.WriteBuff(msg.GetStream(), msg.Length());
struct epoll_event ev;
ev.data.ptr = pLinkInfo;
ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
epoll_ctl(m_epfd, EPOLL_CTL_MOD, pLinkInfo->m_socket, &ev);
return true;
}
示例11: VERIFY_MESSAGE_SIZE
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;
}
示例12: memType
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;
}
}
示例13: hszLangKey
void CGUIStaticText::UpdateLanguageEntryText()
{
CHashString hszLangKey(m_szLangEntryKey);
CHashString hszLangTextOut(_T(""));
static DWORD dwZeroString = CHashString(_T("")).GetUniqueID();
if (hszLangKey.GetUniqueID() != dwZeroString)
{
IArchive *ar = CreateAndFillArchive();
GETLANGUAGETEXTPARAMS gltp;
gltp.arParams = ar;
gltp.hszKeyString = &hszLangKey;
gltp.hszTranslatedText = &hszLangTextOut;
static DWORD msgGetLanguageText = CHashString(_T("GetLanguageText")).GetUniqueID();
m_ToolBox->SendMessage(msgGetLanguageText, sizeof(GETLANGUAGETEXTPARAMS), &gltp);
if (m_pStaticText)
{
m_pStaticText->SetText(m_szFont, "", hszLangTextOut.GetString(), hszLangTextOut.GetString(), hszLangTextOut.GetString(),
hszLangTextOut.GetString(), m_iFontsize);
}
if (ar)
{
ar->Close();
}
}
}
示例14: _T
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;
}
}
示例15: 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;
}