DECLARE_SERIAL/IMPLEMENT_SERIAL宏

ZDNet软件频道 时间:2009-02-04 作者:ghost | CSDN 我要评论()
本文关键词:ghost 软件
深入挖掘宏系列(三)

DECLARE_SERIAL定义:

#ifndef _WIN32_WCE_NO_ARCHIVE_SUPPORT
#define DECLARE_SERIAL(class_name)
 _DECLARE_DYNCREATE(class_name)
 AFX_API friend CArchive& AFXAPI operator>>(CArchive& ar, class_name* &pOb);

#else // !_WIN32_WCE_NO_ARCHIVE_SUPPORT

#define DECLARE_SERIAL(class_name)
 _DECLARE_DYNCREATE(class_name) 

IMPLEMENT_SERIAL定义:

#ifndef _WIN32_WCE_NO_ARCHIVE_SUPPORT
#define IMPLEMENT_SERIAL(class_name, base_class_name, wSchema)
 CObject* PASCAL class_name::CreateObject()
  { return new class_name; }
 extern AFX_CLASSINIT _init_##class_name;
 _IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, wSchema,
  class_name::CreateObject, &_init_##class_name)
 AFX_CLASSINIT _init_##class_name(RUNTIME_CLASS(class_name));
 CArchive& AFXAPI operator>>(CArchive& ar, class_name* &pOb)
  { pOb = (class_name*) ar.ReadObject(RUNTIME_CLASS(class_name));
   return ar; }
#else
#define IMPLEMENT_SERIAL(class_name, base_class_name, wSchema)
 CObject* PASCAL class_name::CreateObject()
  { return new class_name; }
 extern AFX_CLASSINIT _init_##class_name;
 _IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, wSchema,
  class_name::CreateObject, &_init_##class_name)
 AFX_CLASSINIT _init_##class_name(RUNTIME_CLASS(class_name));
#endif // !_WIN32_WCE_NO_ARCHIVE_SUPPORT



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1630831


百度大联盟认证黄金会员Copyright© 1997- CNET Networks 版权所有。 ZDNet 是CNET Networks公司注册服务商标。
中华人民共和国电信与信息服务业务经营许可证编号:京ICP证010391号 京ICP备09041801号-159
京公网安备:1101082134