diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-09-03 14:02:13 +0200 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-10-15 10:55:18 +0000 |
commit | 1f6bfc220774e9407fe88916843b76ed103cff72 (patch) | |
tree | 8d6157d5b974e6045d75a716f8eb0db4daefa35f /src/corelib/tools/qstringview.cpp | |
parent | 02a214442781bf112c1cc85d2470c6fcec8ed207 (diff) |
Doc: Move literal code block to a separate file
We need to override this snippet for the documentation
we generate for Qt for Python, and it is easier to have
it on a separate file.
Task-number: PYSIDE-801
Task-number: PYSIDE-691
Change-Id: Ideb5b6af25024279f167137d3b65660bb9c96a7e
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/corelib/tools/qstringview.cpp')
-rw-r--r-- | src/corelib/tools/qstringview.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp index ce8fdacafb..a7d9426fa6 100644 --- a/src/corelib/tools/qstringview.cpp +++ b/src/corelib/tools/qstringview.cpp @@ -74,19 +74,14 @@ QT_BEGIN_NAMESPACE string literal. QStringViews should be passed by value, not by reference-to-const: - \code - void myfun1(QStringView sv); // preferred - void myfun2(const QStringView &sv); // compiles and works, but slower - \endcode + \snippet code/src_corelib_tools_qstringview.cpp 0 If you want to give your users maximum freedom in what strings they can pass to your function, accompany the QStringView overload with overloads for \list \li \e QChar: this overload can delegate to the QStringView version: - \code - void fun(QChar ch) { fun(QStringView(&ch, 1)); } - \endcode + \snippet code/src_corelib_tools_qstringview.cpp 1 even though, for technical reasons, QStringView cannot provide a QChar constructor by itself. \li \e QString: if you store an unmodified copy of the string and thus would @@ -291,9 +286,7 @@ QT_BEGIN_NAMESPACE If you need the full array, use the constructor from pointer and size instead: - \code - auto sv = QStringView(array, std::size(array)); // using C++17 std::size() - \endcode + \snippet code/src_corelib_tools_qstringview.cpp 2 \a string must remain valid for the lifetime of this string view object. |