itom 2.2.1
|
00001 /*========================================================================= 00002 00003 Library: CTK 00004 00005 Copyright (c) Kitware Inc. 00006 00007 Licensed under the Apache License, Version 2.0 (the "License"); 00008 you may not use this file except in compliance with the License. 00009 You may obtain a copy of the License at 00010 00011 http://www.apache.org/licenses/LICENSE-2.0.txt 00012 00013 Unless required by applicable law or agreed to in writing, software 00014 distributed under the License is distributed on an "AS IS" BASIS, 00015 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 See the License for the specific language governing permissions and 00017 limitations under the License. 00018 00019 =========================================================================*/ 00020 00021 #ifndef UTILS_H 00022 #define UTILS_H 00023 00024 // Qt includes 00025 #include <QStringList> 00026 #include <QDateTime> 00027 00028 // STD includes 00029 #include <vector> 00030 00031 #include "commonWidgets.h" 00032 00033 namespace ctk { 00038 void ITOMWIDGETS_EXPORT qListToSTLVector(const QStringList& list, std::vector<char*>& vector); 00039 00043 void ITOMWIDGETS_EXPORT qListToSTLVector(const QStringList& list, std::vector<std::string>& vector); 00044 00048 void ITOMWIDGETS_EXPORT stlVectorToQList(const std::vector<std::string>& vector, QStringList& list); 00049 00057 QStringList ITOMWIDGETS_EXPORT nameFilterToExtensions(const QString& nameFilter); 00058 00063 QStringList ITOMWIDGETS_EXPORT nameFiltersToExtensions(const QStringList& nameFilters); 00064 00069 QString ITOMWIDGETS_EXPORT extensionToRegExp(const QString& extension); 00070 00076 QRegExp ITOMWIDGETS_EXPORT nameFiltersToRegExp(const QStringList& nameFilters); 00077 00089 int ITOMWIDGETS_EXPORT significantDecimals(double value, int defaultDecimals = -1); 00090 00103 int ITOMWIDGETS_EXPORT orderOfMagnitude(double value); 00104 00114 double ITOMWIDGETS_EXPORT closestPowerOfTen(double value); 00115 00122 bool ITOMWIDGETS_EXPORT removeDirRecursively(const QString & dirName); 00123 00124 00132 bool ITOMWIDGETS_EXPORT copyDirRecursively(const QString &srcPath, const QString &dstPath); 00133 00138 QString ITOMWIDGETS_EXPORT qtHandleToString(Qt::HANDLE handle); 00139 00140 00151 qint64 ITOMWIDGETS_EXPORT msecsTo(const QDateTime& t1, const QDateTime& t2); 00152 00153 } 00154 00155 #endif