2021-01-05 13:17:11 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018-2021 QuasarApp.
|
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
2020-09-07 10:14:15 +03:00
|
|
|
#ifndef DEFINES_H
|
|
|
|
#define DEFINES_H
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
#if QT_VERSION > QT_VERSION_CHECK(5, 13, 0)
|
|
|
|
#define splitbehavior Qt::SkipEmptyParts
|
|
|
|
#else
|
|
|
|
#define splitbehavior QString::SkipEmptyParts
|
|
|
|
#endif
|
|
|
|
|
2020-12-03 20:00:14 +03:00
|
|
|
template<class Container, class Key, class T>
|
|
|
|
T& valueLink(Container& ctr, const Key& key, const T& defaultValue) {
|
|
|
|
auto it = ctr.find(key);
|
|
|
|
if (it != ctr.end()) {
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
|
|
|
|
return *ctr.insert(key, defaultValue);
|
|
|
|
};
|
|
|
|
|
2020-09-07 10:14:15 +03:00
|
|
|
#endif // DEFINES_H
|