Commit 3aa5b823 authored by David Gobbi's avatar David Gobbi
Browse files

Add the VTK_FILEPATH hint to many methods

The VTK_FILEPATH hint enables the use of Python's fspath protocol,
which allows Path objects to used in places where a path to a file
or directory is needed.  This is a convenience for Python users,
who would otherwise have to explicitly convert Path objects to
strings before using them with VTK.
parent 6c21c3b1
......@@ -44,8 +44,8 @@ public:
* The returned vtkLibHandle can be used to access the symbols in the
* library.
*/
static vtkLibHandle OpenLibrary(const char*);
static vtkLibHandle OpenLibrary(const char*, int);
static vtkLibHandle OpenLibrary(VTK_FILEPATH const char*);
static vtkLibHandle OpenLibrary(VTK_FILEPATH const char*, int);
/**
* Attempt to detach a dynamic library from the
......
......@@ -46,8 +46,8 @@ public:
/**
* Sets the name for the log file.
*/
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
vtkSetFilePathMacro(FileName);
vtkGetFilePathMacro(FileName);
///@}
///@{
......
......@@ -373,14 +373,15 @@ public:
*
* Not intended for public use, please use the logging macros instead.
*/
static void Log(Verbosity verbosity, const char* fname, unsigned int lineno, const char* txt);
static void Log(
Verbosity verbosity, VTK_FILEPATH const char* fname, unsigned int lineno, const char* txt);
static void StartScope(
Verbosity verbosity, const char* id, const char* fname, unsigned int lineno);
Verbosity verbosity, const char* id, VTK_FILEPATH const char* fname, unsigned int lineno);
static void EndScope(const char* id);
#if !defined(__WRAP__)
static void LogF(Verbosity verbosity, const char* fname, unsigned int lineno,
static void LogF(Verbosity verbosity, VTK_FILEPATH const char* fname, unsigned int lineno,
VTK_FORMAT_STRING_TYPE format, ...) VTK_PRINTF_LIKE(4, 5);
static void StartScopeF(Verbosity verbosity, const char* id, const char* fname,
static void StartScopeF(Verbosity verbosity, const char* id, VTK_FILEPATH const char* fname,
unsigned int lineno, VTK_FORMAT_STRING_TYPE format, ...) VTK_PRINTF_LIKE(5, 6);
class VTKCOMMONCORE_EXPORT LogScopeRAII
......
......@@ -199,7 +199,7 @@ public:
/**
* This returns the path to a dynamically loaded factory.
*/
vtkGetStringMacro(LibraryPath);
vtkGetFilePathMacro(LibraryPath);
///@}
typedef vtkObject* (*CreateFunction)();
......
......@@ -272,7 +272,7 @@ public:
* Prints element tree as XML.
*/
void PrintXML(ostream& os, vtkIndent indent);
void PrintXML(const char* fname);
void PrintXML(VTK_FILEPATH const char* fname);
///@}
///@{
......
......@@ -45,7 +45,7 @@ public:
* Note that the time values are either integers growing sequentially,
* or are obtained from individual files as supported by the subclass.
*/
void AddFileName(const char* fname);
void AddFileName(VTK_FILEPATH const char* fname);
/**
* Removes all filenames stored by the reader.
......@@ -60,13 +60,13 @@ public:
/**
* Returns a particular filename stored by the reader.
*/
const char* GetFileName(int i) const;
VTK_FILEPATH const char* GetFileName(int i) const;
/**
* Returns the filename that was last loaded by the reader.
* This is set internally in ReadMesh()
*/
const char* GetCurrentFileName() const;
VTK_FILEPATH const char* GetCurrentFileName() const;
///@{
/**
......
......@@ -40,7 +40,7 @@ public:
* Note that the time values are either integers growing sequentially,
* or are obtained from individual files as supported by the subclass.
*/
void AddFileName(const char* fname);
void AddFileName(VTK_FILEPATH const char* fname);
/**
* Removes all filenames stored by the reader.
......@@ -55,13 +55,13 @@ public:
/**
* Returns a particular filename stored by the reader.
*/
const char* GetFileName(int i) const;
VTK_FILEPATH const char* GetFileName(int i) const;
/**
* Returns the filename that was last loaded by the reader.
* This is set internally in ReadMesh()
*/
const char* GetCurrentFileName() const;
VTK_FILEPATH const char* GetCurrentFileName() const;
///@{
/**
......@@ -84,14 +84,15 @@ public:
* will return vtkMath::NaN() if no time value is present
* in the file.
*/
virtual double GetTimeValue(const std::string& fname);
virtual double GetTimeValue(VTK_FILEPATH const std::string& fname);
/**
* A subclass can override this method to provide meta data
* specific to a particular file. In order for this method
* to be called, HasTemporalMetaData has to be set to true.
*/
virtual int ReadMetaDataSimple(const std::string& /*fname*/, vtkInformation* /*metadata*/)
virtual int ReadMetaDataSimple(
VTK_FILEPATH const std::string& /*fname*/, vtkInformation* /*metadata*/)
{
return 1;
}
......@@ -102,7 +103,7 @@ public:
* method and should be used by the subclass. The subclass directly
* adds the structure/topology to the provided data object.
*/
virtual int ReadMeshSimple(const std::string& fname, vtkDataObject* output) = 0;
virtual int ReadMeshSimple(VTK_FILEPATH const std::string& fname, vtkDataObject* output) = 0;
/**
* A method that needs to be override by the subclass to provide
......@@ -110,7 +111,7 @@ public:
* method and should be used by the subclass. The subclass directly
* adds the coordinates to the provided data object.
*/
virtual int ReadPointsSimple(const std::string& fname, vtkDataObject* output) = 0;
virtual int ReadPointsSimple(VTK_FILEPATH const std::string& fname, vtkDataObject* output) = 0;
/**
* A method that needs to be override by the subclass to provide
......@@ -118,7 +119,7 @@ public:
* method and should be used by the subclass. The subclass directly
* adds data arrays to the provided data object.
*/
virtual int ReadArraysSimple(const std::string& fname, vtkDataObject* output) = 0;
virtual int ReadArraysSimple(VTK_FILEPATH const std::string& fname, vtkDataObject* output) = 0;
protected:
vtkSimpleReader();
......
......@@ -107,8 +107,8 @@ public:
* can simply use the `vtkGetLibraryPathForSymbol(GetVTKVersion)` macro
* that makes the appropriate call as per the current platform.
*/
static std::string GetLibraryPathForSymbolUnix(const char* symbolname);
static std::string GetLibraryPathForSymbolWin32(const void* fptr);
static VTK_FILEPATH std::string GetLibraryPathForSymbolUnix(const char* symbolname);
static VTK_FILEPATH std::string GetLibraryPathForSymbolWin32(const void* fptr);
///@}
protected:
......
......@@ -124,7 +124,7 @@ public:
* Write the timing table out to a file. Calculate some helpful
* statistics (deltas and percentages) in the process.
*/
static void DumpLog(const char* filename);
static void DumpLog(VTK_FILEPATH const char* filename);
///@}
///@{
......
......@@ -56,8 +56,8 @@ public:
* have been set with SetBasisSet and SetFileName, the object takes
* precedence over the file and the file will not be read.
*/
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
vtkSetFilePathMacro(FileName);
vtkGetFilePathMacro(FileName);
///@}
///@{
......
......@@ -46,7 +46,7 @@ public:
/**
* Is the given file supported ?
*/
int CanReadFile(const char* fname) override;
int CanReadFile(VTK_FILEPATH const char* fname) override;
/**
* Get the file extensions for this format.
......
......@@ -236,8 +236,8 @@ public:
* Set/Get the filename to be used with the particle writer when
* dumping particles to disk
*/
vtkSetStringMacro(ParticleFileName);
vtkGetStringMacro(ParticleFileName);
vtkSetFilePathMacro(ParticleFileName);
vtkGetFilePathMacro(ParticleFileName);
///@}
///@{
......
......@@ -225,8 +225,8 @@ public:
* Set/Get the filename to be used with the particle writer when
* dumping particles to disk
*/
vtkSetStringMacro(ParticleFileName);
vtkGetStringMacro(ParticleFileName);
vtkSetFilePathMacro(ParticleFileName);
vtkGetFilePathMacro(ParticleFileName);
///@}
///@{
......
......@@ -53,11 +53,11 @@ public:
/**
* Specify file name of Facet datafile to read
*/
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
vtkSetFilePathMacro(FileName);
vtkGetFilePathMacro(FileName);
///@}
static int CanReadFile(const char* filename);
static int CanReadFile(VTK_FILEPATH const char* filename);
protected:
vtkFacetReader();
......
......@@ -95,7 +95,7 @@ public:
/**
* Write GDALDataset to tiff file
*/
void WriteTifFile(GDALDataset* dataset, const char* filename);
void WriteTifFile(GDALDataset* dataset, VTK_FILEPATH const char* filename);
/**
* Traverse values in specified band to find min/max.
......
......@@ -73,9 +73,9 @@ public:
* Test whether or not a given file should even be attempted for use with this
* reader.
*/
int CanReadFile(const std::string& name);
int CanReadFile(VTK_FILEPATH const std::string& name);
virtual int CanReadFile(const char* filename);
virtual int CanReadFile(VTK_FILEPATH const char* filename);
///@{
/**
......@@ -85,7 +85,7 @@ public:
vtkGetMacro(FileName, std::string);
///@}
void SetFileName(const char* filename);
void SetFileName(VTK_FILEPATH const char* filename);
///@{
/**
......
......@@ -48,8 +48,8 @@ public:
vtkTypeMacro(vtkADIOS2VTXReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
vtkSetFilePathMacro(FileName);
vtkGetFilePathMacro(FileName);
protected:
vtkADIOS2VTXReader();
......
......@@ -90,8 +90,8 @@ public:
void SetParticleArrayStatus(const char* name, int status);
///@}
virtual void SetFileName(const char* fileName);
vtkGetStringMacro(FileName);
virtual void SetFileName(VTK_FILEPATH const char* fileName);
vtkGetFilePathMacro(FileName);
///@{
/**
......
......@@ -116,8 +116,8 @@ public:
* Set/Get the filename. Concrete instances of this class must implement
* the SetFileName method accordingly.
*/
vtkGetStringMacro(FileName);
virtual void SetFileName(const char* fileName) = 0;
vtkGetFilePathMacro(FileName);
virtual void SetFileName(VTK_FILEPATH const char* fileName) = 0;
///@}
/**
......
......@@ -61,7 +61,7 @@ public:
/**
* See vtkAMRBaseReader::SetFileName
*/
void SetFileName(const char* fileName) override;
void SetFileName(VTK_FILEPATH const char* fileName) override;
protected:
vtkAMREnzoReader();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment