2001-10-06 18:13:28 +04:00
|
|
|
#ifndef CSCREENMAP_H
|
|
|
|
#define CSCREENMAP_H
|
|
|
|
|
|
|
|
#include "BasicTypes.h"
|
|
|
|
#include "CString.h"
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
class CScreenMap {
|
|
|
|
public:
|
|
|
|
enum EDirection { kLeft, kRight, kTop, kBottom,
|
|
|
|
kFirstDirection = kLeft, kLastDirection = kBottom };
|
2001-11-19 03:33:36 +03:00
|
|
|
enum EDirectionMask { kLeftMask = 1, kRightMask = 2,
|
|
|
|
kTopMask = 4, kBottomMask = 8 };
|
2001-10-06 18:13:28 +04:00
|
|
|
|
|
|
|
CScreenMap();
|
|
|
|
virtual ~CScreenMap();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
|
|
|
// add/remove screens
|
|
|
|
void addScreen(const CString& name);
|
|
|
|
void removeScreen(const CString& name);
|
|
|
|
void removeAllScreens();
|
|
|
|
|
|
|
|
// connect edges
|
|
|
|
void connect(const CString& srcName,
|
|
|
|
EDirection srcSide,
|
|
|
|
const CString& dstName);
|
|
|
|
void disconnect(const CString& srcName,
|
|
|
|
EDirection srcSide);
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
// get the neighbor in the given direction. returns the empty string
|
|
|
|
// if there is no neighbor in that direction.
|
2001-10-14 20:58:01 +04:00
|
|
|
CString getNeighbor(const CString&, EDirection) const;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2001-10-14 18:37:41 +04:00
|
|
|
// get the name of a direction (for debugging)
|
|
|
|
static const char* dirName(EDirection);
|
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
private:
|
|
|
|
class CCell {
|
|
|
|
public:
|
|
|
|
CString m_neighbor[kLastDirection - kFirstDirection + 1];
|
|
|
|
};
|
|
|
|
typedef std::map<CString, CCell> CCellMap;
|
|
|
|
|
|
|
|
CCellMap m_map;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|