itom
Loading...
Searching...
No Matches
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
33namespace ctk {
38void ITOMWIDGETS_EXPORT qListToSTLVector(const QStringList& list, std::vector<char*>& vector);
39
43void ITOMWIDGETS_EXPORT qListToSTLVector(const QStringList& list, std::vector<std::string>& vector);
44
48void ITOMWIDGETS_EXPORT stlVectorToQList(const std::vector<std::string>& vector, QStringList& list);
49
57QStringList ITOMWIDGETS_EXPORT nameFilterToExtensions(const QString& nameFilter);
58
63QStringList ITOMWIDGETS_EXPORT nameFiltersToExtensions(const QStringList& nameFilters);
64
69QString ITOMWIDGETS_EXPORT extensionToRegExp(const QString& extension);
70
76QRegularExpression ITOMWIDGETS_EXPORT nameFiltersToRegExp(const QStringList& nameFilters);
77
89int ITOMWIDGETS_EXPORT significantDecimals(double value, int defaultDecimals = -1);
90
103int ITOMWIDGETS_EXPORT orderOfMagnitude(double value);
104
114double ITOMWIDGETS_EXPORT closestPowerOfTen(double value);
115
122bool ITOMWIDGETS_EXPORT removeDirRecursively(const QString & dirName);
123
124
132bool ITOMWIDGETS_EXPORT copyDirRecursively(const QString &srcPath, const QString &dstPath);
133
138QString ITOMWIDGETS_EXPORT qtHandleToString(Qt::HANDLE handle);
139
140
151qint64 ITOMWIDGETS_EXPORT msecsTo(const QDateTime& t1, const QDateTime& t2);
152
153}
154
155#endif