Files
jminos/src/Pieces/PiecesFiles.h

38 lines
1.1 KiB
C++

#pragma once
#include "Piece.h"
#include <vector>
#include <string>
/**
* 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 file could be created
*/
bool savePieces(int polyominoSize) const;
/**
* Replace the content of the vectors by the pieces of the specified size, if the file wasn't found the vectors stays untouched
* @return If the file was found
*/
bool loadPieces(int polyominoSize, std::vector<Piece>& pieces, std::vector<int>& convexPieces, std::vector<int>& holelessPieces, std::vector<int>& otherPieces) const;
private:
/**
* 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;
};