166 lines
2.7 KiB
C++
166 lines
2.7 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGroups 类
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TGroups 声明
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#ifndef _TGROUPS_H_
|
|
#define _TGROUPS_H_
|
|
|
|
#ifndef _TCHGELIB_H_
|
|
#include "TchGeLib.h"
|
|
#endif
|
|
|
|
class GEOAPI TGroups
|
|
{
|
|
public:
|
|
TGroups(int i=0);
|
|
TGroups(ads_real r);
|
|
TGroups(const ads_point p);
|
|
TGroups(LPCTSTR s);
|
|
TGroups(ads_name n);
|
|
TGroups(long l);
|
|
|
|
TGroups(const TGroups& src);
|
|
|
|
//Extend data
|
|
TGroups(int, int i);
|
|
TGroups(int, ads_real r);
|
|
TGroups(int strOrHandle, LPCTSTR s);
|
|
|
|
~TGroups();
|
|
|
|
// 重新定义 new, delete操作符, 以便与ADS兼容
|
|
void *operator new(size_t);
|
|
void operator delete(void *a);
|
|
|
|
operator resbuf & ();
|
|
operator resbuf * ();
|
|
int operator == (const TGroups &other) const;
|
|
int operator != (const TGroups &other) const;
|
|
TGroups& operator = (const TGroups &src);
|
|
|
|
public:
|
|
TGroups *next;
|
|
|
|
union {
|
|
short type;
|
|
short code;
|
|
};
|
|
|
|
union {
|
|
ads_real real;
|
|
ads_point point;
|
|
short shortInt;
|
|
LPTSTR string;
|
|
ads_name adsName;
|
|
long longInt;
|
|
STBinary binary;
|
|
};
|
|
|
|
};
|
|
|
|
typedef TGroups *PGroups;
|
|
typedef TGroups *PList;
|
|
|
|
|
|
inline TGroups::TGroups(int i)
|
|
{
|
|
shortInt = i;
|
|
type = RTSHORT;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(ads_real r)
|
|
{
|
|
real = r;
|
|
type = RTREAL;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(const ads_point p)
|
|
{
|
|
memcpy(point, p, sizeof(ads_point));
|
|
type = RT3DPOINT;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(LPCTSTR s)
|
|
{
|
|
string = _tcsdup(s);
|
|
type = RTSTR;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(ads_name n)
|
|
{
|
|
adsName[0] = n[0];
|
|
adsName[1] = n[1];
|
|
type = RTENAME;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(long l)
|
|
{
|
|
longInt = l;
|
|
type = RTLONG;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(const TGroups & src)
|
|
{
|
|
*this = src;
|
|
}
|
|
|
|
inline TGroups::TGroups(int, int i)
|
|
{
|
|
shortInt = i;
|
|
type = XD_SHORT;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(int, ads_real r)
|
|
{
|
|
real = r;
|
|
type = XD_REAL;
|
|
next = NULL;
|
|
}
|
|
|
|
inline TGroups::TGroups(int strOrHandle, LPCTSTR s)
|
|
{
|
|
string = _tcsdup(s);
|
|
type = strOrHandle;
|
|
next = NULL;
|
|
}
|
|
|
|
inline void* TGroups::operator new(size_t)
|
|
{
|
|
return (void *)ads_newrb(0);
|
|
}
|
|
|
|
inline void TGroups::operator delete(void *a)
|
|
{
|
|
ads_relrb((resbuf *)a);
|
|
}
|
|
|
|
inline TGroups::operator resbuf & ()
|
|
{
|
|
return *((resbuf *)this);
|
|
}
|
|
|
|
inline TGroups::operator resbuf * ()
|
|
{
|
|
return (resbuf *)this;
|
|
}
|
|
|
|
inline int TGroups::operator != (const TGroups &other) const
|
|
{
|
|
return !(*this == other);
|
|
}
|
|
|
|
#endif
|