Coord: remove useless code

This commit is contained in:
Olivier Teulière 2012-12-26 17:03:43 +01:00
parent 3fc1b51f6b
commit 05605a63ae
2 changed files with 7 additions and 31 deletions

View file

@ -49,14 +49,6 @@ bool Coord::isValid() const
m_col >= BOARD_MIN && m_col <= BOARD_MAX); m_col >= BOARD_MIN && m_col <= BOARD_MAX);
} }
/*
void Coord::operator=(const Coord &iOther)
{
m_dir = iOther.m_dir;
m_row = iOther.m_row;
m_col = iOther.m_col;
}
*/
bool Coord::operator==(const Coord &iOther) const bool Coord::operator==(const Coord &iOther) const
{ {
@ -67,6 +59,7 @@ bool Coord::operator==(const Coord &iOther) const
&& m_dir == iOther.m_dir; && m_dir == iOther.m_dir;
} }
void Coord::swap() void Coord::swap()
{ {
int tmp = m_col; int tmp = m_col;
@ -105,7 +98,7 @@ void Coord::setFromString(const wstring &iWStr)
setCol(-1); setCol(-1);
} }
wstring Coord::toString(coord_mode_t mode) const wstring Coord::toString() const
{ {
ASSERT(isValid(), "Invalid coordinates"); ASSERT(isValid(), "Invalid coordinates");
@ -116,22 +109,10 @@ wstring Coord::toString(coord_mode_t mode) const
_swprintf(scol, 3, L"%d", m_col); _swprintf(scol, 3, L"%d", m_col);
_swprintf(srow, 3, L"%c", m_row + 'A' - 1); _swprintf(srow, 3, L"%c", m_row + 'A' - 1);
switch (mode) if (getDir() == HORIZONTAL)
{ _swprintf(res, 7, L"%ls%ls", srow, scol);
case COORD_MODE_COMPACT: else
if (getDir() == HORIZONTAL) _swprintf(res, 7, L"%ls%ls", scol, srow);
_swprintf(res, 7, L"%ls%ls", srow, scol);
else
_swprintf(res, 7, L"%ls%ls", scol, srow);
break;
case COORD_MODE_LONG:
if (getDir() == HORIZONTAL)
_swprintf(res, 7, L"%2ls %2ls", srow, scol);
else
_swprintf(res, 7, L"%2ls %2ls", scol, srow);
break;
}
return res; return res;
} }

View file

@ -59,13 +59,8 @@ public:
void swap(); void swap();
enum coord_mode_t
{
COORD_MODE_COMPACT,
COORD_MODE_LONG
};
void setFromString(const wstring &iStr); void setFromString(const wstring &iStr);
wstring toString(coord_mode_t mode = COORD_MODE_COMPACT) const; wstring toString() const;
private: private:
Direction m_dir; Direction m_dir;