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=========================================================================*/
35#ifndef vtkResourceFileLocator_h
36#define vtkResourceFileLocator_h
37
38#include "vtkCommonMiscModule.h" // For export macro
39#include "vtkObject.h"
40
41#include <string> // needed for std::string
42#include <vector> // needed for std::vector
43
44class VTKCOMMONMISC_EXPORT vtkResourceFileLocator : public vtkObject
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
52
56 vtkSetMacro(LogVerbosity, int);
57 vtkGetMacro(LogVerbosity, int);
59
61
66 virtual std::string Locate(const std::string& anchor, const std::string& landmark,
67 const std::string& defaultDir = std::string());
69
71
79 virtual std::string Locate(const std::string& anchor,
80 const std::vector<std::string>& landmark_prefixes, const std::string& landmark,
81 const std::string& defaultDir = std::string());
83
85
93 static VTK_FILEPATH std::string GetLibraryPathForSymbolUnix(const char* symbolname);
94 static VTK_FILEPATH std::string GetLibraryPathForSymbolWin32(const void* fptr);
96
97protected:
100
101private:
103 void operator=(const vtkResourceFileLocator&) = delete;
104
105 int LogVerbosity;
106};
107
108#if defined(_WIN32) && !defined(__CYGWIN__)
109#define vtkGetLibraryPathForSymbol(function) \
110 vtkResourceFileLocator::GetLibraryPathForSymbolWin32(reinterpret_cast<const void*>(&function))
111#else
112#define vtkGetLibraryPathForSymbol(function) \
113 vtkResourceFileLocator::GetLibraryPathForSymbolUnix(#function)
114#endif
115
116#endif
a simple class to control print indentation
Definition vtkIndent.h:40
abstract base class for most VTK objects
Definition vtkObject.h:63
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