QLatin1Char: add comparison operators with char
When QT_NO_CAST_FROM_ASCII is in effect, `char == QLatinChar` no longer compiles, because the QChar(char) ctor has become private. Fix by supplying the missing mixed-type operators. [ChangeLog][QtCore][QLatin1Char] Comparison against char now works even in QT_NO_CAST_FROM_ASCII builds. Change-Id: I86f5ec8e2ddfcda72f5928086cb298bd00b42544 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
deaf044b2e
commit
de752e8994
@ -58,6 +58,19 @@ private:
|
||||
char ch;
|
||||
};
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator==(char lhs, QLatin1Char rhs) noexcept { return lhs == rhs.toLatin1(); }
|
||||
Q_DECL_CONSTEXPR inline bool operator!=(char lhs, QLatin1Char rhs) noexcept { return lhs != rhs.toLatin1(); }
|
||||
Q_DECL_CONSTEXPR inline bool operator<=(char lhs, QLatin1Char rhs) noexcept { return lhs <= rhs.toLatin1(); }
|
||||
Q_DECL_CONSTEXPR inline bool operator>=(char lhs, QLatin1Char rhs) noexcept { return lhs >= rhs.toLatin1(); }
|
||||
Q_DECL_CONSTEXPR inline bool operator< (char lhs, QLatin1Char rhs) noexcept { return lhs < rhs.toLatin1(); }
|
||||
Q_DECL_CONSTEXPR inline bool operator> (char lhs, QLatin1Char rhs) noexcept { return lhs > rhs.toLatin1(); }
|
||||
|
||||
Q_DECL_CONSTEXPR inline bool operator==(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() == rhs; }
|
||||
Q_DECL_CONSTEXPR inline bool operator!=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() != rhs; }
|
||||
Q_DECL_CONSTEXPR inline bool operator<=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() <= rhs; }
|
||||
Q_DECL_CONSTEXPR inline bool operator>=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() >= rhs; }
|
||||
Q_DECL_CONSTEXPR inline bool operator< (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() < rhs; }
|
||||
Q_DECL_CONSTEXPR inline bool operator> (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() > rhs; }
|
||||
|
||||
class Q_CORE_EXPORT QChar {
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user