VTK  9.6.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
16
17#ifndef vtkDirectory_h
18#define vtkDirectory_h
19
20#include "vtkCommonSystemModule.h" // For export macro
21#include "vtkObject.h"
22
23VTK_ABI_NAMESPACE_BEGIN
24
25class vtkStringArray;
26
27class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
28{
29public:
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
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
100protected:
101 // delete the Files and Path ivars and set
102 // NumberOfFiles to 0
105 ~vtkDirectory() override;
106
107private:
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
117VTK_ABI_NAMESPACE_END
118#endif
static int DeleteDirectory(const char *dir)
Remove a directory.
vtkIdType GetNumberOfFiles()
Return the number of files in the current directory.
static vtkDirectory * New()
Create a new vtkDirectory object.
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.
void CleanUpFilesAndPath()
const char * GetFile(vtkIdType index)
Return the file at the given index, the indexing is 0 based.
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.
~vtkDirectory() override
void PrintSelf(ostream &os, vtkIndent indent) override
Print directory to stream.
a simple class to control print indentation
Definition vtkIndent.h:29
a vtkAbstractArray subclass for strings
int vtkIdType
Definition vtkType.h:368
#define VTK_FILEPATH