file.hpp 1.4 KB

12345678910111213141516171819202122232425262728
  1. #ifndef AFUN_FILE_HPP
  2. #define AFUN_FILE_HPP
  3. #include "aFunToolExport.h"
  4. /* 文件处理工具 */
  5. namespace aFuntool {
  6. class FileOpenException : public std::exception {
  7. virtual const char *what() {return "File cannot open";}
  8. };
  9. AFUN_TOOL_EXPORT int checkFile(const std::string &path);
  10. AFUN_TOOL_EXPORT time_t getFileMTime(const std::string &path);
  11. AFUN_TOOL_EXPORT std::string joinPath(const std::string &path, const std::string &name, const std::string &suffix);
  12. AFUN_TOOL_EXPORT std::string getFileName(const std::string &path);
  13. AFUN_TOOL_EXPORT std::string getFilePathName(const std::string &path);
  14. AFUN_TOOL_EXPORT std::string getFilePath(const std::string &path_1, int dep);
  15. AFUN_TOOL_EXPORT std::string getFileSurfix(const std::string &path);
  16. AFUN_TOOL_EXPORT std::string fileNameToVar(const std::string &name);
  17. AFUN_TOOL_EXPORT std::string findPath(const std::string &path, const std::string &env);
  18. AFUN_TOOL_EXPORT std::string getExedir(int dep);
  19. AFUN_TOOL_EXPORT uintmax_t getFileSize(const std::string &path);
  20. AFUN_TOOL_EXPORT bool isCharUTF8(const char *str);
  21. AFUN_TOOL_EXPORT bool isCharUTF8(const std::string &str);
  22. AFUN_TOOL_EXPORT FILE *fileOpen(const std::string &path_, const char *mode_);
  23. AFUN_TOOL_EXPORT FILE *fileOpen(const char *path_, const char *mode_);
  24. AFUN_TOOL_EXPORT int fileClose(FILE *file);
  25. }
  26. #endif //AFUN_FILE_HPP