140 lines
2.1 KiB
C++
140 lines
2.1 KiB
C++
#include "StdAfx.h"
|
|
#include "RBGroups.h"
|
|
#include "ADSGePoint3d.h"
|
|
#include "globalDefine.h"
|
|
#include "globalfunc.h"
|
|
|
|
using namespace GlobalFunc;
|
|
|
|
RBGroups::~RBGroups()
|
|
{
|
|
|
|
}
|
|
|
|
int RBGroups::operator == (const RBGroups &other) const
|
|
{
|
|
if (type != other.type)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
switch(TypeOfCode(code))
|
|
{
|
|
case RTSTR : return !_tcsicmp(string,other.string);
|
|
case RTANG:
|
|
case RTREAL : return fabs(real-other.real) < 1E-8;
|
|
case RTSHORT : return shortInt == other.shortInt;
|
|
case RTLONG : return longInt == other.longInt;
|
|
case RTENAME :
|
|
case RTPICKS : return ads_name_equal(adsName, other.adsName);
|
|
case RTPOINT :
|
|
case RT3DPOINT: return *(ADSGePoint3d *)point == *(ADSGePoint3d *)other.point;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
RBGroups& RBGroups::operator = (const RBGroups &src)
|
|
{
|
|
memcpy(this, &src, sizeof(RBGroups));
|
|
if(TypeOfCode(code) == RTSTR)
|
|
{
|
|
string = _tcsdup(src.string);
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
RBGroups::RBGroups(int i)
|
|
{
|
|
shortInt = i;
|
|
type = RTSHORT;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(ads_real r)
|
|
{
|
|
real = r;
|
|
type = RTREAL;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(const ads_point p)
|
|
{
|
|
memcpy(point, p, sizeof(ads_point));
|
|
type = RT3DPOINT;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(LPCTSTR s)
|
|
{
|
|
string = _tcsdup(s);
|
|
type = RTSTR;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(ads_name n)
|
|
{
|
|
adsName[0] = n[0];
|
|
adsName[1] = n[1];
|
|
type = RTENAME;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(long l)
|
|
{
|
|
longInt = l;
|
|
type = RTLONG;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(const RBGroups & src)
|
|
{
|
|
*this = src;
|
|
}
|
|
|
|
RBGroups::RBGroups(int, int i)
|
|
{
|
|
shortInt = i;
|
|
type = XD_SHORT;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(int, ads_real r)
|
|
{
|
|
real = r;
|
|
type = XD_REAL;
|
|
next = NULL;
|
|
}
|
|
|
|
RBGroups::RBGroups(int strOrHandle, LPCTSTR s)
|
|
{
|
|
string = _tcsdup(s);
|
|
type = strOrHandle;
|
|
next = NULL;
|
|
}
|
|
|
|
void* RBGroups::operator new(size_t)
|
|
{
|
|
return (void *)ads_newrb(0);
|
|
}
|
|
|
|
void RBGroups::operator delete(void *a)
|
|
{
|
|
ads_relrb((resbuf *)a);
|
|
}
|
|
|
|
RBGroups::operator resbuf & ()
|
|
{
|
|
return *((resbuf *)this);
|
|
}
|
|
|
|
RBGroups::operator resbuf * ()
|
|
{
|
|
return (resbuf *)this;
|
|
}
|
|
|
|
int RBGroups::operator != (const RBGroups &other) const
|
|
{
|
|
return !(*this == other);
|
|
}
|
|
|