summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-08-09 15:19:02 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-08-11 22:32:42 +0200
commit6f833eff92fe703a13214a0c1a593d94e51847d1 (patch)
treec90f1862030c850cfe6b22e47a458c055a16e833 /src/corelib/text/qbytearray.cpp
parent761f32ae2ad98e8fb12a4f05b45b4aa277e47a1b (diff)
Add QByteArrayView::trimmed()
Unlike simplified(), it just moves the end-points, without needing to modify contents, so it makes sense (as for QStringView and QLatin1String) to provide it. Moved QByteArray's trimmed() tests to tst_QByteArrayApiSymmetry so that QBAV can now share them. [ChangeLog][QtCore][QByteArrayView] Added trimmed(). Change-Id: Ifd7a752adb5f3d3e2ad0aa8220efa7e7d2d39baa Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r--src/corelib/text/qbytearray.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index d97375897d..23db7db3e2 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -3390,6 +3390,13 @@ QByteArray QByteArray::trimmed_helper(QByteArray &a)
return QStringAlgorithms<QByteArray>::trimmed_helper(a);
}
+QByteArrayView QtPrivate::trimmed(QByteArrayView view) noexcept
+{
+ auto start = view.begin();
+ auto stop = view.end();
+ QStringAlgorithms<QByteArrayView>::trimmed_helper_positions(start, stop);
+ return QByteArrayView(start, stop);
+}
/*!
Returns a byte array of size \a width that contains this byte array padded