Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qflags.h File Reference

(f080f161237e3310fca0955742218276069e4868)

#include <QtCore/qcompare_impl.h>
#include <QtCore/qtypeinfo.h>
#include <algorithm>
#include <initializer_list>
Include dependency graph for qflags.h:

Go to the source code of this file.

Classes

class  QFlag
class  QIncompatibleFlag
struct  QtPrivate::IsQFlags< T >
struct  QtPrivate::IsQFlags< QFlags< E > >
class  QtPrivate::QFlagsStorage< Enum >
struct  QtPrivate::QFlagsStorageHelper< Enum, Size >
struct  QtPrivate::QFlagsStorageHelper< Enum, sizeof(int)>
class  QFlags< Enum >

Namespaces

namespace  QtPrivate

Macros

#define Q_DECLARE_FLAGS(Flags, Enum)
#define QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
#define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS)
#define Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Flags, Enum)
#define Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(Ret, Flags, Enum)

Functions

 Q_DECLARE_TYPEINFO (QFlag, Q_PRIMITIVE_TYPE)
 Q_DECLARE_TYPEINFO (QIncompatibleFlag, Q_PRIMITIVE_TYPE)

Macro Definition Documentation

◆ Q_DECLARE_FLAGS

#define Q_DECLARE_FLAGS ( Flags,
Enum )
Value:
Flags

Definition at line 217 of file qflags.h.

◆ Q_DECLARE_MIXED_ENUM_OPERATOR

#define Q_DECLARE_MIXED_ENUM_OPERATOR ( op,
Ret,
LHS,
RHS )
Value:
static_assert(std::is_same_v<decltype(std::declval<LHS>() op std::declval<RHS>()), Ret>);

Definition at line 280 of file qflags.h.

◆ Q_DECLARE_MIXED_ENUM_OPERATORS

#define Q_DECLARE_MIXED_ENUM_OPERATORS ( Ret,
Flags,
Enum )
Value:
Q_DECLARE_MIXED_ENUM_OPERATOR(&, Ret, Flags, Enum) \
Q_DECLARE_MIXED_ENUM_OPERATOR(^, Ret, Flags, Enum) \
/* end */
#define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS)
Definition qflags.h:280

Definition at line 284 of file qflags.h.

◆ Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC

#define Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC ( Ret,
Flags,
Enum )
Value:
Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Enum, Flags) \
/* end */
#define Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Flags, Enum)
Definition qflags.h:284

Definition at line 290 of file qflags.h.

◆ Q_DECLARE_OPERATORS_FOR_FLAGS

#define Q_DECLARE_OPERATORS_FOR_FLAGS ( Flags)
Value:
[[maybe_unused]] \
constexpr inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \
{ return QFlags<Flags::enum_type>(f1) | f2; } \
[[maybe_unused]] \
constexpr inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
{ return f2 | f1; } \
[[maybe_unused]] \
constexpr inline QFlags<Flags::enum_type> operator&(Flags::enum_type f1, Flags::enum_type f2) noexcept \
{ return QFlags<Flags::enum_type>(f1) & f2; } \
[[maybe_unused]] \
constexpr inline QFlags<Flags::enum_type> operator&(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
{ return f2 & f1; } \
[[maybe_unused]] \
constexpr inline QFlags<Flags::enum_type> operator^(Flags::enum_type f1, Flags::enum_type f2) noexcept \
{ return QFlags<Flags::enum_type>(f1) ^ f2; } \
[[maybe_unused]] \
constexpr inline QFlags<Flags::enum_type> operator^(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
{ return f2 ^ f1; } \
constexpr inline void operator+(Flags::enum_type f1, Flags::enum_type f2) noexcept = delete; \
constexpr inline void operator+(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept = delete; \
constexpr inline void operator+(int f1, QFlags<Flags::enum_type> f2) noexcept = delete; \
constexpr inline void operator-(Flags::enum_type f1, Flags::enum_type f2) noexcept = delete; \
constexpr inline void operator-(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept = delete; \
constexpr inline void operator-(int f1, QFlags<Flags::enum_type> f2) noexcept = delete; \
constexpr inline void operator+(int f1, Flags::enum_type f2) noexcept = delete; \
constexpr inline void operator+(Flags::enum_type f1, int f2) noexcept = delete; \
constexpr inline void operator-(int f1, Flags::enum_type f2) noexcept = delete; \
constexpr inline void operator-(Flags::enum_type f1, int f2) noexcept = delete; \
QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags)
QBitArray operator^(const QBitArray &a1, const QBitArray &a2)
QBitArray operator&(const QBitArray &a1, const QBitArray &a2)
constexpr QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept
Definition qrect.h:467
QString operator+(const QString &s1, const QString &s2)
Definition qstring.h:1556
constexpr QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
Definition qurl.h:296

Definition at line 237 of file qflags.h.

◆ QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM

#define QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM ( Flags)
Value:
[[maybe_unused]] \
constexpr inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
{ return QIncompatibleFlag(int(f1) | f2); }

Definition at line 231 of file qflags.h.

Function Documentation

◆ Q_DECLARE_TYPEINFO() [1/2]

Q_DECLARE_TYPEINFO ( QFlag ,
Q_PRIMITIVE_TYPE  )

◆ Q_DECLARE_TYPEINFO() [2/2]

Q_DECLARE_TYPEINFO ( QIncompatibleFlag ,
Q_PRIMITIVE_TYPE  )