From 99632c2217c023e6a099e2011b676d419be81a37 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 20 Apr 2020 13:05:48 +0200 Subject: [PATCH] Allow moving of string converter objects They are still not copyable, but can be moved. Change-Id: Id66e35be4ecdaa781ecb9212d646d224b1767913 Reviewed-by: Thiago Macieira --- src/corelib/text/qstringconverter.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/corelib/text/qstringconverter.h b/src/corelib/text/qstringconverter.h index 87fb7fc06a..2e0f0db616 100644 --- a/src/corelib/text/qstringconverter.h +++ b/src/corelib/text/qstringconverter.h @@ -66,6 +66,25 @@ public: constexpr State(Flags f = DefaultConversion) : flags(f), state_data{0, 0, 0, 0} {} ~State() { clear(); } + State(State &&other) + : flags(other.flags), + remainingChars(other.remainingChars), + invalidChars(other.invalidChars), + d{other.d[0], other.d[1]}, + clearFn(other.clearFn) + { other.clearFn = nullptr; } + State &operator=(State &&other) + { + clear(); + flags = other.flags; + remainingChars = other.remainingChars; + invalidChars = other.invalidChars; + d[0] = other.d[0]; + d[1] = other.d[1]; + clearFn = other.clearFn; + other.clearFn = nullptr; + return *this; + } Q_CORE_EXPORT void clear(); Flags flags;