vtkPVFileInformation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkPVFileInformation.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
27 #ifndef vtkPVFileInformation_h
28 #define vtkPVFileInformation_h
29 
30 #include "vtkPVInformation.h"
31 #include "vtkRemotingCoreModule.h" //needed for exports
32 
33 #include <string> // Needed for std::string
34 
35 class vtkCollection;
36 class vtkPVFileInformationSet;
38 
40 {
41 public:
42  static vtkPVFileInformation* New();
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
50  void CopyFromObject(vtkObject* object) override;
51 
53 
56  void CopyToStream(vtkClientServerStream*) override;
57  void CopyFromStream(const vtkClientServerStream*) override;
59 
60  enum FileTypes
61  {
62  INVALID = 0,
73  DIRECTORY_GROUP
74  };
75 
77 
82  static bool IsDirectory(int t);
83  bool IsDirectory() const { return vtkPVFileInformation::IsDirectory(this->Type); }
85 
87 
91  static bool IsGroup(int type)
92  {
93  switch (type)
94  {
95  case FILE_GROUP:
96  case DIRECTORY_GROUP:
97  return true;
98  default:
99  return false;
100  }
101  }
102  bool IsGroup() const { return vtkPVFileInformation::IsGroup(this->Type); }
104 
108  void Initialize();
109 
111 
115  vtkGetStringMacro(Name);
117 
119 
123  vtkGetStringMacro(FullPath);
125 
127 
130  vtkGetMacro(Type, int);
132 
134 
137  vtkGetMacro(Hidden, bool);
139 
141 
147  vtkGetMacro(GroupFileSequences, bool);
148  vtkSetMacro(GroupFileSequences, bool);
149  vtkBooleanMacro(GroupFileSequences, bool);
151 
153 
160  vtkGetObjectMacro(Contents, vtkCollection);
161  vtkGetStringMacro(Extension);
162  vtkGetMacro(Size, long long);
163  vtkGetMacro(ModificationTime, time_t);
165 
169  void FetchDirectoryListing();
170 
175  static std::string GetParaViewSharedResourcesDirectory();
176 
180  static std::string GetParaViewExampleFilesDirectory();
181 
185  static std::string GetParaViewDocDirectory();
186 
187 protected:
189  ~vtkPVFileInformation() override;
190 
193 
194  char* Name; // Name of this file/directory.
195  char* FullPath; // Full path for this file/directory.
196  int Type; // Type i.e. File/Directory/FileGroup.
197  bool Hidden; // If file/directory is hidden
198  char* Extension; // File extension
199  long long Size; // File size
200  time_t ModificationTime; // File modification time
201 
202  vtkSetStringMacro(Extension);
203  vtkSetStringMacro(Name);
204  vtkSetStringMacro(FullPath);
205 
206  void FetchWindowsDirectoryListing();
207  void FetchUnixDirectoryListing();
208 
209  // Goes thru the collection of vtkPVFileInformation objects
210  // are creates file groups, if possible.
211  void OrganizeCollection(vtkPVFileInformationSet& vector);
212 
213  bool DetectType();
214  void GetSpecialDirectories();
215  void SetHiddenFlag();
220 
221 private:
223  void operator=(const vtkPVFileInformation&) = delete;
224 
225  struct vtkInfo;
226 };
227 
228 #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