libosmscout 1.1.1
Loading...
Searching...
No Matches
QtStdConverters.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_QTSTDCONVERTERS_H
2#define OSMSCOUT_CLIENT_QT_QTSTDCONVERTERS_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2023 Lukas Karas
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23
25
26#include <osmscout/util/Time.h>
27
28#include <QDateTime>
29#include <QStringList>
30#include <QDir>
31
32#include <filesystem>
33#include <vector>
34
35namespace osmscout {
36
37extern OSMSCOUT_CLIENT_QT_API std::vector<std::string> QStringListToStringVector(const QStringList &list);
38
39extern OSMSCOUT_CLIENT_QT_API QStringList StringVectorToQStringList(const std::vector<std::string> &v);
40
42
43extern OSMSCOUT_CLIENT_QT_API QList<QDir> PathVectorToQDirList(const std::vector<std::filesystem::path> &paths);
44
45template <typename T>
46QList<T> vectorToQList(const std::vector<T> &vec)
47{
48 QList<T> result;
49 for (const auto &o: vec) {
50 result << o;
51 }
52 return result;
53}
54
55}
56
57#endif //OSMSCOUT_CLIENT_QT_QTSTDCONVERTERS_H
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Definition Area.h:39
std::chrono::system_clock::time_point Timestamp
Definition Time.h:27
OSMSCOUT_CLIENT_QT_API std::vector< std::string > QStringListToStringVector(const QStringList &list)
OSMSCOUT_CLIENT_QT_API QList< QDir > PathVectorToQDirList(const std::vector< std::filesystem::path > &paths)
QList< T > vectorToQList(const std::vector< T > &vec)
Definition QtStdConverters.h:46
OSMSCOUT_CLIENT_QT_API QDateTime TimestampToQDateTime(const osmscout::Timestamp &ts)
OSMSCOUT_CLIENT_QT_API QStringList StringVectorToQStringList(const std::vector< std::string > &v)