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>
This commit is contained in:
Lars Knoll 2020-04-20 13:05:48 +02:00
parent 7b93bedb60
commit 99632c2217

View File

@ -66,6 +66,25 @@ public:
constexpr State(Flags f = DefaultConversion) constexpr State(Flags f = DefaultConversion)
: flags(f), state_data{0, 0, 0, 0} {} : flags(f), state_data{0, 0, 0, 0} {}
~State() { clear(); } ~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(); Q_CORE_EXPORT void clear();
Flags flags; Flags flags;