cmDirectory.h 1.4 KB

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