|
#pragma once
namespace mycell{
class BorderPair
{
enum {
HAS_RIGHT=1<<0,
HAS_BOTTOM =1<<1,
};
Border right,bottom;
BYTE mask;
public:
bool operator==(BorderPair rhs)const
{
return right==rhs.right
&&bottom==rhs.bottom
&&mask==rhs.mask;
}
void clear()
{
mask=0;
}
bool empty()const
{
return !HasRight() && !HasBottom();
}
void clear_right()
{
mask&=~HAS_RIGHT;
}
void clear_bottom()
{
mask&=~HAS_BOTTOM;
}
void put_Right(Border b)
{
right=b;
mask|=HAS_RIGHT;
}
BOOL get_Right(Border& leftBorder)const
{
if(HasRight()){
leftBorder=right;
return TRUE;
}else
return FALSE;
}
BOOL HasRight()const
{
return (mask&HAS_RIGHT)?TRUE:FALSE;
}
void put_Bottom(Border b)
{
bottom=b;
mask|=HAS_BOTTOM;
}
BOOL get_Bottom(Border& topBorder)const
{
if(HasBottom()){
topBorder=bottom;
return TRUE;
}else
return FALSE;
}
BOOL HasBottom()const
{
return (mask&HAS_BOTTOM)?TRUE:FALSE;
}
};
}//namespace mycell
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
My name is Yanxueming,i live in Chengdu China.Graduated from UESTC in 1999.