File indexing completed on 2025-01-18 10:07:38
0001
0002
0003
0004
0005 #ifndef QSTRINGLITERAL_H
0006 #define QSTRINGLITERAL_H
0007
0008 #include <QtCore/qarraydata.h>
0009 #include <QtCore/qarraydatapointer.h>
0010
0011 #if 0
0012 #pragma qt_class(QStringLiteral)
0013 #endif
0014
0015 QT_BEGIN_NAMESPACE
0016
0017
0018
0019
0020
0021
0022 #define QT_UNICODE_LITERAL(str) u"" str
0023
0024 using QStringPrivate = QArrayDataPointer<char16_t>;
0025
0026 namespace QtPrivate {
0027 template <qsizetype N>
0028 static Q_ALWAYS_INLINE QStringPrivate qMakeStringPrivate(const char16_t (&literal)[N])
0029 {
0030
0031 auto str = const_cast<char16_t *>(literal);
0032 return { nullptr, str, N - 1 };
0033 }
0034 }
0035
0036 #define QStringLiteral(str) \
0037 (QString(QtPrivate::qMakeStringPrivate(QT_UNICODE_LITERAL(str)))) \
0038
0039
0040
0041 QT_END_NAMESPACE
0042
0043 #endif