Directory.hxx.in 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*=========================================================================
  2. Program: KWSys - Kitware System Library
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef @KWSYS_NAMESPACE@_Directory_hxx
  14. #define @KWSYS_NAMESPACE@_Directory_hxx
  15. #include <@KWSYS_NAMESPACE@/StandardIncludes.hxx>
  16. #include <string>
  17. #include <vector>
  18. namespace @KWSYS_NAMESPACE@
  19. {
  20. /** \class Directory
  21. * \brief Portable directory/filename traversal.
  22. *
  23. * Directory provides a portable way of finding the names of the files
  24. * in a system directory.
  25. *
  26. * Directory currently works with Windows and Unix operating systems.
  27. */
  28. class Directory
  29. {
  30. public:
  31. /**
  32. * Load the specified directory and load the names of the files
  33. * in that directory. 0 is returned if the directory can not be
  34. * opened, 1 if it is opened.
  35. */
  36. bool Load(const char* dir);
  37. /**
  38. * Return the number of files in the current directory.
  39. */
  40. size_t GetNumberOfFiles() { return m_Files.size();}
  41. /**
  42. * Return the file at the given index, the indexing is 0 based
  43. */
  44. const char* GetFile(size_t );
  45. private:
  46. kwsys_std::vector<kwsys_std::string> m_Files; // Array of Files
  47. kwsys_std::string m_Path; // Path to Open'ed directory
  48. }; // End Class: Directory
  49. } // namespace @KWSYS_NAMESPACE@
  50. #endif