itom  4.1.0
utils.h
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 UTILS_H
22 #define UTILS_H
23 
24 // Qt includes
25 #include <QStringList>
26 #include <QDateTime>
27 
28 // STD includes
29 #include <vector>
30 
31 #include "commonWidgets.h"
32 
33 namespace ctk {
38 void ITOMWIDGETS_EXPORT qListToSTLVector(const QStringList& list, std::vector<char*>& vector);
39 
43 void ITOMWIDGETS_EXPORT qListToSTLVector(const QStringList& list, std::vector<std::string>& vector);
44 
48 void ITOMWIDGETS_EXPORT stlVectorToQList(const std::vector<std::string>& vector, QStringList& list);
49 
57 QStringList ITOMWIDGETS_EXPORT nameFilterToExtensions(const QString& nameFilter);
58 
63 QStringList ITOMWIDGETS_EXPORT nameFiltersToExtensions(const QStringList& nameFilters);
64 
69 QString ITOMWIDGETS_EXPORT extensionToRegExp(const QString& extension);
70 
76 QRegExp ITOMWIDGETS_EXPORT nameFiltersToRegExp(const QStringList& nameFilters);
77 
89 int ITOMWIDGETS_EXPORT significantDecimals(double value, int defaultDecimals = -1);
90 
103 int ITOMWIDGETS_EXPORT orderOfMagnitude(double value);
104 
114 double ITOMWIDGETS_EXPORT closestPowerOfTen(double value);
115 
122 bool ITOMWIDGETS_EXPORT removeDirRecursively(const QString & dirName);
123 
124 
132 bool ITOMWIDGETS_EXPORT copyDirRecursively(const QString &srcPath, const QString &dstPath);
133 
138 QString ITOMWIDGETS_EXPORT qtHandleToString(Qt::HANDLE handle);
139 
140 
151 qint64 ITOMWIDGETS_EXPORT msecsTo(const QDateTime& t1, const QDateTime& t2);
152 
153 }
154 
155 #endif
Definition: utils.h:33