0% found this document useful (0 votes)
46 views2 pages

Cell H

Uploaded by

wijifal264
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

Cell H

Uploaded by

wijifal264
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#ifndef CELL_H

#define CELL_H
#include <iomanip>

namespace Tetris
{

/**
* @brief Represents a cell in the Tetris game board.
*/
class Cell
{

friend class Board; // Declare Board as a friend class

public:
/**
* @brief Default constructor.
*/
Cell(const Cell&) = delete;
/**
* @brief Constructs an unoccupied Cell object.
*/
Cell() : CurrentBrickCell(false), OccupiedCell(false) {}
/**
* @brief Checks if the cell is occupied.
* @return True if the cell is occupied, false otherwise.
*/
inline bool isOccupiedCell() const {return OccupiedCell;}
/**
* @brief Checks if the cell is part of the current brick.
* @return True if the cell is part of the current brick, false otherwise.
*/
inline bool isCurrentBrickCell() const {return CurrentBrickCell;}
/**
* @brief Overloaded stream insertion operator to print the cell
representation.
* @param os The output stream.
* @param cell The cell object to be printed.
* @return A reference to the output stream.
*/
friend std::ostream& operator<<(std::ostream& os, const Cell& cell);
/**
* @brief Assignment operator for Cell objects.
* @param cell The Cell object to copy values from.
*/
void operator=(const Cell& cell);
/**
* @brief Deleted to prevent assignment from nullptr.
*/
Cell& operator=(const std::nullptr_t) = delete;

private:
/**
* @brief Sets the occupancy status of the cell.
* @param status The new occupancy status.
*/
inline void setOccupancyStatus(const bool& status) { OccupiedCell =
status;}
/**
* @brief Sets whether the cell is part of the current brick.
* @param status The new current status.
*/
inline void setCurrentStatus(const bool& status) { CurrentBrickCell =
status;}
/**
* @brief Resets the cell to its initial state.
*/
inline void reset() { CurrentBrickCell = false; OccupiedCell = false; }
/**
* @brief Sets the cell as part of the current brick.
*/
inline void setAsCurrentBrick() { CurrentBrickCell = true; OccupiedCell =
true; }

bool CurrentBrickCell ; ///< Indicates whether the cell is part of the


current brick.
bool OccupiedCell ; ///< Indicates whether the cell is occupied.
};

#endif // CELL_H

You might also like