summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-05-03 15:23:06 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-05-04 17:11:04 +0300
commit8825e072f2dbb865a625a0b8b5c8a96646762ac2 (patch)
tree25c08f299885d5041474ae6614e94e339fddeae5
parentAdd StateEvent (diff)
downloadnheko-8825e072f2dbb865a625a0b8b5c8a96646762ac2.tar.xz
Add matrix::events namespace
-rw-r--r--include/events/AliasesEventContent.h6
-rw-r--r--include/events/AvatarEventContent.h6
-rw-r--r--include/events/CanonicalAliasEventContent.h6
-rw-r--r--include/events/CreateEventContent.h6
-rw-r--r--include/events/Event.h6
-rw-r--r--include/events/HistoryVisibilityEventContent.h6
-rw-r--r--include/events/JoinRulesEventContent.h6
-rw-r--r--include/events/MemberEventContent.h6
-rw-r--r--include/events/NameEventContent.h6
-rw-r--r--include/events/PowerLevelsEventContent.h6
-rw-r--r--include/events/RoomEvent.h6
-rw-r--r--include/events/StateEvent.h6
-rw-r--r--include/events/TopicEventContent.h6
-rw-r--r--src/events/AliasesEventContent.cc2
-rw-r--r--src/events/AvatarEventContent.cc2
-rw-r--r--src/events/CanonicalAliasEventContent.cc2
-rw-r--r--src/events/CreateEventContent.cc2
-rw-r--r--src/events/Event.cc2
-rw-r--r--src/events/HistoryVisibilityEventContent.cc2
-rw-r--r--src/events/JoinRulesEventContent.cc2
-rw-r--r--src/events/MemberEventContent.cc2
-rw-r--r--src/events/NameEventContent.cc2
-rw-r--r--src/events/PowerLevelsEventContent.cc2
-rw-r--r--src/events/TopicEventContent.cc2
-rw-r--r--tests/events.cc2
25 files changed, 101 insertions, 1 deletions
diff --git a/include/events/AliasesEventContent.h b/include/events/AliasesEventContent.h
index 03218715..44224fd9 100644
--- a/include/events/AliasesEventContent.h
+++ b/include/events/AliasesEventContent.h
@@ -23,6 +23,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 class AliasesEventContent : public Deserializable
 {
 public:
@@ -38,5 +42,7 @@ inline QList<QString> AliasesEventContent::aliases() const
 {
 	return aliases_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // ALIASES_EVENT_CONTENT_H
diff --git a/include/events/AvatarEventContent.h b/include/events/AvatarEventContent.h
index c77cb6d6..adf85b1f 100644
--- a/include/events/AvatarEventContent.h
+++ b/include/events/AvatarEventContent.h
@@ -23,6 +23,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 /*
  * A picture that is associated with the room.
  */
@@ -42,5 +46,7 @@ inline QUrl AvatarEventContent::url() const
 {
 	return url_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // AVATAR_EVENT_CONTENT_H
diff --git a/include/events/CanonicalAliasEventContent.h b/include/events/CanonicalAliasEventContent.h
index 3c031b8e..bcaf514b 100644
--- a/include/events/CanonicalAliasEventContent.h
+++ b/include/events/CanonicalAliasEventContent.h
@@ -24,6 +24,10 @@
 #include "CanonicalAliasEventContent.h"
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 /*
  * This event is used to inform the room about which alias should be considered
  * the canonical one. This could be for display purposes or as suggestion to
@@ -45,5 +49,7 @@ inline QString CanonicalAliasEventContent::alias() const
 {
 	return alias_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // CANONICAL_ALIAS_EVENT_CONTENT_H
diff --git a/include/events/CreateEventContent.h b/include/events/CreateEventContent.h
index ed1a8ce7..d48b8769 100644
--- a/include/events/CreateEventContent.h
+++ b/include/events/CreateEventContent.h
@@ -22,6 +22,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 /*
  * This is the first event in a room and cannot be changed. It acts as the root of all other events.
  */
@@ -42,5 +46,7 @@ inline QString CreateEventContent::creator() const
 {
 	return creator_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // CREATE_EVENT_CONTENT_H
diff --git a/include/events/Event.h b/include/events/Event.h
index 25b340bb..2621eadb 100644
--- a/include/events/Event.h
+++ b/include/events/Event.h
@@ -22,6 +22,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 enum EventType {
 	/// m.room.aliases
 	RoomAliases,
@@ -85,5 +89,7 @@ void Event<Content>::deserialize(const QJsonValue &data)
 
 	content_.deserialize(object.value("content"));
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // MATRIX_EVENT_H
diff --git a/include/events/HistoryVisibilityEventContent.h b/include/events/HistoryVisibilityEventContent.h
index ac7316f4..84738480 100644
--- a/include/events/HistoryVisibilityEventContent.h
+++ b/include/events/HistoryVisibilityEventContent.h
@@ -22,6 +22,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 enum HistoryVisibility {
 	Invited,
 	Joined,
@@ -44,5 +48,7 @@ inline HistoryVisibility HistoryVisibilityEventContent::historyVisibility() cons
 {
 	return history_visibility_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // HISTORY_VISIBILITY_EVENT_CONTENT_H
diff --git a/include/events/JoinRulesEventContent.h b/include/events/JoinRulesEventContent.h
index 8b647fb4..ff03a26e 100644
--- a/include/events/JoinRulesEventContent.h
+++ b/include/events/JoinRulesEventContent.h
@@ -22,6 +22,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 enum JoinRule {
 	// A user who wishes to join the room must first receive
 	// an invite to the room from someone already inside of the room.
@@ -56,5 +60,7 @@ inline JoinRule JoinRulesEventContent::joinRule() const
 {
 	return join_rule_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // JOIN_RULES_EVENT_CONTENT_H
diff --git a/include/events/MemberEventContent.h b/include/events/MemberEventContent.h
index 046dda0f..39ff0db1 100644
--- a/include/events/MemberEventContent.h
+++ b/include/events/MemberEventContent.h
@@ -23,6 +23,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 enum Membership {
 	// The user is banned.
 	BanState,
@@ -73,5 +77,7 @@ inline Membership MemberEventContent::membershipState() const
 {
 	return membership_state_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // MEMBER_EVENT_CONTENT_H
diff --git a/include/events/NameEventContent.h b/include/events/NameEventContent.h
index d6f60e2d..970edab8 100644
--- a/include/events/NameEventContent.h
+++ b/include/events/NameEventContent.h
@@ -22,6 +22,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 /*
  * A human-friendly room name designed to be displayed to the end-user.
  */
@@ -41,5 +45,7 @@ inline QString NameEventContent::name() const
 {
 	return name_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // NAME_EVENT_CONTENT_H
diff --git a/include/events/PowerLevelsEventContent.h b/include/events/PowerLevelsEventContent.h
index c2a3f1fa..c51755d8 100644
--- a/include/events/PowerLevelsEventContent.h
+++ b/include/events/PowerLevelsEventContent.h
@@ -23,6 +23,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 enum PowerLevels {
 	User = 0,
 	Moderator = 50,
@@ -98,5 +102,7 @@ inline int PowerLevelsEventContent::usersDefaultLevel() const
 {
 	return users_default_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // POWER_LEVELS_EVENT_CONTENT_H
diff --git a/include/events/RoomEvent.h b/include/events/RoomEvent.h
index 7d9b99a3..d8fa6e0e 100644
--- a/include/events/RoomEvent.h
+++ b/include/events/RoomEvent.h
@@ -23,6 +23,10 @@
 
 #include "Event.h"
 
+namespace matrix
+{
+namespace events
+{
 template <class Content>
 class RoomEvent : public Event<Content>
 {
@@ -90,5 +94,7 @@ void RoomEvent<Content>::deserialize(const QJsonValue &data)
 	sender_ = object.value("sender").toString();
 	origin_server_ts_ = object.value("origin_server_ts").toDouble();
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // MATRIX_ROOM_EVENT_H
diff --git a/include/events/StateEvent.h b/include/events/StateEvent.h
index d82d53c4..35d5fa31 100644
--- a/include/events/StateEvent.h
+++ b/include/events/StateEvent.h
@@ -22,6 +22,10 @@
 
 #include "RoomEvent.h"
 
+namespace matrix
+{
+namespace events
+{
 template <class Content>
 class StateEvent : public RoomEvent<Content>
 {
@@ -63,5 +67,7 @@ void StateEvent<Content>::deserialize(const QJsonValue &data)
 	if (object.contains("prev_content"))
 		prev_content_.deserialize(object.value("prev_content"));
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // MATRIX_STATE_EVENT_H
diff --git a/include/events/TopicEventContent.h b/include/events/TopicEventContent.h
index fd12de98..e3062d0c 100644
--- a/include/events/TopicEventContent.h
+++ b/include/events/TopicEventContent.h
@@ -22,6 +22,10 @@
 
 #include "Deserializable.h"
 
+namespace matrix
+{
+namespace events
+{
 /*
  * A topic is a short message detailing what is currently being discussed in the room.
  */
@@ -41,5 +45,7 @@ inline QString TopicEventContent::topic() const
 {
 	return topic_;
 }
+}  // namespace events
+}  // namespace matrix
 
 #endif  // TOPIC_EVENT_CONTENT_H
diff --git a/src/events/AliasesEventContent.cc b/src/events/AliasesEventContent.cc
index ccc4f2c1..89754315 100644
--- a/src/events/AliasesEventContent.cc
+++ b/src/events/AliasesEventContent.cc
@@ -19,6 +19,8 @@
 
 #include "AliasesEventContent.h"
 
+using namespace matrix::events;
+
 void AliasesEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/AvatarEventContent.cc b/src/events/AvatarEventContent.cc
index 51a60a1e..2f88cac2 100644
--- a/src/events/AvatarEventContent.cc
+++ b/src/events/AvatarEventContent.cc
@@ -19,6 +19,8 @@
 
 #include "AvatarEventContent.h"
 
+using namespace matrix::events;
+
 void AvatarEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/CanonicalAliasEventContent.cc b/src/events/CanonicalAliasEventContent.cc
index 23a32016..89042722 100644
--- a/src/events/CanonicalAliasEventContent.cc
+++ b/src/events/CanonicalAliasEventContent.cc
@@ -17,6 +17,8 @@
 
 #include "CanonicalAliasEventContent.h"
 
+using namespace matrix::events;
+
 void CanonicalAliasEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/CreateEventContent.cc b/src/events/CreateEventContent.cc
index e44be13e..d43a4cc5 100644
--- a/src/events/CreateEventContent.cc
+++ b/src/events/CreateEventContent.cc
@@ -17,6 +17,8 @@
 
 #include "CreateEventContent.h"
 
+using namespace matrix::events;
+
 void CreateEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/Event.cc b/src/events/Event.cc
index f9596d18..9a8590e0 100644
--- a/src/events/Event.cc
+++ b/src/events/Event.cc
@@ -29,7 +29,7 @@
 #include "PowerLevelsEventContent.h"
 #include "TopicEventContent.h"
 
-EventType extractEventType(const QJsonObject &object)
+matrix::events::EventType matrix::events::extractEventType(const QJsonObject &object)
 {
 	if (!object.contains("type"))
 		throw DeserializationException("Missing event type");
diff --git a/src/events/HistoryVisibilityEventContent.cc b/src/events/HistoryVisibilityEventContent.cc
index b9eb7ffc..25630aa4 100644
--- a/src/events/HistoryVisibilityEventContent.cc
+++ b/src/events/HistoryVisibilityEventContent.cc
@@ -17,6 +17,8 @@
 
 #include "HistoryVisibilityEventContent.h"
 
+using namespace matrix::events;
+
 void HistoryVisibilityEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/JoinRulesEventContent.cc b/src/events/JoinRulesEventContent.cc
index ad30a1aa..913aa097 100644
--- a/src/events/JoinRulesEventContent.cc
+++ b/src/events/JoinRulesEventContent.cc
@@ -17,6 +17,8 @@
 
 #include "JoinRulesEventContent.h"
 
+using namespace matrix::events;
+
 void JoinRulesEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/MemberEventContent.cc b/src/events/MemberEventContent.cc
index e7814e30..4c405f01 100644
--- a/src/events/MemberEventContent.cc
+++ b/src/events/MemberEventContent.cc
@@ -19,6 +19,8 @@
 
 #include "MemberEventContent.h"
 
+using namespace matrix::events;
+
 void MemberEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/NameEventContent.cc b/src/events/NameEventContent.cc
index 09b655a7..bfb2f878 100644
--- a/src/events/NameEventContent.cc
+++ b/src/events/NameEventContent.cc
@@ -17,6 +17,8 @@
 
 #include "NameEventContent.h"
 
+using namespace matrix::events;
+
 void NameEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/PowerLevelsEventContent.cc b/src/events/PowerLevelsEventContent.cc
index a6e5846a..048b8e97 100644
--- a/src/events/PowerLevelsEventContent.cc
+++ b/src/events/PowerLevelsEventContent.cc
@@ -20,6 +20,8 @@
 #include "Deserializable.h"
 #include "PowerLevelsEventContent.h"
 
+using namespace matrix::events;
+
 void PowerLevelsEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/src/events/TopicEventContent.cc b/src/events/TopicEventContent.cc
index 1abda151..e8d99ee9 100644
--- a/src/events/TopicEventContent.cc
+++ b/src/events/TopicEventContent.cc
@@ -17,6 +17,8 @@
 
 #include "TopicEventContent.h"
 
+using namespace matrix::events;
+
 void TopicEventContent::deserialize(const QJsonValue &data)
 {
 	if (!data.isObject())
diff --git a/tests/events.cc b/tests/events.cc
index cb6abd88..c3f8f7b7 100644
--- a/tests/events.cc
+++ b/tests/events.cc
@@ -16,6 +16,8 @@
 #include "PowerLevelsEventContent.h"
 #include "TopicEventContent.h"
 
+using namespace matrix::events;
+
 TEST(BaseEvent, Deserialization)
 {
 	// NameEventContent