VTK
vtkDirectory.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDirectory.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 =========================================================================*/
29 #ifndef vtkDirectory_h
30 #define vtkDirectory_h
31 
32 #include "vtkCommonSystemModule.h" // For export macro
33 #include "vtkObject.h"
34 
35 class vtkStringArray;
36 
37 class VTKCOMMONSYSTEM_EXPORT vtkDirectory : public vtkObject
38 {
39 public:
41 
44  vtkTypeMacro(vtkDirectory,vtkObject);
46 
50  static vtkDirectory *New();
51 
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
62  int Open(const char* dir);
63 
68 
72  const char* GetFile(vtkIdType index);
73 
80  int FileIsDirectory(const char *name);
81 
83 
86  vtkGetObjectMacro(Files, vtkStringArray);
88 
92  static const char* GetCurrentWorkingDirectory(char* buf, unsigned int len);
93 
97  static int MakeDirectory(const char* dir);
98 
102  static int DeleteDirectory(const char* dir);
103 
107  static int Rename(const char* oldname, const char* newname);
108 
109 protected:
110  // delete the Files and Path ivars and set
111  // NumberOfFiles to 0
114  ~vtkDirectory() override;
115 
116 private:
117  char* Path; // Path to Open'ed directory
118  vtkStringArray *Files; // VTK array of files
119 
120  static int CreateDirectoryInternal(const char* dir);
121 
122 private:
123  vtkDirectory(const vtkDirectory&) = delete;
124  void operator=(const vtkDirectory&) = delete;
125 };
126 
127 #endif
vtkDirectory::FileIsDirectory
int FileIsDirectory(const char *name)
Return true if the file is a directory.
vtkDirectory::MakeDirectory
static int MakeDirectory(const char *dir)
Create directory.
vtkDirectory::GetNumberOfFiles
vtkIdType GetNumberOfFiles()
Return the number of files in the current directory.
vtkDirectory::Open
int Open(const char *dir)
Open the specified directory and load the names of the files in that directory.
vtkDirectory::DeleteDirectory
static int DeleteDirectory(const char *dir)
Remove a directory.
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkDirectory::GetCurrentWorkingDirectory
static const char * GetCurrentWorkingDirectory(char *buf, unsigned int len)
Get the current working directory.
vtkDirectory::Rename
static int Rename(const char *oldname, const char *newname)
Rename a file or directory.
vtkDirectory::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Print directory to stream.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkX3D::dir
@ dir
Definition: vtkX3D.h:324
vtkDirectory::GetFile
const char * GetFile(vtkIdType index)
Return the file at the given index, the indexing is 0 based.
vtkDirectory::vtkDirectory
vtkDirectory()
vtkDirectory::~vtkDirectory
~vtkDirectory() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkDirectory::CleanUpFilesAndPath
void CleanUpFilesAndPath()
vtkDirectory
OS independent class for access and manipulation of system directories.
Definition: vtkDirectory.h:38
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkObject.h
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:43
vtkDirectory::New
static vtkDirectory * New()
Create a new vtkDirectory object.
vtkX3D::index
@ index
Definition: vtkX3D.h:246