home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / com / allinone / server / cdata.h next >
Encoding:
C/C++ Source or Header  |  1998-04-03  |  778 b   |  39 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // cdata.h :
  3. //
  4.  
  5. #if !defined(__CDATA_H__)
  6. #define __CDATA_H__
  7.  
  8. #include "idata.h"
  9.  
  10. class CMyStruct : public tagIMyStruct
  11. {
  12. public:
  13.     CMyStruct() { m_str = NULL; }
  14.     virtual ~CMyStruct() { if (m_str) ::SysFreeString(m_str); }
  15.  
  16. // Operations
  17. public:
  18.     void Format(CString& str)
  19.     {
  20.     str.Format(_T("{%i, %.4f, %s}"), m_int, m_float, (LPCTSTR) (CString) m_str);
  21.     }
  22. };
  23.  
  24. class CMyObject : public CObject, public CMyStruct
  25. {
  26.     DECLARE_SERIAL(CMyObject)
  27. public:
  28.     CMyObject() {}
  29.     virtual ~CMyObject() {}
  30.  
  31. // Implementation
  32. public:
  33.     virtual void Serialize(CArchive& ar);
  34. };
  35.  
  36. #endif // __CDATA_H__
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39.