Directory.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: Directory.h //////////////////////////////////////////////////////////////////////////////
  24. // Author: Matthew D. Campbell, August 2002
  25. // Desc: Directory info class
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #if (0)
  28. #pragma once
  29. #ifndef __DIRECTORY_H__
  30. #define __DIRECTORY_H__
  31. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  32. #include "Common/AsciiString.h"
  33. #include "Common/STLTypedefs.h"
  34. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  35. // TYPES //////////////////////////////////////////////////////////////////////////////////////////
  36. class FileInfo
  37. {
  38. public:
  39. FileInfo() {}
  40. ~FileInfo() {}
  41. void set( const WIN32_FIND_DATA& info );
  42. AsciiString filename;
  43. time_t creationTime;
  44. time_t accessTime;
  45. time_t modTime;
  46. DWORD attributes;
  47. DWORD filesize; // only care about 32 bits for our purposes
  48. protected:
  49. };
  50. struct FileInfoComparator
  51. {
  52. bool operator()(const FileInfo& a, const FileInfo& b) const
  53. {
  54. return a.filename < b.filename;
  55. }
  56. };
  57. //-------------------------------------------------------------------------------------------------
  58. typedef std::set<FileInfo, FileInfoComparator> FileInfoSet;
  59. //-------------------------------------------------------------------------------------------------
  60. class Directory
  61. {
  62. public:
  63. Directory(const AsciiString& dirPath);
  64. ~Directory() {}
  65. FileInfoSet* getFiles( void );
  66. FileInfoSet* getSubdirs( void );
  67. protected:
  68. AsciiString m_dirPath;
  69. FileInfoSet m_files;
  70. FileInfoSet m_subdirs;
  71. };
  72. //-------------------------------------------------------------------------------------------------
  73. #endif // __DIRECTORY_H__
  74. #endif