|
// CKnot : header file
//
// CKnot Class, object helper class, data representation of knots
// Functionality :
// 1. Set and retrieving data
// 2. Serialsation
// 3. Operator overloading
//
// Copyright Johan Janssens, 2001 (jjanssens@mail.com)
// Feel free to use and distribute. May not be sold for profit.
#ifndef _JANSSENS_JOHAN_KNOT_H_
#define _JANSSENS_JOHAN_KNOT_H_
//Knot Class
class CKnot : public CObject
{
public :
UINT x;
UINT y;
DWORD dwData;
public :
CKnot() : x(0), y(0), dwData(true) {} //Constructors
CKnot(int ptX, int ptY) :
x(ptX), y(ptY), dwData(0) {}
void SetPoint(CPoint pt) { x = pt.x; y = pt.y;} //Setting
void SetData(DWORD data) { dwData = data;}
void GetPoint(LPPOINT pt) { pt->x = x; pt->y = y;} //Extraction
//Operator overloading
void operator = (CKnot knot) {x = knot.x; y = knot.y; dwData = knot.dwData; }
void operator = (CPoint point) {x = point.x; y = point.y;}
bool operator != (CPoint point)
{
bool b;
((x != point.x) && (y != point.y)) ? b = true : b = false;
return b;
}
void Serialize(CArchive& ar)
{
if(ar.IsStoring())
ar << x << y << dwData;
else
ar >> x >> y >> dwData;
}
};
/////////////////////////////////////////////////////////////////////////////
#endif // _JANSSENS_JOHAN_KNOT_H_
|
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.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.