This commit is contained in:
78
Common/ComData.cpp
Normal file
78
Common/ComData.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
// ComData.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ComData.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CComData
|
||||
|
||||
IMPLEMENT_DYNCREATE(CComData, CObject)
|
||||
|
||||
CComData::CComData()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CComData::~CComData()
|
||||
{
|
||||
}
|
||||
|
||||
void CComData::Initialize()
|
||||
{
|
||||
m_ComDataType = NONE;
|
||||
m_FromID = _T("");
|
||||
m_BodyType = BODY_NONE;
|
||||
m_StringBody = _T("");
|
||||
m_BArrayBody.RemoveAll();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CComData serialization
|
||||
void CComData::Serialize(CArchive& ar)
|
||||
{
|
||||
try {
|
||||
if (ar.IsStoring())
|
||||
{
|
||||
ar << m_ComDataType;
|
||||
ar << m_FromID;
|
||||
ar << m_BodyType;
|
||||
ar << m_StringBody;
|
||||
}
|
||||
else
|
||||
{
|
||||
ar >> m_ComDataType;
|
||||
ar >> m_FromID;
|
||||
ar >> m_BodyType;
|
||||
ar >> m_StringBody;
|
||||
}
|
||||
|
||||
m_BArrayBody.Serialize( ar );
|
||||
}
|
||||
catch(CArchiveException* e) {
|
||||
TCHAR csError[CHAR_BUFFER_SIZE];
|
||||
e->GetErrorMessage(csError, CHAR_BUFFER_SIZE);
|
||||
AfxMessageBox(csError);
|
||||
}
|
||||
}
|
||||
|
||||
void CComData::SetBArrayBody( LPBYTE pData, int nSize )
|
||||
{
|
||||
m_BArrayBody.SetSize(nSize);
|
||||
memcpy(m_BArrayBody.GetData(), pData, nSize);
|
||||
}
|
||||
|
||||
LPBYTE CComData::GetBArrayBody()
|
||||
{
|
||||
return m_BArrayBody.GetData();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CComData commands
|
||||
Reference in New Issue
Block a user