aboutsummaryrefslogtreecommitdiff
path: root/lib/joinstate.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-16 20:03:06 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-07-18 20:09:43 +0200
commitc05b5c2b79f9ab301fee587ee781b9c8e18b8a2f (patch)
tree95de5d26893652593fdf0a583378c31795a0d432 /lib/joinstate.h
parent110190d48a80a471e6d10d048602390b35e7ed07 (diff)
downloadlibquotient-c05b5c2b79f9ab301fee587ee781b9c8e18b8a2f.tar.gz
libquotient-c05b5c2b79f9ab301fee587ee781b9c8e18b8a2f.zip
MembershipType -> Membership, also used for JoinState
Instead of being defined independently, JoinState now uses values from the Membership enumeration (former MemberEventContent::MembershipType) that was moved to quotient_common.h for that purpose. Both enumerations gained a Q_FLAG_NS decoration and operator<< overrides that strip "Quotient::" prefix when dumping member/join state values to the log - obviating toCString(JoinState) along the way. Quotient::MembershipType alias is deprecated from now.
Diffstat (limited to 'lib/joinstate.h')
-rw-r--r--lib/joinstate.h32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/joinstate.h b/lib/joinstate.h
deleted file mode 100644
index 805ce73a..00000000
--- a/lib/joinstate.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-FileCopyrightText: 2016 Kitsune Ral <Kitsune-Ral@users.sf.net>
-// SPDX-License-Identifier: LGPL-2.1-or-later
-
-#pragma once
-
-#include <QtCore/QFlags>
-
-#include <array>
-
-namespace Quotient {
-enum class JoinState : unsigned int {
- Join = 0x1,
- Invite = 0x2,
- Leave = 0x4,
-};
-
-Q_DECLARE_FLAGS(JoinStates, JoinState)
-
-// We cannot use Q_ENUM outside of a Q_OBJECT and besides, we want
-// to use strings that match respective JSON keys.
-static const std::array<const char*, 3> JoinStateStrings { { "join", "invite",
- "leave" } };
-
-inline const char* toCString(JoinState js)
-{
- size_t state = size_t(js), index = 0;
- while (state >>= 1u)
- ++index;
- return JoinStateStrings[index];
-}
-} // namespace Quotient
-Q_DECLARE_OPERATORS_FOR_FLAGS(Quotient::JoinStates)