VTK  9.0.2
vtkDirectory.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDirectory.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef vtkDirectory_h
27 #define vtkDirectory_h
28 
29 #include "vtkCommonSystemModule.h" // For export macro
30 #include "vtkObject.h"
31 
32 class vtkStringArray;
33 
34 class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
35 {
36 public:
38 
41  vtkTypeMacro(vtkDirectory, vtkObject);
43 
47  static vtkDirectory* New();
48 
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
59  int Open(const char* dir);
60 
65 
69  const char* GetFile(vtkIdType index);
70 
77  int FileIsDirectory(const char* name);
78 
80 
83  vtkGetObjectMacro(Files, vtkStringArray);
85 
89  static const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
90 
94  static int MakeDirectory(const char* dir);
95 
99  static int DeleteDirectory(const char* dir);
100 
104  static int Rename(const char* oldname, const char* newname);
105 
106 protected:
107  // delete the Files and Path ivars and set
108  // NumberOfFiles to 0
111  ~vtkDirectory() override;
112 
113 private:
114  char* Path; // Path to Open'ed directory
115  vtkStringArray* Files; // VTK array of files
116 
117  static int CreateDirectoryInternal(const char* dir);
118 
119 private:
120  vtkDirectory(const vtkDirectory&) = delete;
121  void operator=(const vtkDirectory&) = delete;
122 };
123 
124 #endif
OS independent class for access and manipulation of system directories.
Definition: vtkDirectory.h:35
static int DeleteDirectory(const char *dir)
Remove a directory.
vtkIdType GetNumberOfFiles()
Return the number of files in the current directory.
int FileIsDirectory(const char *name)
Return true if the file is a directory.
int Open(const char *dir)
Open the specified directory and load the names of the files in that directory.
static int MakeDirectory(const char *dir)
Create directory.
const char * GetFile(vtkIdType index)
Return the file at the given index, the indexing is 0 based.
void CleanUpFilesAndPath()
static const char * GetCurrentWorkingDirectory(char *buf, unsigned int len)
Get the current working directory.
static int Rename(const char *oldname, const char *newname)
Rename a file or directory.
static vtkDirectory * New()
Create a new vtkDirectory object.
~vtkDirectory() override
void PrintSelf(ostream &os, vtkIndent indent) override
Print directory to stream.
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
a vtkAbstractArray subclass for strings
@ dir
Definition: vtkX3D.h:330
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:338