QUrlTwoFlags: add support for operator&=, |=, ^= taking QFlags

Rather than forcing an implicit conversion to int, accept a QFlags
(over either one of the two enumerations) directly.

Change-Id: I56af3a85982ecb66369e4a7105d07de0d6e0c40a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2021-05-02 03:01:08 +02:00
parent 7feeb7c34b
commit a3d7028a0e

View File

@ -74,12 +74,18 @@ public:
inline QUrlTwoFlags &operator&=(int mask) { i &= mask; return *this; }
inline QUrlTwoFlags &operator&=(uint mask) { i &= mask; return *this; }
inline QUrlTwoFlags &operator&=(QFlags<E1> mask) { i &= mask.toInt(); return *this; }
inline QUrlTwoFlags &operator&=(QFlags<E2> mask) { i &= mask.toInt(); return *this; }
inline QUrlTwoFlags &operator|=(QUrlTwoFlags f) { i |= f.i; return *this; }
inline QUrlTwoFlags &operator|=(E1 f) { i |= f; return *this; }
inline QUrlTwoFlags &operator|=(E2 f) { i |= f; return *this; }
inline QUrlTwoFlags &operator|=(QFlags<E1> mask) { i |= mask.toInt(); return *this; }
inline QUrlTwoFlags &operator|=(QFlags<E2> mask) { i |= mask.toInt(); return *this; }
inline QUrlTwoFlags &operator^=(QUrlTwoFlags f) { i ^= f.i; return *this; }
inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; }
inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; }
inline QUrlTwoFlags &operator^=(QFlags<E1> mask) { i ^= mask.toInt(); return *this; }
inline QUrlTwoFlags &operator^=(QFlags<E2> mask) { i ^= mask.toInt(); return *this; }
constexpr inline operator QFlags<E1>() const { return QFlag(i); }
constexpr inline operator QFlags<E2>() const { return QFlag(i); }