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 
27 class VTKREMOTINGCORE_EXPORT vtkPVFileInformation : public vtkPVInformation
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
vtkPVInformation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
vtkPVFileInformation::FullPath
char * FullPath
Definition: vtkPVFileInformation.h:188
vtkPVFileInformation::DIRECTORY
@ DIRECTORY
Definition: vtkPVFileInformation.h:53
vtkPVFileInformation::SequenceParser
vtkFileSequenceParser * SequenceParser
Definition: vtkPVFileInformation.h:185
type
type
vtkPVFileInformation::FILE_GROUP
@ FILE_GROUP
Definition: vtkPVFileInformation.h:55
vtkObject::New
static vtkObject * New()
vtkPVFileInformation::IncludeExamples
bool IncludeExamples
Definition: vtkPVFileInformation.h:212
vtkClientServerStream
Store messages for the interpreter.
Definition: vtkClientServerStream.h:23
vtkPVInformation.h
vtkPVFileInformation::Type
int Type
Definition: vtkPVFileInformation.h:189
vtkObject
vtkPVFileInformation::GroupFileSequences
bool GroupFileSequences
Definition: vtkPVFileInformation.h:211
vtkPVFileInformation::Size
long long Size
Definition: vtkPVFileInformation.h:192
vtkFileSequenceParser
Parses out the base file name of a file sequence and also the specific index of the given file.
Definition: vtkFileSequenceParser.h:28
vtkPVFileInformation::ModificationTime
time_t ModificationTime
Definition: vtkPVFileInformation.h:193
vtkPVFileInformation::ReadDetailedFileInformation
bool ReadDetailedFileInformation
Definition: vtkPVFileInformation.h:210
vtkPVFileInformation::SINGLE_FILE
@ SINGLE_FILE
Definition: vtkPVFileInformation.h:51
vtkPVFileInformation::DRIVE
@ DRIVE
Definition: vtkPVFileInformation.h:56
vtkPVInformation::operator=
void operator=(const vtkPVInformation &)=delete
vtkPVFileInformation::Name
char * Name
Definition: vtkPVFileInformation.h:187
vtkPVFileInformation::FileTypes
FileTypes
Definition: vtkPVFileInformation.h:48
vtkCollection
vtkPVFileInformation::IsGroup
static bool IsGroup(int type)
Helper that returns true if file-type is a network related file i.e.
Definition: vtkPVFileInformation.h:79
vtkPVFileInformation::NETWORK_ROOT
@ NETWORK_ROOT
Definition: vtkPVFileInformation.h:57
vtkPVFileInformation::FastFileTypeDetection
int FastFileTypeDetection
Definition: vtkPVFileInformation.h:209
vtkPVFileInformation::IsGroup
bool IsGroup() const
Helper that returns true if file-type is a network related file i.e.
Definition: vtkPVFileInformation.h:90
vtkPVFileInformation::Hidden
bool Hidden
Definition: vtkPVFileInformation.h:190
vtkPVFileInformation::IsDirectory
bool IsDirectory() const
Helper that returns whether a FileType is a directory (DIRECTORY, DRIVE, NETWORK_ROOT,...
Definition: vtkPVFileInformation.h:71
vtkIndent
vtkPVFileInformation::NETWORK_SERVER
@ NETWORK_SERVER
Definition: vtkPVFileInformation.h:59
vtkPVInformation::CopyFromObject
virtual void CopyFromObject(vtkObject *)
Transfer information about a single object into this object.
vtkPVFileInformation::Extension
char * Extension
Definition: vtkPVFileInformation.h:191
vtkPVFileInformation::SINGLE_FILE_LINK
@ SINGLE_FILE_LINK
Definition: vtkPVFileInformation.h:52
vtkPVFileInformation::NETWORK_DOMAIN
@ NETWORK_DOMAIN
Definition: vtkPVFileInformation.h:58
vtkPVFileInformation::Contents
vtkCollection * Contents
Definition: vtkPVFileInformation.h:184
vtkPVInformation
Superclass for information objects.
Definition: vtkPVInformation.h:19
vtkPVFileInformation
Information object that can be used to obtain information about a file/directory.
Definition: vtkPVFileInformation.h:27
vtkPVInformation::CopyToStream
virtual void CopyToStream(vtkClientServerStream *)=0
Manage a serialized version of the information.
vtkPVInformation::CopyFromStream
virtual void CopyFromStream(const vtkClientServerStream *)
Manage a serialized version of the information.
vtkPVFileInformation::DIRECTORY_LINK
@ DIRECTORY_LINK
Definition: vtkPVFileInformation.h:54
vtkPVFileInformation::NETWORK_SHARE
@ NETWORK_SHARE
Definition: vtkPVFileInformation.h:60