以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XML在语音技术中的应用 』   (http://bbs.xml.org.cn/list.asp?boardid=47)
----  关于OPENVXI中VXIValue类  (http://bbs.xml.org.cn/dispbbs.asp?boardid=47&rootid=&id=51304)


--  作者:yuyuanb7
--  发布时间:8/13/2007 11:47:00 AM

--  关于OPENVXI中VXIValue类
OPENVXI中VXIvalue.h定义:
#ifdef __cplusplus
struct VXIValue;
struct VXIBoolean;
struct VXIInteger;
struct VXIFloat;
struct VXIString;
struct VXIPtr;
struct VXIContent;
struct VXIMap;
struct VXIVector;
struct VXIDouble;
struct VXIULong;
struct VXILong;
  
struct VXIMapIterator;
#else

typedef struct VXIValue   { void * dummy; } VXIValue;
typedef struct VXIBoolean { void * dummy; } VXIBoolean;
typedef struct VXIInteger { void * dummy; } VXIInteger;
typedef struct VXIFloat   { void * dummy; } VXIFloat;
typedef struct VXIString  { void * dummy; } VXIString;
typedef struct VXIPtr     { void * dummy; } VXIPtr;
typedef struct VXIContent { void * dummy; } VXIContent;
typedef struct VXIMap     { void * dummy; } VXIMap;
typedef struct VXIVector  { void * dummy; } VXIVector;
typedef struct VXIDouble  { void * dummy; } VXIDouble;
typedef struct VXIULong   { void * dummy; } VXIULong;
typedef struct VXILong    { void * dummy; } VXILong;
而在value.hpp中:
class VXIValue;
class VXIBoolean;
class VXIInteger;
class VXIFloat;
class VXIPtr;
class VXIString;
class VXIContent;
class VXIMap;
class VXIVector;
class VXIMapIterator;
class VXIContentData;
class VXIDouble;
class VXIULong;
class VXILong;

为什么会有STRUCT定义又有CLASS定义


--  作者:zhu_ruixian
--  发布时间:8/14/2007 11:11:00 PM

--  
OPENVXI中VXIvalue.h定义
/*
* Define each type as an opaque structure to get full information hiding
* while ensuring strong compiler type checks. The actual implementation
* defines these structures however it wants.
*/

#ifdef __cplusplus
struct VXIValue;
struct VXIBoolean;
struct VXIInteger;
struct VXIFloat;
struct VXIString;
struct VXIPtr;
struct VXIContent;
struct VXIMap;
struct VXIVector;
struct VXIDouble;
struct VXIULong;
struct VXILong;
  
struct VXIMapIterator;
#else

typedef struct VXIValue   { void * dummy; } VXIValue;
typedef struct VXIBoolean { void * dummy; } VXIBoolean;
typedef struct VXIInteger { void * dummy; } VXIInteger;
typedef struct VXIFloat   { void * dummy; } VXIFloat;
typedef struct VXIString  { void * dummy; } VXIString;
typedef struct VXIPtr     { void * dummy; } VXIPtr;
typedef struct VXIContent { void * dummy; } VXIContent;
typedef struct VXIMap     { void * dummy; } VXIMap;
typedef struct VXIVector  { void * dummy; } VXIVector;
typedef struct VXIDouble  { void * dummy; } VXIDouble;
typedef struct VXIULong   { void * dummy; } VXIULong;
typedef struct VXILong    { void * dummy; } VXILong;

typedef struct VXIMapIterator  { void * dummy; } VXIMapIterator;
#endif

而在value.hpp中:
// Forward declarations, required because we mask out the struct definitions
// in VXIvalue.h with the define below

class VXIValue;
class VXIBoolean;
class VXIInteger;
class VXIFloat;
class VXIPtr;
class VXIString;
class VXIContent;
class VXIMap;
class VXIVector;
class VXIMapIterator;
class VXIContentData;
class VXIDouble;
class VXIULong;
class VXILong;

你看一下黑体字部分  #ifdef __cplusplus 是判断编译器是C 还是C++编译器.


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms