File: vtkDirectory.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-8.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 118,972 kB
  • sloc: cpp: 1,442,790; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 68; objc: 17
file content (105 lines) | stat: -rw-r--r-- 3,198 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkDirectory.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkDirectory - OS independent class for access and manipulation of system directories
// .SECTION Description
// vtkDirectory provides a portable way of finding the names of the files
// in a system directory.  It also provides methods of manipulating directories.

// .SECTION Caveats
// vtkDirectory works with windows and unix only.

#ifndef vtkDirectory_h
#define vtkDirectory_h

#include "vtkCommonSystemModule.h" // For export macro
#include "vtkObject.h"

class vtkStringArray;

class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
{
public:
  // Description:
  // Return the class name as a string.
  vtkTypeMacro(vtkDirectory,vtkObject);

  // Description:
  // Create a new vtkDirectory object.
  static vtkDirectory *New();

  // Description:
  // Print directory to stream.
  virtual void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Open the specified directory and load the names of the files
  // in that directory. 0 is returned if the directory can not be
  // opened, 1 if it is opened.
  int Open(const char* dir);

  // Description:
  // Return the number of files in the current directory.
  vtkIdType GetNumberOfFiles();

  // Description:
  // Return the file at the given index, the indexing is 0 based
  const char* GetFile(vtkIdType index);

  // Description:
  // Return true if the file is a directory.  If the file is not an
  // absolute path, it is assumed to be relative to the opened
  // directory. If no directory has been opened, it is assumed to
  // be relative to the current working directory.
  int FileIsDirectory(const char *name);

  // Description:
  // Get an array that contains all the file names.
  vtkGetObjectMacro(Files, vtkStringArray);

  // Description:
  // Get the current working directory.
  static const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);

  // Description:
  // Create directory.
  static int MakeDirectory(const char* dir);

  // Description:
  // Remove a directory.
  static int DeleteDirectory(const char* dir);

  // Description:
  // Rename a file or directory.
  static int Rename(const char* oldname, const char* newname);

protected:
  // delete the Files and Path ivars and set
  // NumberOfFiles to 0
  void CleanUpFilesAndPath();
  vtkDirectory();
  ~vtkDirectory() ;

private:
  char* Path;           // Path to Open'ed directory
  vtkStringArray *Files;    // VTK array of files

  static int CreateDirectoryInternal(const char* dir);

private:
  vtkDirectory(const vtkDirectory&);  // Not implemented.
  void operator=(const vtkDirectory&);  // Not implemented.
};

#endif