VTK  9.2.6
vtkResourceFileLocator.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkResourceFileLocator.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm 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=========================================================================*/
32#ifndef vtkResourceFileLocator_h
33#define vtkResourceFileLocator_h
34
35#include "vtkCommonMiscModule.h" // For export macro
36#include "vtkObject.h"
37
38#include <string> // needed for std::string
39#include <vector> // needed for std::vector
40
41class VTKCOMMONMISC_EXPORT vtkResourceFileLocator : public vtkObject
42{
43public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49
53 vtkSetMacro(LogVerbosity, int);
54 vtkGetMacro(LogVerbosity, int);
56
58
63 virtual std::string Locate(const std::string& anchor, const std::string& landmark,
64 const std::string& defaultDir = std::string());
66
68
76 virtual std::string Locate(const std::string& anchor,
77 const std::vector<std::string>& landmark_prefixes, const std::string& landmark,
78 const std::string& defaultDir = std::string());
80
82
90 static VTK_FILEPATH std::string GetLibraryPathForSymbolUnix(const char* symbolname);
91 static VTK_FILEPATH std::string GetLibraryPathForSymbolWin32(const void* fptr);
93
94protected:
97
98private:
100 void operator=(const vtkResourceFileLocator&) = delete;
101
102 int LogVerbosity;
103};
104
105#if defined(_WIN32) && !defined(__CYGWIN__)
106#define vtkGetLibraryPathForSymbol(function) \
107 vtkResourceFileLocator::GetLibraryPathForSymbolWin32(reinterpret_cast<const void*>(&function))
108#else
109#define vtkGetLibraryPathForSymbol(function) \
110 vtkResourceFileLocator::GetLibraryPathForSymbolUnix(#function)
111#endif
112
113#endif
a simple class to control print indentation
Definition vtkIndent.h:34
abstract base class for most VTK objects
Definition vtkObject.h:57
utility to locate resource files.
virtual std::string Locate(const std::string &anchor, const std::string &landmark, const std::string &defaultDir=std::string())
Given a starting anchor directory, look for the landmark file relative to the anchor.
~vtkResourceFileLocator() override
static VTK_FILEPATH std::string GetLibraryPathForSymbolUnix(const char *symbolname)
Returns the name of the library providing the symbol.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static VTK_FILEPATH std::string GetLibraryPathForSymbolWin32(const void *fptr)
Returns the name of the library providing the symbol.
static vtkResourceFileLocator * New()
virtual std::string Locate(const std::string &anchor, const std::vector< std::string > &landmark_prefixes, const std::string &landmark, const std::string &defaultDir=std::string())
This variant is used to look for landmark relative to the anchor using additional prefixes for the la...
#define VTK_FILEPATH