/** * @brief The file guard class to manage the FILE pointer automatically. * file_guard object can close the FILE pointer automatically when his scope is exit. */ classfile_guard { public: /** * @brief Construct a new file guard object * * @param file the pointer of the FILE object */ explicitfile_guard(FILE *file);
/** * @brief Get the FILE pointer. * * @return FILE* */ FILE *getfd()const;
private: FILE *file_; };
/** * @brief Create a new file. * * @param path the filepath of the new file to be created * @return true if the file is created successfully, false otherwise. */ boolcreatefile(const filepath &path);
/** * @brief Create a symbolic link or shortcut. * * @param referenece the real path referenced by the symbolic link or shortcut * @param filepath the filepath of the symbolic link or shortcut to be created * @return true if the symbolic link or shortcut is created successfully, false otherwise. */ boolcreatelink(const filepath &referenece, const filepath &filepath);
/** * @brief Remove a regular file or symbolic link(shortcut on windows). * * @param path the filepath of the file or symbolic link to be removed * @return true if the file or symbolic link is removed successfully, false otherwise. */ boolremovefile(const filepath &path);