1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#ifndef COMPATIBILITY_H
#define COMPATIBILITY_H
#include "coreSQLiteStudio_global.h"
#include <QList>
#include <QSet>
#include <QHash>
template <class T>
inline QSet<T> toSet(const QList<T>& list)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
return QSet<T>(list.begin(), list.end());
#else
return list.toSet();
#endif
}
template <class K, class V>
inline void unite(QHash<K, V>& h1, const QHash<K, V>& h2)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
h1.insert(h2);
#else
h1.unite(h2);
#endif
}
template <class T>
void sSort(T& collection)
{
std::sort(collection.begin(), collection.end());
}
template <class T, class C>
void sSort(T& collection, C cmp)
{
std::sort(collection.begin(), collection.end(), cmp);
}
API_EXPORT void strSort(QStringList& collection, Qt::CaseSensitivity cs);
#endif // COMPATIBILITY_H
|