vtkPVFileInformation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkPVFileInformation_h
16 #define vtkPVFileInformation_h
17 
18 #include "vtkPVInformation.h"
19 #include "vtkRemotingCoreModule.h" //needed for exports
20 
21 #include <string> // Needed for std::string
22 
23 class vtkCollection;
24 class vtkPVFileInformationSet;
26 
28 {
29 public:
30  static vtkPVFileInformation* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
38  void CopyFromObject(vtkObject* object) override;
39 
41 
44  void CopyToStream(vtkClientServerStream*) override;
45  void CopyFromStream(const vtkClientServerStream*) override;
47 
48  enum FileTypes
49  {
50  INVALID = 0,
61  DIRECTORY_GROUP
62  };
63 
65 
70  static bool IsDirectory(int t);
71  bool IsDirectory() const { return vtkPVFileInformation::IsDirectory(this->Type); }
73 
75 
79  static bool IsGroup(int type)
80  {
81  switch (type)
82  {
83  case FILE_GROUP:
84  case DIRECTORY_GROUP:
85  return true;
86  default:
87  return false;
88  }
89  }
90  bool IsGroup() const { return vtkPVFileInformation::IsGroup(this->Type); }
92 
96  void Initialize();
97 
99 
103  vtkGetStringMacro(Name);
105 
107 
111  vtkGetStringMacro(FullPath);
113 
115 
118  vtkGetMacro(Type, int);
120 
122 
125  vtkGetMacro(Hidden, bool);
127 
129 
135  vtkGetMacro(GroupFileSequences, bool);
136  vtkSetMacro(GroupFileSequences, bool);
137  vtkBooleanMacro(GroupFileSequences, bool);
139 
141 
148  vtkGetObjectMacro(Contents, vtkCollection);
149  vtkGetStringMacro(Extension);
150  vtkGetMacro(Size, long long);
151  vtkGetMacro(ModificationTime, time_t);
153 
157  void FetchDirectoryListing();
158 
163  static std::string GetParaViewSharedResourcesDirectory();
164 
168  static std::string GetParaViewExampleFilesDirectory();
169 
173  static std::string GetParaViewDocDirectory();
174 
178  static std::string GetParaViewTranslationsDirectory();
179 
180 protected:
182  ~vtkPVFileInformation() override;
183 
186 
187  char* Name; // Name of this file/directory.
188  char* FullPath; // Full path for this file/directory.
189  int Type; // Type i.e. File/Directory/FileGroup.
190  bool Hidden; // If file/directory is hidden
191  char* Extension; // File extension
192  long long Size; // File size
193  time_t ModificationTime; // File modification time
194 
195  vtkSetStringMacro(Extension);
196  vtkSetStringMacro(Name);
197  vtkSetStringMacro(FullPath);
198 
199  void FetchWindowsDirectoryListing();
200  void FetchUnixDirectoryListing();
201 
202  // Goes thru the collection of vtkPVFileInformation objects
203  // are creates file groups, if possible.
204  void OrganizeCollection(vtkPVFileInformationSet& vector);
205 
206  bool DetectType();
207  void GetSpecialDirectories();
208  void SetHiddenFlag();
213 
214 private:
216  void operator=(const vtkPVFileInformation&) = delete;
217 
218  struct vtkInfo;
219 };
220 
221 #endif
static bool IsGroup(int type)
Helper that returns true if file-type is a network related file i.e.
bool IsGroup() const
Helper that returns true if file-type is a network related file i.e.
virtual void CopyFromStream(const vtkClientServerStream *)
Manage a serialized version of the information.
bool IsDirectory() const
Helper that returns whether a FileType is a directory (DIRECTORY, DRIVE, NETWORK_ROOT, etc...) Or in other words, a type that we can do a DirectoryListing on.
void PrintSelf(ostream &os, vtkIndent indent) override
Information object that can be used to obtain information about a file/directory. ...
Parses out the base file name of a file sequence and also the specific index of the given file...
Store messages for the interpreter.
void operator=(const vtkPVInformation &)=delete
#define VTKREMOTINGCORE_EXPORT
virtual void CopyToStream(vtkClientServerStream *)=0
Manage a serialized version of the information.
virtual void CopyFromObject(vtkObject *)
Transfer information about a single object into this object.
static vtkObject * New()
Superclass for information objects.
vtkFileSequenceParser * SequenceParser