Directory.hxx.in 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*============================================================================
  2. KWSys - Kitware System Library
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef @KWSYS_NAMESPACE@_Directory_hxx
  11. #define @KWSYS_NAMESPACE@_Directory_hxx
  12. #include <@KWSYS_NAMESPACE@/Configure.h>
  13. namespace @KWSYS_NAMESPACE@
  14. {
  15. class DirectoryInternals;
  16. /** \class Directory
  17. * \brief Portable directory/filename traversal.
  18. *
  19. * Directory provides a portable way of finding the names of the files
  20. * in a system directory.
  21. *
  22. * Directory currently works with Windows and Unix operating systems.
  23. */
  24. class @KWSYS_NAMESPACE@_EXPORT Directory
  25. {
  26. public:
  27. Directory();
  28. ~Directory();
  29. /**
  30. * Load the specified directory and load the names of the files
  31. * in that directory. 0 is returned if the directory can not be
  32. * opened, 1 if it is opened.
  33. */
  34. bool Load(const char*);
  35. /**
  36. * Return the number of files in the current directory.
  37. */
  38. unsigned long GetNumberOfFiles() const;
  39. /**
  40. * Return the number of files in the specified directory.
  41. * A higher performance static method.
  42. */
  43. static unsigned long GetNumberOfFilesInDirectory(const char*);
  44. /**
  45. * Return the file at the given index, the indexing is 0 based
  46. */
  47. const char* GetFile(unsigned long) const;
  48. /**
  49. * Return the path to Open'ed directory
  50. */
  51. const char* GetPath() const;
  52. /**
  53. * Clear the internal structure. Used internally at beginning of Load(...)
  54. * to clear the cache.
  55. */
  56. void Clear();
  57. private:
  58. // Private implementation details.
  59. DirectoryInternals* Internal;
  60. Directory(const Directory&); // Not implemented.
  61. void operator=(const Directory&); // Not implemented.
  62. }; // End Class: Directory
  63. } // namespace @KWSYS_NAMESPACE@
  64. #endif