Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qSlicerUtils.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __qSlicerUtils_h
22#define __qSlicerUtils_h
23
24#include <QFile>
25#include <QString>
26
27#include "qSlicerBaseQTCoreExport.h"
28
30
31class Q_SLICER_BASE_QTCORE_EXPORT qSlicerUtils
32{
33
34public:
35 typedef qSlicerUtils Self;
36
40 static bool isExecutableName(const QString& name);
41
43 static bool isCLIExecutable(const QString& filePath);
44
46 static bool isCLIScriptedExecutable(const QString& filePath);
47
51 static bool isCLILoadableModule(const QString& filePath);
52
56 static bool isLoadableModule(const QString& filePath);
57
63
70 static bool isTestingModuleName(const QString& moduleName);
71
76 static QString searchTargetInIntDir(const QString& directory, const QString& target);
77
80 static QString executableExtension();
81
83 // static QString libraryExtension();
84
90 static QString extractModuleNameFromLibraryName(const QString& libraryName);
91
95 static QString extractModuleNameFromClassName(const QString& className);
96
101 static bool isPluginInstalled(const QString& filePath, const QString& applicationHomeDir);
102
104 static bool isPluginBuiltIn(const QString& filePath, const QString& applicationHomeDir, const QString& applicationRevision);
105
179 static QString pathWithoutIntDir(const QString& path, const QString& subDirWithoutIntDir);
180 static QString pathWithoutIntDir(const QString& path, const QString& subDirWithoutIntDir, QString& intDir);
181
183 static bool pathEndsWith(const QString& inputPath, const QString& path);
184
192 static bool setPermissionsRecursively(const QString& path, QFile::Permissions directoryPermissions, QFile::Permissions filePermissions);
193
218 static QString replaceWikiUrlVersion(const QString& text, const QString& version);
219
238 static QString replaceDocumentationUrlVersion(const QString& text, const QString& hostname, const QString& version);
239
243 static QString safeQStringFromUtf8Ptr(const char* cString);
244
245private:
247 qSlicerUtils() = default;
248 virtual ~qSlicerUtils() = default;
249};
250
251#endif
qSlicerAbstractCoreModule is the base class of any module in Slicer.
static QString searchTargetInIntDir(const QString &directory, const QString &target)
static bool isPluginBuiltIn(const QString &filePath, const QString &applicationHomeDir, const QString &applicationRevision)
Return true if the plugin identified with its filePath is a built-in Slicer module.
static QString pathWithoutIntDir(const QString &path, const QString &subDirWithoutIntDir, QString &intDir)
static bool isLoadableModule(const QString &filePath)
static bool isTestingModuleName(const QString &moduleName)
static bool isExecutableName(const QString &name)
static QString extractModuleNameFromClassName(const QString &className)
static QString replaceDocumentationUrlVersion(const QString &text, const QString &hostname, const QString &version)
Return an updated text where Slicer documentation URL version is replaced with the provided one.
static QString extractModuleNameFromLibraryName(const QString &libraryName)
This function returns ".dll. on windows, ".so" on linux and ".dylib" on Mac.
qSlicerUtils Self
static bool isPluginInstalled(const QString &filePath, const QString &applicationHomeDir)
static bool setPermissionsRecursively(const QString &path, QFile::Permissions directoryPermissions, QFile::Permissions filePermissions)
static QString executableExtension()
static bool pathEndsWith(const QString &inputPath, const QString &path)
Return true if the inputPath ends with path.
static QString replaceWikiUrlVersion(const QString &text, const QString &version)
Return an updated text where Slicer wiki URL version is replaced with the provided one....
static bool isTestingModule(qSlicerAbstractCoreModule *module)
static bool isCLIExecutable(const QString &filePath)
Returns true if the filePath matches the CLI executable file name requirements.
static bool isCLIScriptedExecutable(const QString &filePath)
Returns true if the filePath matches scripted CLI requirements.
static QString pathWithoutIntDir(const QString &path, const QString &subDirWithoutIntDir)
static QString safeQStringFromUtf8Ptr(const char *cString)
static bool isCLILoadableModule(const QString &filePath)