aboutsummaryrefslogtreecommitdiff
path: root/lib/quotient_common.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-19 12:45:50 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-19 12:45:50 +0100
commitd6cf6b32cdd2843c40fc696accd8a6456f1ea15c (patch)
tree8299df2f413749badf90a96f92e2866976acc6cb /lib/quotient_common.h
parent76b6238af16a1ccd284831ce42ec9e2cb1fba2c5 (diff)
downloadlibquotient-d6cf6b32cdd2843c40fc696accd8a6456f1ea15c.tar.gz
libquotient-d6cf6b32cdd2843c40fc696accd8a6456f1ea15c.zip
Make enum values logging more terse()
By default enum class values are logged along with the qualifier; this may or may not be desirable in a given setting. For JoinState(s) and Membership(Mask) operator<< was overloaded to implicitly suppress qualification; however, this is both overly sweeping and uses Qt's internal API for the backend. Instead, a new QDebug manipulator, terse(), is introduced, that does the same as those operator<< overloads but on a per-invocation basis. This makes it slightly more verbose to log enums but makes the QDebug reconfiguration explicit and doesn't require to produce new overloads every time a new enum ends up in logs. And it's built entirely on the published Qt API, reusing the QDebugManip framework that Quotient already has. Also: operator<<(QDebug, QDebugManip) has been moved out of the namespace to fix lookup issues when there's no prior `using namespace Quotient`.
Diffstat (limited to 'lib/quotient_common.h')
-rw-r--r--lib/quotient_common.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/lib/quotient_common.h b/lib/quotient_common.h
index 3d8ace67..969ebe90 100644
--- a/lib/quotient_common.h
+++ b/lib/quotient_common.h
@@ -118,9 +118,3 @@ constexpr inline auto RoomTypeStrings = make_array(
} // namespace Quotient
Q_DECLARE_OPERATORS_FOR_FLAGS(Quotient::MembershipMask)
Q_DECLARE_OPERATORS_FOR_FLAGS(Quotient::JoinStates)
-
-class QDebug;
-QDebug operator<<(QDebug dbg, Quotient::Membership m);
-QDebug operator<<(QDebug dbg, Quotient::MembershipMask m);
-QDebug operator<<(QDebug dbg, Quotient::JoinState js);
-QDebug operator<<(QDebug dbg, Quotient::JoinStates js);