File indexing completed on 2024-11-10 04:41:03

0001 /*
0002     SPDX-FileCopyrightText: 2019 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <utility>
0010 
0011 #include <QString>
0012 #include <QStringView>
0013 
0014 /// Helper integration between Akonadi and Qt
0015 
0016 namespace Akonadi
0017 {
0018 template<typename DPtr, typename Slot>
0019 auto akPrivSlot(DPtr &&dptr, Slot &&slot)
0020 {
0021     return [&dptr, &slot](auto &&...args) {
0022         (dptr->*slot)(std::forward<decltype(args)>(args)...);
0023     };
0024 }
0025 
0026 } // namespace
0027 
0028 inline QString operator""_qs(const char16_t *str, std::size_t len)
0029 {
0030     return QString(reinterpret_cast<const QChar *>(str), len);
0031 }
0032 
0033 constexpr QStringView operator""_qsv(const char16_t *str, std::size_t len)
0034 {
0035     return QStringView(str, len);
0036 }