Directory.hxx.in 1.78 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
3 4 5
#ifndef @KWSYS_NAMESPACE@_Directory_hxx
#define @KWSYS_NAMESPACE@_Directory_hxx

Brad King's avatar
Brad King committed
6
#include <@KWSYS_NAMESPACE@/Configure.h>
7

Brad King's avatar
Brad King committed
8
#include <string>
9

10
namespace @KWSYS_NAMESPACE@ {
11

12 13
class DirectoryInternals;

14 15
/** \class Directory
 * \brief Portable directory/filename traversal.
16
 *
17 18 19 20 21
 * Directory provides a portable way of finding the names of the files
 * in a system directory.
 *
 * Directory currently works with Windows and Unix operating systems.
 */
22
class @KWSYS_NAMESPACE@_EXPORT Directory
23 24
{
public:
25 26
  Directory();
  ~Directory();
27

28 29
  /**
   * Load the specified directory and load the names of the files
30 31
   * in that directory. 0 is returned if the directory can not be
   * opened, 1 if it is opened.
32
   */
Brad King's avatar
Brad King committed
33
  bool Load(const std::string&);
34

35 36 37
  /**
   * Return the number of files in the current directory.
   */
38
  unsigned long GetNumberOfFiles() const;
39

40 41 42 43
  /**
   * Return the number of files in the specified directory.
   * A higher performance static method.
   */
Brad King's avatar
Brad King committed
44
  static unsigned long GetNumberOfFilesInDirectory(const std::string&);
45

46 47 48
  /**
   * Return the file at the given index, the indexing is 0 based
   */
49 50 51 52 53 54 55
  const char* GetFile(unsigned long) const;

  /**
   * Return the path to Open'ed directory
   */
  const char* GetPath() const;

56
  /**
57 58
   * Clear the internal structure. Used internally at beginning of Load(...)
   * to clear the cache.
59 60 61
   */
  void Clear();

62
private:
63 64
  // Private implementation details.
  DirectoryInternals* Internal;
65

66 67 68
  Directory(const Directory&);      // Not implemented.
  void operator=(const Directory&); // Not implemented.
};                                  // End Class: Directory
69

70 71 72
} // namespace @KWSYS_NAMESPACE@

#endif