Face.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef FACE_H
  2. #define FACE_H
  3. #include <iostream>
  4. #include <functional>
  5. class Face {
  6. public:
  7. // force usage by reference in every situation
  8. Face(const Face& other) = delete;
  9. Face& operator=(const Face& other) = delete;
  10. Face(Face&& other) = delete;
  11. Face& operator=(Face&& other) = delete;
  12. int getX() const;
  13. int getY() const;
  14. int getZ() const;
  15. Face& getOpposite() const;
  16. const char* getName() const;
  17. static void forEach(const std::function<void(Face&)>& f);
  18. static const Face& UP;
  19. static const Face& DOWN;
  20. static const Face& NORTH;
  21. static const Face& SOUTH;
  22. static const Face& EAST;
  23. static const Face& WEST;
  24. private:
  25. Face(int index, int offsetX, int offsetY, int offsetZ, const char* name);
  26. static Face FACES[6];
  27. int index;
  28. int offsetX;
  29. int offsetY;
  30. int offsetZ;
  31. const char* name;
  32. };
  33. bool operator==(const Face& l, const Face& r);
  34. bool operator!=(const Face& l, const Face& r);
  35. std::ostream& operator<<(std::ostream& os, const Face& f);
  36. #endif