|
|
|
|
@ -0,0 +1,28 @@
|
|
|
|
|
#ifndef FILE_MANAGER_H_
|
|
|
|
|
#define FILE_MANAGER_H_
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
class FileManager {
|
|
|
|
|
public:
|
|
|
|
|
FileManager() = default;
|
|
|
|
|
|
|
|
|
|
bool CreateUserDirectory(const std::string& username);
|
|
|
|
|
std::string GenerateFilename();
|
|
|
|
|
bool SaveQuestions(const std::string& username,
|
|
|
|
|
const std::vector<std::string>& questions);
|
|
|
|
|
bool IsQuestionExists(const std::string& username,
|
|
|
|
|
const std::string& question);
|
|
|
|
|
std::vector<std::string> LoadExistingQuestions(const std::string& username);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
static constexpr const char* kBasePath = "exams\\"; // Windows·<73><C2B7><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>
|
|
|
|
|
FileManager(const FileManager&) = delete;
|
|
|
|
|
FileManager& operator=(const FileManager&) = delete;
|
|
|
|
|
std::string UsernameToPinyin(const std::string& username);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // FILE_MANAGER_H_
|