VTK  9.5.20250814
vtkPDirectory.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#ifndef vtkPDirectory_h
17#define vtkPDirectory_h
18
19#include "vtkObject.h"
20#include "vtkParallelCoreModule.h" // For export macro
21#include <string> // for string functions in Directory
22
23VTK_ABI_NAMESPACE_BEGIN
24class vtkStringArray;
25
26class VTKPARALLELCORE_EXPORT vtkPDirectory : public vtkObject
27{
28public:
29 static vtkPDirectory* New();
30 vtkTypeMacro(vtkPDirectory, vtkObject);
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
34
41 bool Load(const std::string&);
42 int Open(const char* dir);
44
49
53 VTK_FILEPATH const char* GetFile(vtkIdType index) const;
54
61 int FileIsDirectory(const char* name);
62
64
67 vtkGetObjectMacro(Files, vtkStringArray);
69
73 VTK_FILEPATH const char* GetPath() const;
74
79 void Clear();
80
84 static VTK_FILEPATH const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
85
89 static int MakeDirectory(VTK_FILEPATH const char* dir);
90
94 static int DeleteDirectory(VTK_FILEPATH const char* dir);
95
99 static int Rename(VTK_FILEPATH const char* oldname, VTK_FILEPATH const char* newname);
100
101protected:
103 ~vtkPDirectory() override;
104
105private:
106 // Array of Files
107 vtkStringArray* Files; // VTK array of files
108
109 // Path to Open'ed directory
110 std::string Path;
111
112 vtkPDirectory(const vtkPDirectory&) = delete;
113 void operator=(const vtkPDirectory&) = delete;
114}; // End Class: vtkPDirectory
115
116VTK_ABI_NAMESPACE_END
117#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
vtkPDirectory provides a portable way of finding the names of the files in a system directory where p...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetFile(vtkIdType index) const
Return the file at the given index, the indexing is 0 based.
int Open(const char *dir)
Open/Load the specified directory and load the names of the files in that directory.
static int Rename(const char *oldname, const char *newname)
Rename a file or directory.
static const char * GetCurrentWorkingDirectory(char *buf, unsigned int len)
Get the current working directory.
static vtkPDirectory * New()
static int DeleteDirectory(const char *dir)
Remove a directory.
~vtkPDirectory() override
bool Load(const std::string &)
Open/Load the specified directory and load the names of the files in that directory.
void Clear()
Clear the internal structure.
vtkIdType GetNumberOfFiles() const
Return the number of files in the current directory.
int FileIsDirectory(const char *name)
Return true if the file is a directory.
const char * GetPath() const
Return the path to Open'ed directory.
static int MakeDirectory(const char *dir)
Create directory.
a vtkAbstractArray subclass for strings
int vtkIdType
Definition vtkType.h:332
#define VTK_FILEPATH