aboutsummaryrefslogtreecommitdiff
path: root/joinstate.h
diff options
context:
space:
mode:
Diffstat (limited to 'joinstate.h')
-rw-r--r--joinstate.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/joinstate.h b/joinstate.h
index 348ca8a6..d6c374d2 100644
--- a/joinstate.h
+++ b/joinstate.h
@@ -18,12 +18,24 @@
#pragma once
+#include <array>
+
namespace QMatrixClient
{
enum class JoinState
{
- Join,
+ Join = 0,
Invite,
Leave
};
-}
+
+ // We cannot use REGISTER_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)
+ {
+ return JoinStateStrings[size_t(js)];
+ }
+} // namespace QMatrixClient