TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
ttkstringliterals.h
Go to the documentation of this file.
1 #ifndef TTKSTRINGLITERALS_H
2 #define TTKSTRINGLITERALS_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Library Module project
6  * Copyright (C) 2015 - 2025 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program 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
16  * GNU Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include "ttkmoduleexport.h"
23 #if TTK_QT_VERSION_CHECK(5,10,0)
24 # include <QStringView>
25 #endif
26 
30 namespace Qt
31 {
32  namespace Literals
33  {
34  namespace StringLiterals
35  {
36 #if !TTK_QT_VERSION_CHECK(6,4,0)
37  inline QString operator""_s(const char* str, size_t size) noexcept
38  {
39  return QString::fromUtf8(str, static_cast<int>(size));
40  }
41 
42  inline QString operator""_s(const wchar_t* str, size_t size) noexcept
43  {
44  return QString::fromWCharArray(str, static_cast<int>(size));
45  }
46 
47  inline QString operator""_s(const char16_t* str, size_t size) noexcept
48  {
49  return QString::fromUtf16(str, static_cast<int>(size));
50  }
51 
52  inline QString operator""_s(const char32_t* str, size_t size) noexcept
53  {
54  return QString::fromUcs4(str, static_cast<int>(size));
55  }
56 
57  inline QByteArray operator""_ba(const char* str, size_t size) noexcept
58  {
59  return operator""_s(str, size).toUtf8();
60  }
61 
62  inline QByteArray operator""_ba(const wchar_t* str, size_t size) noexcept
63  {
64  return operator""_s(str, size).toUtf8();
65  }
66 
67  inline QByteArray operator""_ba(const char16_t* str, size_t size) noexcept
68  {
69  return operator""_s(str, size).toUtf8();
70  }
71 
72  inline QByteArray operator""_ba(const char32_t* str, size_t size) noexcept
73  {
74  return operator""_s(str, size).toUtf8();
75  }
76 #endif
77 
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
80  {
81  return QStringView(str, size);
82  }
83 #endif
84  }
85  }
86 }
87 
88 #endif // TTKSTRINGLITERALS_H
The namespace of the string literals.
voidpf void uLong size
Definition: ioapi.h:136