find.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _RAR_FINDDATA_
  2. #define _RAR_FINDDATA_
  3. enum FINDDATA_FLAGS {
  4. FDDF_SECONDDIR=1 // Second encounter of same directory in SCAN_GETDIRSTWICE ScanTree mode.
  5. };
  6. struct FindData
  7. {
  8. char Name[NM];
  9. wchar NameW[NM];
  10. int64 Size;
  11. uint FileAttr;
  12. uint FileTime;
  13. bool IsDir;
  14. RarTime mtime;
  15. RarTime ctime;
  16. RarTime atime;
  17. #ifdef _WIN_ALL
  18. wchar ShortName[NM];
  19. FILETIME ftCreationTime;
  20. FILETIME ftLastAccessTime;
  21. FILETIME ftLastWriteTime;
  22. #endif
  23. uint Flags;
  24. bool Error;
  25. };
  26. class FindFile
  27. {
  28. private:
  29. #ifdef _WIN_ALL
  30. static HANDLE Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd);
  31. #endif
  32. char FindMask[NM];
  33. wchar FindMaskW[NM];
  34. bool FirstCall;
  35. #ifdef _WIN_ALL
  36. HANDLE hFind;
  37. #else
  38. DIR *dirp;
  39. #endif
  40. public:
  41. FindFile();
  42. ~FindFile();
  43. void SetMask(const char *FindMask);
  44. void SetMaskW(const wchar *FindMaskW);
  45. bool Next(FindData *fd,bool GetSymLink=false);
  46. static bool FastFind(const char *FindMask,const wchar *FindMaskW,FindData *fd,bool GetSymLink=false);
  47. };
  48. #endif