VTK  9.3.20240419
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 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkStringArray;
25 
26 class VTKPARALLELCORE_EXPORT vtkPDirectory : public vtkObject
27 {
28 public:
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 
101 protected:
103  ~vtkPDirectory() override;
104 
105 private:
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 
116 VTK_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...
Definition: vtkPDirectory.h:27
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkPDirectory * New()
int Open(const char *dir)
Open/Load the specified directory and load the names of the files in that directory.
static VTK_FILEPATH const char * GetCurrentWorkingDirectory(char *buf, unsigned int len)
Get the current working directory.
static int Rename(VTK_FILEPATH const char *oldname, VTK_FILEPATH const char *newname)
Rename a file or 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.
static int MakeDirectory(VTK_FILEPATH const char *dir)
Create directory.
VTK_FILEPATH const char * GetFile(vtkIdType index) const
Return the file at the given index, the indexing is 0 based.
VTK_FILEPATH const char * GetPath() const
Return the path to Open'ed directory.
static int DeleteDirectory(VTK_FILEPATH const char *dir)
Remove a directory.
a vtkAbstractArray subclass for strings
@ dir
Definition: vtkX3D.h:324
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
int vtkIdType
Definition: vtkType.h:315
#define VTK_FILEPATH