![]() |
libQuotient
A Qt library for building matrix clients
|
#include "quotient_export.h"
#include "util.h"
#include <qobjectdefs.h>
#include <array>
#include <span>
Go to the source code of this file.
Classes | |
struct | Quotient::MetaEnum< EnumT > |
Enabling structure for conversion between a given enum and JSON. More... | |
struct | Quotient::MetaEnum< JoinState > |
Local user join-state names. More... | |
Namespaces | |
namespace | Quotient |
Concepts | |
concept | Quotient::Serializable_Enum |
concept | Quotient::Serializable_Flag |
Macros | |
#define | QUO_DECLARE_FLAGS(Flags, Enum) |
Quotient replacement for the Q_FLAG/Q_DECLARE_FLAGS combination. | |
#define | QUO_DECLARE_FLAGS_NS(Flags, Enum) |
Quotient replacement for the Q_FLAG_NS/Q_DECLARE_FLAGS combination. | |
#define | QUO_META_ENUM_IMPL(EnumType_, IsFlag_, DefaultValue_, ...) |
#define | QUO_META_ENUM(EnumType_, DefaultValue_, ...) QUO_META_ENUM_IMPL(EnumType_, false, DefaultValue_, __VA_ARGS__) |
#define | QUO_META_FLAG(EnumType_, DefaultValue_, ...) QUO_META_ENUM_IMPL(EnumType_, true, DefaultValue_, __VA_ARGS__) |
Variables | |
constexpr const auto & | Quotient::JoinStateStrings = MetaEnum<JoinState>::strings |
constexpr auto | Quotient::MegolmV1AesSha2AlgoKey = "m.megolm.v1.aes-sha2"_L1 |
#define QUO_DECLARE_FLAGS | ( | Flags, | |
Enum | |||
) |
Quotient replacement for the Q_FLAG/Q_DECLARE_FLAGS combination.
Although the comment in QTBUG-82295 says that Q_FLAG[NS] "should" be applied to the enum type only, Qt then doesn't allow to wrap the corresponding flag type (defined with Q_DECLARE_FLAGS) into a QVariant. This macro defines Q_FLAG and on top of that adds Q_ENUM_IMPL which is a part of Q_ENUM() macro that enables the metatype data but goes under the moc radar to avoid double registration of the same data in the map defined in moc*.cpp.
Simply put, instead of using Q_FLAG/Q_DECLARE_FLAGS combo (and struggling to figure out what you should pass to Q_FLAG if you want to make it wrappable in a QVariant) use the macro below, and things will just work.
Definition at line 29 of file quotient_common.h.
#define QUO_DECLARE_FLAGS_NS | ( | Flags, | |
Enum | |||
) |
Quotient replacement for the Q_FLAG_NS/Q_DECLARE_FLAGS combination.
This is the equivalent of QUO_DECLARE_FLAGS for enums declared at the namespace level (be sure to provide Q_NAMESPACE in the same file as the enum definition and this macro).
Definition at line 40 of file quotient_common.h.
#define QUO_META_ENUM | ( | EnumType_, | |
DefaultValue_, | |||
... | |||
) | QUO_META_ENUM_IMPL(EnumType_, false, DefaultValue_, __VA_ARGS__) |
Definition at line 112 of file quotient_common.h.
#define QUO_META_ENUM_IMPL | ( | EnumType_, | |
IsFlag_, | |||
DefaultValue_, | |||
... | |||
) |
Definition at line 103 of file quotient_common.h.
#define QUO_META_FLAG | ( | EnumType_, | |
DefaultValue_, | |||
... | |||
) | QUO_META_ENUM_IMPL(EnumType_, true, DefaultValue_, __VA_ARGS__) |
Definition at line 115 of file quotient_common.h.