VTK  9.7.1
vtkDirectory.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
17 #ifndef vtkDirectory_h
18 #define vtkDirectory_h
19 
20 #include "vtkCommonSystemModule.h" // For export macro
21 #include "vtkObject.h"
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 
25 class vtkStringArray;
26 
27 class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
28 {
29 public:
31 
34  vtkTypeMacro(vtkDirectory, vtkObject);
36 
40  static vtkDirectory* New();
41 
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
52  int Open(VTK_FILEPATH const char* dir);
53 
57  vtkIdType GetNumberOfFiles();
58 
62  VTK_FILEPATH const char* GetFile(vtkIdType index);
63 
70  int FileIsDirectory(VTK_FILEPATH const char* name);
71 
73 
76  vtkGetObjectMacro(Files, vtkStringArray);
78 
83  static VTK_FILEPATH const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
84 
88  static int MakeDirectory(VTK_FILEPATH const char* dir);
89 
93  static int DeleteDirectory(VTK_FILEPATH const char* dir);
94 
98  static int Rename(VTK_FILEPATH const char* oldname, VTK_FILEPATH const char* newname);
99 
100 protected:
101  // delete the Files and Path ivars and set
102  // NumberOfFiles to 0
103  void CleanUpFilesAndPath();
104  vtkDirectory();
105  ~vtkDirectory() override;
106 
107 private:
108  char* Path; // Path to Open'ed directory
109  vtkStringArray* Files; // VTK array of files
110 
111  static int CreateDirectoryInternal(const char* dir);
112 
113  vtkDirectory(const vtkDirectory&) = delete;
114  void operator=(const vtkDirectory&) = delete;
115 };
116 
117 VTK_ABI_NAMESPACE_END
118 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:363
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_FILEPATH
VTKIOHDF_EXPORT bool Open(const char *fileName, hid_t &fileID)
Open a VTK HDF file and checks if it is valid.
OS independent class for access and manipulation of system directories.
Definition: vtkDirectory.h:27
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...