VTK  9.4.20241124
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
36#ifndef vtkDirectory_h
37#define vtkDirectory_h
38
39#include "vtkCommonSystemModule.h" // For export macro
40#include "vtkObject.h"
41
42VTK_ABI_NAMESPACE_BEGIN
43
44class vtkStringArray;
45
46class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
47{
48public:
50
53 vtkTypeMacro(vtkDirectory, vtkObject);
55
59 static vtkDirectory* New();
60
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
71 int Open(VTK_FILEPATH const char* dir);
72
77
81 VTK_FILEPATH const char* GetFile(vtkIdType index);
82
89 int FileIsDirectory(VTK_FILEPATH const char* name);
90
92
95 vtkGetObjectMacro(Files, vtkStringArray);
97
102 static VTK_FILEPATH const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
103
107 static int MakeDirectory(VTK_FILEPATH const char* dir);
108
112 static int DeleteDirectory(VTK_FILEPATH const char* dir);
113
117 static int Rename(VTK_FILEPATH const char* oldname, VTK_FILEPATH const char* newname);
118
119protected:
120 // delete the Files and Path ivars and set
121 // NumberOfFiles to 0
124 ~vtkDirectory() override;
125
126private:
127 char* Path; // Path to Open'ed directory
128 vtkStringArray* Files; // VTK array of files
129
130 static int CreateDirectoryInternal(const char* dir);
131
132 vtkDirectory(const vtkDirectory&) = delete;
133 void operator=(const vtkDirectory&) = delete;
134};
135
136VTK_ABI_NAMESPACE_END
137#endif
OS independent class for access and manipulation of system directories.
vtkIdType GetNumberOfFiles()
Return the number of files in the current directory.
static int Rename(VTK_FILEPATH const char *oldname, VTK_FILEPATH const char *newname)
Rename a file or directory.
int FileIsDirectory(VTK_FILEPATH const char *name)
Return true if the file is a directory.
static vtkDirectory * New()
Create a new vtkDirectory object.
static VTK_FILEPATH const char * GetCurrentWorkingDirectory(char *buf, unsigned int len)
Get the current working directory.
void CleanUpFilesAndPath()
static int MakeDirectory(VTK_FILEPATH const char *dir)
Create directory.
static int DeleteDirectory(VTK_FILEPATH const char *dir)
Remove a directory.
VTK_FILEPATH const char * GetFile(vtkIdType index)
Return the file at the given index, the indexing is 0 based.
int Open(VTK_FILEPATH const char *dir)
Open the specified directory and load the names of the files in that directory.
~vtkDirectory() override
void PrintSelf(ostream &os, vtkIndent indent) override
Print directory to stream.
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
a vtkAbstractArray subclass for strings
int vtkIdType
Definition vtkType.h:315
#define VTK_FILEPATH