cmDirectory.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 __cmDirectory_h
  14. #define __cmDirectory_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmSystemTools.h"
  17. /** \class cmDirectory
  18. * \brief Portable directory/filename traversal.
  19. *
  20. * cmDirectory provides a portable way of finding the names of the files
  21. * in a system directory.
  22. *
  23. * cmDirectory currently works with Windows and Unix operating systems.
  24. */
  25. class cmDirectory
  26. {
  27. public:
  28. /**
  29. * Load the specified directory and load the names of the files
  30. * in that directory. 0 is returned if the directory can not be
  31. * opened, 1 if it is opened.
  32. */
  33. bool Load(const char* dir);
  34. /**
  35. * Return the number of files in the current directory.
  36. */
  37. size_t GetNumberOfFiles() { return m_Files.size();}
  38. /**
  39. * Return the file at the given index, the indexing is 0 based
  40. */
  41. const char* GetFile(size_t );
  42. private:
  43. std::vector<std::string> m_Files; // Array of Files
  44. std::string m_Path; // Path to Open'ed directory
  45. }; // End Class: cmDirectory
  46. #endif