#pragma once #include "Piece.h" #include #include /** * Manages creating pieces files and importing the data back from them */ class PiecesFiles { public: /** * Default constructor */ PiecesFiles(); /** * Generate a file containing all the pieces of the specified size * @return If the pieces are saved correctly */ [[nodiscard]] bool savePieces(int polyominoSize) const; /** * Generate a file containing all the pieces of the specified size, assuming they have been correctly generated * @return If the piece are saved correctly */ [[nodiscard]] bool savePieces(int polyominoSize, std::vector& polyominoes) const; /** * Replace the content of the vectors by the pieces of the specified size, if the pieces can't be loaded correctly the vectors stays untouched * @return If the pieces could be loaded correctly */ [[nodiscard]] bool loadPieces(int polyominoSize, std::vector& pieces, std::vector& convexPieces, std::vector& holelessPieces, std::vector& otherPieces) const; /** * Puts the path to the piece file of the specified size in order, if the data folder wasn't found the string stays untouched * @return If the data folder was found */ bool getFilePath(int polyominoSize, std::string& filePath) const; };