Directory.hxx.in 2.14 KB
Newer Older
1
2
3
/*============================================================================
  KWSys - Kitware System Library
  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4

5
6
  Distributed under the OSI-approved BSD License (the "License");
  see accompanying file Copyright.txt for details.
7

8
9
10
11
  This software is distributed WITHOUT ANY WARRANTY; without even the
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the License for more information.
============================================================================*/
12
13
14
#ifndef @KWSYS_NAMESPACE@_Directory_hxx
#define @KWSYS_NAMESPACE@_Directory_hxx

Brad King's avatar
Brad King committed
15
#include <@KWSYS_NAMESPACE@/Configure.h>
Brad King's avatar
Brad King committed
16
#include <string>
17
18
19
20

namespace @KWSYS_NAMESPACE@
{

21
22
class DirectoryInternals;

23
24
/** \class Directory
 * \brief Portable directory/filename traversal.
25
 *
26
27
28
29
30
 * 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.
 */
31
class @KWSYS_NAMESPACE@_EXPORT Directory
32
33
{
public:
34
35
  Directory();
  ~Directory();
36

37
38
  /**
   * Load the specified directory and load the names of the files
39
40
   * in that directory. 0 is returned if the directory can not be
   * opened, 1 if it is opened.
41
   */
Brad King's avatar
Brad King committed
42
  bool Load(const std::string&);
43

44
45
46
  /**
   * Return the number of files in the current directory.
   */
47
  unsigned long GetNumberOfFiles() const;
48

49
50
51
52
  /**
   * Return the number of files in the specified directory.
   * A higher performance static method.
   */
Brad King's avatar
Brad King committed
53
  static unsigned long GetNumberOfFilesInDirectory(const std::string&);
54

55
56
57
  /**
   * Return the file at the given index, the indexing is 0 based
   */
58
59
60
61
62
63
64
  const char* GetFile(unsigned long) const;

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

65
  /**
66
67
   * Clear the internal structure. Used internally at beginning of Load(...)
   * to clear the cache.
68
69
70
   */
  void Clear();

71
private:
72
73
  // Private implementation details.
  DirectoryInternals* Internal;
74
75
76

  Directory(const Directory&);  // Not implemented.
  void operator=(const Directory&);  // Not implemented.
77
}; // End Class: Directory
78

79
80
81
} // namespace @KWSYS_NAMESPACE@

#endif