Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qanystringview.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4#include "qanystringview.h"
5#include "qdebug.h"
6#include "qttypetraits.h"
7
9
624{
625 struct S { const char *prefix, *suffix; };
626 const auto affixes = s.visit([](auto s) {
627 using View = decltype(s);
628 if constexpr (std::is_same_v<View, QLatin1StringView>) {
629 return S{"", "_L1"};
630 } else if constexpr (std::is_same_v<View, QUtf8StringView>) {
631 return S{"u8", ""};
632 } else if constexpr (std::is_same_v<View, QStringView>) {
633 return S{"u", ""};
634 } else {
636 }
637 });
638 const QDebugStateSaver saver(d);
639 d.nospace();
640 if (d.quoteStrings())
641 d << affixes.prefix;
642 s.visit([&d](auto s) { d << s; });
643 if (d.quoteStrings())
644 d << affixes.suffix;
645 return d;
646}
647
648
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Combined button and popup list for selecting options.
QDebug operator<<(QDebug d, QAnyStringView s)
GLdouble s
[6]
Definition qopenglext.h:235