VTK  9.2.6
vtkPDirectory.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPDirectory.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14  =========================================================================*/
28 #ifndef vtkPDirectory_h
29 #define vtkPDirectory_h
30 
31 #include "vtkObject.h"
32 #include "vtkParallelCoreModule.h" // For export macro
33 #include <string> // for string functions in Directory
34 
35 class vtkStringArray;
36 
37 class VTKPARALLELCORE_EXPORT vtkPDirectory : public vtkObject
38 {
39 public:
40  static vtkPDirectory* New();
41  vtkTypeMacro(vtkPDirectory, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
52  bool Load(const std::string&);
53  int Open(const char* dir);
55 
60 
64  VTK_FILEPATH const char* GetFile(vtkIdType index) const;
65 
72  int FileIsDirectory(const char* name);
73 
75 
78  vtkGetObjectMacro(Files, vtkStringArray);
80 
84  VTK_FILEPATH const char* GetPath() const;
85 
90  void Clear();
91 
95  static VTK_FILEPATH const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
96 
100  static int MakeDirectory(VTK_FILEPATH const char* dir);
101 
105  static int DeleteDirectory(VTK_FILEPATH const char* dir);
106 
110  static int Rename(VTK_FILEPATH const char* oldname, VTK_FILEPATH const char* newname);
111 
112 protected:
114  ~vtkPDirectory() override;
115 
116 private:
117  // Array of Files
118  vtkStringArray* Files; // VTK array of files
119 
120  // Path to Open'ed directory
121  std::string Path;
122 
123  vtkPDirectory(const vtkPDirectory&) = delete;
124  void operator=(const vtkPDirectory&) = delete;
125 }; // End Class: vtkPDirectory
126 
127 #endif
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkPDirectory provides a portable way of finding the names of the files in a system directory where p...
Definition: vtkPDirectory.h:38
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:330
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH