aboutsummaryrefslogtreecommitdiff
path: root/joinstate.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-19 08:12:50 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-19 08:14:56 +0900
commitecc364d4ad752b34e41b717e3deff4d17a840378 (patch)
treeca1077fb3a751ad01f6638ee5733ddd4583d005f /joinstate.h
parent8800690c691dc9534fdb0f2d902862f816704d50 (diff)
parentf2f85ba093df5dcd991fd206af4d79d57f4c7fc8 (diff)
downloadlibquotient-ecc364d4ad752b34e41b717e3deff4d17a840378.tar.gz
libquotient-ecc364d4ad752b34e41b717e3deff4d17a840378.zip
Merge branch 'master' into kitsune-gtad
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