VTK  9.3.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 class vtkStringArray;
25 
26 class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
27 {
28 public:
30 
33  vtkTypeMacro(vtkDirectory, vtkObject);
35 
39  static vtkDirectory* New();
40 
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
51  int Open(VTK_FILEPATH const char* dir);
52 
56  vtkIdType GetNumberOfFiles();
57 
61  VTK_FILEPATH const char* GetFile(vtkIdType index);
62 
69  int FileIsDirectory(VTK_FILEPATH const char* name);
70 
72 
75  vtkGetObjectMacro(Files, vtkStringArray);
77 
81  static VTK_FILEPATH const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
82 
86  static int MakeDirectory(VTK_FILEPATH const char* dir);
87 
91  static int DeleteDirectory(VTK_FILEPATH const char* dir);
92 
96  static int Rename(VTK_FILEPATH const char* oldname, VTK_FILEPATH const char* newname);
97 
98 protected:
99  // delete the Files and Path ivars and set
100  // NumberOfFiles to 0
101  void CleanUpFilesAndPath();
102  vtkDirectory();
103  ~vtkDirectory() override;
104 
105 private:
106  char* Path; // Path to Open'ed directory
107  vtkStringArray* Files; // VTK array of files
108 
109  static int CreateDirectoryInternal(const char* dir);
110 
111  vtkDirectory(const vtkDirectory&) = delete;
112  void operator=(const vtkDirectory&) = delete;
113 };
114 
115 VTK_ABI_NAMESPACE_END
116 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:315
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_FILEPATH
OS independent class for access and manipulation of system directories.
Definition: vtkDirectory.h:26
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...