Face.h 1.0 KB

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