VTK: Common/System/vtkDirectory.h Source File

| 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
26 #ifndef vtkDirectory_h
27 #define vtkDirectory_h
28
29 #include "vtkCommonSystemModule.h" // For export macro
30 #include "vtkObject.h"
31
32 VTK_ABI_NAMESPACE_BEGIN
33 class vtkStringArray;
34
35 class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
36 {
37 public:
39
42 vtkTypeMacro(vtkDirectory, vtkObject);
44
48 static vtkDirectory* New();
49
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
60 int Open(VTK_FILEPATH const char* dir);
61
65 vtkIdType GetNumberOfFiles();
66
70 VTK_FILEPATH const char* GetFile(vtkIdType index);
71
78 int FileIsDirectory(VTK_FILEPATH const char* name);
79
81
84 vtkGetObjectMacro(Files, vtkStringArray);
86
90 static VTK_FILEPATH const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
91
95 static int MakeDirectory(VTK_FILEPATH const char* dir);
96
100 static int DeleteDirectory(VTK_FILEPATH const char* dir);
101
105 static int Rename(VTK_FILEPATH const char* oldname, VTK_FILEPATH const char* newname);
106
107 protected:
108 // delete the Files and Path ivars and set
109 // NumberOfFiles to 0
110 void CleanUpFilesAndPath();
111 vtkDirectory();
112 ~vtkDirectory() override;
113
114 private:
115 char* Path; // Path to Open'ed directory
116 vtkStringArray* Files; // VTK array of files
117
118 static int CreateDirectoryInternal(const char* dir);
119
120 vtkDirectory(const vtkDirectory&) = delete;
121 void operator=(const vtkDirectory&) = delete;
122 };
123
124 VTK_ABI_NAMESPACE_END
125 #endif
vtkDirectory
OS independent class for access and manipulation of system directories.
Definition: vtkDirectory.h:36
vtkDirectory::GetNumberOfFiles
vtkIdType GetNumberOfFiles()
Return the number of files in the current directory.
vtkDirectory::Rename
static int Rename(VTK_FILEPATH const char *oldname, VTK_FILEPATH const char *newname)
Rename a file or directory.
vtkDirectory::FileIsDirectory
int FileIsDirectory(VTK_FILEPATH const char *name)
Return true if the file is a directory.
vtkDirectory::vtkDirectory
vtkDirectory()
vtkDirectory::CleanUpFilesAndPath
void CleanUpFilesAndPath()
vtkDirectory::MakeDirectory
static int MakeDirectory(VTK_FILEPATH const char *dir)
Create directory.
vtkDirectory::DeleteDirectory
static int DeleteDirectory(VTK_FILEPATH const char *dir)
Remove a directory.
vtkDirectory::GetCurrentWorkingDirectory
static VTK_FILEPATH const char * GetCurrentWorkingDirectory(char *buf, unsigned int len)
Get the current working directory.
vtkDirectory::Open
int Open(VTK_FILEPATH const char *dir)
Open the specified directory and load the names of the files in that directory.
vtkDirectory::GetFile
VTK_FILEPATH const char * GetFile(vtkIdType index)
Return the file at the given index, the indexing is 0 based.
vtkDirectory::New
static vtkDirectory * New()
Create a new vtkDirectory object.
vtkDirectory::~vtkDirectory
~vtkDirectory() override
vtkDirectory::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Print directory to stream.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:41
vtkX3D::dir
@ dir
Definition: vtkX3D.h:324
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkObject.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
VTK_FILEPATH
#define VTK_FILEPATH
Definition: vtkWrappingHints.h:34