- Added Grid::Cell::operator==
This commit is contained in:
30
src/Grid.cpp
30
src/Grid.cpp
@@ -377,6 +377,36 @@ Grid::Cell::operator std::string () const
|
||||
return std::string ("");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Grid::Cell::operator== (const Grid::Cell& rhs) const
|
||||
{
|
||||
switch (mType)
|
||||
{
|
||||
case CELL_BOOL: return mBool == rhs.mBool ? true : false;
|
||||
case CELL_CHAR: return mChar == rhs.mChar ? true : false;
|
||||
case CELL_INT: return mInt == rhs.mInt ? true : false;
|
||||
case CELL_FLOAT: return mFloat == rhs.mFloat ? true : false;
|
||||
case CELL_DOUBLE: return mDouble == rhs.mDouble ? true : false;
|
||||
case CELL_STRING: return mString == rhs.mString ? true : false;
|
||||
default: break; // To prevent warnings.
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Grid::Cell::operator!= (const Grid::Cell& rhs) const
|
||||
{
|
||||
switch (mType)
|
||||
{
|
||||
case CELL_BOOL: return mBool != rhs.mBool ? true : false;
|
||||
case CELL_CHAR: return mChar != rhs.mChar ? true : false;
|
||||
case CELL_INT: return mInt != rhs.mInt ? true : false;
|
||||
case CELL_FLOAT: return mFloat != rhs.mFloat ? true : false;
|
||||
case CELL_DOUBLE: return mDouble != rhs.mDouble ? true : false;
|
||||
case CELL_STRING: return mString != rhs.mString ? true : false;
|
||||
default: break; // To prevent warnings.
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Grid::Cell::cellType Grid::Cell::type () const
|
||||
{
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
operator float () const;
|
||||
operator double () const;
|
||||
operator std::string () const;
|
||||
bool operator== (const Cell&) const;
|
||||
bool operator!= (const Cell&) const;
|
||||
|
||||
enum cellType {CELL_BOOL, CELL_CHAR, CELL_INT, CELL_FLOAT, CELL_DOUBLE, CELL_STRING};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user