1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
/*=========================================================================
Program: ParaView
Module: vtkPVFileInformation.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkPVFileInformation
* @brief Information object that can
* be used to obtain information about a file/directory.
*
* vtkPVFileInformation can be used to collect information about file
* or directory. vtkPVFileInformation can collect information
* from a vtkPVFileInformationHelper object alone.
* @sa
* vtkPVFileInformationHelper
*/
#ifndef vtkPVFileInformation_h
#define vtkPVFileInformation_h
#include "vtkPVClientServerCoreDefaultModule.h" //needed for exports
#include "vtkPVInformation.h"
#include <string> // Needed for std::string
class vtkCollection;
class vtkPVFileInformationSet;
class vtkFileSequenceParser;
class VTKPVCLIENTSERVERCOREDEFAULT_EXPORT vtkPVFileInformation : public vtkPVInformation
{
public:
static vtkPVFileInformation* New();
vtkTypeMacro(vtkPVFileInformation, vtkPVInformation);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Transfer information about a single object into this object.
* The object must be a vtkPVFileInformationHelper.
*/
virtual void CopyFromObject(vtkObject* object) VTK_OVERRIDE;
//@{
/**
* Manage a serialized version of the information.
*/
virtual void CopyToStream(vtkClientServerStream*) VTK_OVERRIDE;
virtual void CopyFromStream(const vtkClientServerStream*) VTK_OVERRIDE;
//@}
enum FileTypes
{
INVALID = 0,
SINGLE_FILE,
SINGLE_FILE_LINK,
DIRECTORY,
DIRECTORY_LINK,
FILE_GROUP,
DRIVE,
NETWORK_ROOT,
NETWORK_DOMAIN,
NETWORK_SERVER,
NETWORK_SHARE
};
/**
* 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.
*/
static bool IsDirectory(int t);
/**
* Initializes the information object.
*/
void Initialize();
//@{
/**
* Get the name of the file/directory whose information is
* represented by this object.
*/
vtkGetStringMacro(Name);
//@}
//@{
/**
* Get the full path of the file/directory whose information is
* represented by this object.
*/
vtkGetStringMacro(FullPath);
//@}
//@{
/**
* Get the type of this file object.
*/
vtkGetMacro(Type, int);
//@}
//@{
/**
* Get the state of the hidden flag for the file/directory.
*/
vtkGetMacro(Hidden, bool);
//@}
//@{
/**
* Get the Contents for this directory.
* Returns a collection with vtkPVFileInformation objects
* for the contents of this directory if Type = DIRECTORY
* or the contents of this file group if Type ==FILE_GROUP.
*/
vtkGetObjectMacro(Contents, vtkCollection);
vtkGetStringMacro(Extension);
vtkGetMacro(Size, long long);
vtkGetMacro(ModificationTime, time_t);
//@}
protected:
vtkPVFileInformation();
~vtkPVFileInformation();
vtkCollection* Contents;
vtkFileSequenceParser* SequenceParser;
char* Name; // Name of this file/directory.
char* FullPath; // Full path for this file/directory.
int Type; // Type i.e. File/Directory/FileGroup.
bool Hidden; // If file/directory is hidden
char* Extension; // File extension
long long Size; // File size
time_t ModificationTime; // File modification time
vtkSetStringMacro(Extension);
vtkSetStringMacro(Name);
vtkSetStringMacro(FullPath);
void GetWindowsDirectoryListing();
void GetDirectoryListing();
// Goes thru the collection of vtkPVFileInformation objects
// are creates file groups, if possible.
void OrganizeCollection(vtkPVFileInformationSet& vector);
bool DetectType();
void GetSpecialDirectories();
void SetHiddenFlag();
int FastFileTypeDetection;
bool ReadDetailedFileInformation;
private:
vtkPVFileInformation(const vtkPVFileInformation&) VTK_DELETE_FUNCTION;
void operator=(const vtkPVFileInformation&) VTK_DELETE_FUNCTION;
struct vtkInfo;
};
#endif
|