Files
envi-code/SourceCode/Code2026/inc/AdsXRx/Groups.h
T
2026-09-28 15:28:50 +08:00

171 lines
2.8 KiB
C++

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