1 #ifndef TTKSTRINGLITERALS_H
2 #define TTKSTRINGLITERALS_H
23 #if TTK_QT_VERSION_CHECK(5,10,0)
24 # include <QStringView>
34 namespace StringLiterals
36 #if !TTK_QT_VERSION_CHECK(6,4,0)
37 inline QString
operator""_s(
const char* str,
size_t size) noexcept
39 return QString::fromUtf8(str, static_cast<int>(
size));
42 inline QString
operator""_s(
const wchar_t* str,
size_t size) noexcept
44 return QString::fromWCharArray(str, static_cast<int>(
size));
47 inline QString
operator""_s(
const char16_t* str,
size_t size) noexcept
49 return QString::fromUtf16(str, static_cast<int>(
size));
52 inline QString
operator""_s(
const char32_t* str,
size_t size) noexcept
54 return QString::fromUcs4(str, static_cast<int>(
size));
57 inline QByteArray
operator""_ba(
const char* str,
size_t size) noexcept
59 return operator""_s(str,
size).toUtf8();
62 inline QByteArray
operator""_ba(
const wchar_t* str,
size_t size) noexcept
64 return operator""_s(str,
size).toUtf8();
67 inline QByteArray
operator""_ba(
const char16_t* str,
size_t size) noexcept
69 return operator""_s(str,
size).toUtf8();
72 inline QByteArray
operator""_ba(
const char32_t* str,
size_t size) noexcept
74 return operator""_s(str,
size).toUtf8();
78 #if TTK_QT_VERSION_CHECK(5,10,0) && !TTK_QT_VERSION_CHECK(6,10,0)
79 inline QStringView
operator""_sv(
const char16_t* str,
size_t size) noexcept
81 return QStringView(str,
size);
88 #endif // TTKSTRINGLITERALS_H
The namespace of the string literals.