CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkUtils.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkUtils_h
22 #define __ctkUtils_h
23 
24 // Qt includes
25 #include <QStringList>
26 #include <QDateTime>
27 
28 // STD includes
29 #include <vector>
30 
31 #include "ctkCoreExport.h"
32 
33 namespace ctk {
38 void CTK_CORE_EXPORT qListToSTLVector(const QStringList& list, std::vector<char*>& vector);
39 
43 void CTK_CORE_EXPORT qListToSTLVector(const QStringList& list, std::vector<std::string>& vector);
44 
48 void CTK_CORE_EXPORT stlVectorToQList(const std::vector<std::string>& vector, QStringList& list);
49 
57 QStringList CTK_CORE_EXPORT nameFilterToExtensions(const QString& nameFilter);
58 
63 QStringList CTK_CORE_EXPORT nameFiltersToExtensions(const QStringList& nameFilters);
64 
69 QString CTK_CORE_EXPORT extensionToRegExp(const QString& extension);
70 
76 QRegExp CTK_CORE_EXPORT nameFiltersToRegExp(const QStringList& nameFilters);
77 
89 int CTK_CORE_EXPORT significantDecimals(double value, int defaultDecimals = -1);
90 
103 int CTK_CORE_EXPORT orderOfMagnitude(double value);
104 
114 double CTK_CORE_EXPORT closestPowerOfTen(double value);
115 
122 bool CTK_CORE_EXPORT removeDirRecursively(const QString & dirName);
123 
124 
132 bool CTK_CORE_EXPORT copyDirRecursively(const QString &srcPath, const QString &dstPath);
133 
138 QString CTK_CORE_EXPORT qtHandleToString(Qt::HANDLE handle);
139 
140 
151 qint64 CTK_CORE_EXPORT msecsTo(const QDateTime& t1, const QDateTime& t2);
152 
153 }
154 
155 #endif
int CTK_CORE_EXPORT significantDecimals(double value, int defaultDecimals=-1)
bool CTK_CORE_EXPORT removeDirRecursively(const QString &dirName)
QString CTK_CORE_EXPORT extensionToRegExp(const QString &extension)
void CTK_CORE_EXPORT qListToSTLVector(const QStringList &list, std::vector< char * > &vector)
int CTK_CORE_EXPORT orderOfMagnitude(double value)
QStringList CTK_CORE_EXPORT nameFiltersToExtensions(const QStringList &nameFilters)
qint64 CTK_CORE_EXPORT msecsTo(const QDateTime &t1, const QDateTime &t2)
Compute the milli seconds from one QDateTime to an other.
QRegExp CTK_CORE_EXPORT nameFiltersToRegExp(const QStringList &nameFilters)
double CTK_CORE_EXPORT closestPowerOfTen(double value)
void CTK_CORE_EXPORT stlVectorToQList(const std::vector< std::string > &vector, QStringList &list)
bool CTK_CORE_EXPORT copyDirRecursively(const QString &srcPath, const QString &dstPath)
QString CTK_CORE_EXPORT qtHandleToString(Qt::HANDLE handle)
QStringList CTK_CORE_EXPORT nameFilterToExtensions(const QString &nameFilter)