VTK  9.3.20240418
vtkGlobFileNames.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
27 #ifndef vtkGlobFileNames_h
28 #define vtkGlobFileNames_h
29 
30 #include "vtkIOCoreModule.h" // For export macro
31 #include "vtkObject.h"
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkStringArray;
35 
36 class VTKIOCORE_EXPORT vtkGlobFileNames : public vtkObject
37 {
38 public:
40 
43  vtkTypeMacro(vtkGlobFileNames, vtkObject);
45 
49  static vtkGlobFileNames* New();
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  void Reset();
60 
62 
69  vtkSetFilePathMacro(Directory);
70  vtkGetFilePathMacro(Directory);
72 
79  int AddFileNames(VTK_FILEPATH const char* pattern);
80 
82 
85  vtkSetMacro(Recurse, vtkTypeBool);
86  vtkBooleanMacro(Recurse, vtkTypeBool);
87  vtkGetMacro(Recurse, vtkTypeBool);
89 
94 
98  VTK_FILEPATH const char* GetNthFileName(int index);
99 
101 
104  vtkGetObjectMacro(FileNames, vtkStringArray);
106 
107 protected:
109 
115 
117  ~vtkGlobFileNames() override;
118 
119 private:
120  char* Directory; // Directory for search.
121  char* Pattern; // Wildcard pattern
122  vtkTypeBool Recurse; // Recurse into subdirectories
123  vtkStringArray* FileNames; // VTK array of files
124 
125  vtkGlobFileNames(const vtkGlobFileNames&) = delete;
126  void operator=(const vtkGlobFileNames&) = delete;
127 };
128 
129 VTK_ABI_NAMESPACE_END
130 #endif
find files that match a wildcard pattern
VTK_FILEPATH const char * GetNthFileName(int index)
Return the file at the given index, the indexing is 0 based.
void Reset()
Reset the glob by clearing the list of output filenames.
static vtkGlobFileNames * New()
Create a new vtkGlobFileNames object.
int GetNumberOfFileNames()
Return the number of files found.
~vtkGlobFileNames() override
int AddFileNames(VTK_FILEPATH const char *pattern)
Search for all files that match the given expression, sort them, and add them to the output.
vtkGetFilePathMacro(Directory)
Set the directory in which to perform the glob.
vtkSetFilePathMacro(Directory)
Set the directory in which to perform the glob.
vtkSetFilePathMacro(Pattern)
Set the wildcard pattern.
vtkGetFilePathMacro(Pattern)
Set the wildcard pattern.
void PrintSelf(ostream &os, vtkIndent indent) override
Print directory to stream.
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
a vtkAbstractArray subclass for strings
@ index
Definition: vtkX3D.h:246
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FILEPATH