summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-20 13:05:48 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-14 07:46:59 +0200
commit99632c2217c023e6a099e2011b676d419be81a37 (patch)
treec971bf2b2d7fcf49019f10895162db18d6f14d93 /src
parent7b93bedb602724b80c03a55419cfcd33d9a70cc3 (diff)
Allow moving of string converter objects
They are still not copyable, but can be moved. Change-Id: Id66e35be4ecdaa781ecb9212d646d224b1767913 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/text/qstringconverter.h19
1 files changed, 19 insertions, 0 deletions
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;