Files
jminos/src/Pieces/PiecesFiles.h
2025-02-25 12:07:16 +01:00

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:
/**
* Initializes file manager
*/
PiecesFiles();
/**
* Generate a file containing all the pieces of the specified size,
* returns false if the file couldn't be created
*/
bool savePieces(int order) const;
/**
* Replace the content of the vectors by the pieces of the specified size, if the file wasn't found the vectors stays untouched,
* returns false if the file wasn't found
*/
bool loadPieces(int order, 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,
* returns false if the data folder wasn't found
*/
bool getFilePath(int order, std::string& filePath) const;
};