From aeae699f47c3f9a148903525943b6876c39a598d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Wed, 30 Oct 2013 20:48:58 +0100
Subject: Implement missing conversion of some PubSub attributes

Change-Id: I51a4249fa84aa40dc2a6e3f2c7e5a9c8fce93f32

diff --git a/Sluift/ElementConvertors/PubSubAffiliationConvertor.cpp b/Sluift/ElementConvertors/PubSubAffiliationConvertor.cpp
index 3d40be9..73d7d6a 100644
--- a/Sluift/ElementConvertors/PubSubAffiliationConvertor.cpp
+++ b/Sluift/ElementConvertors/PubSubAffiliationConvertor.cpp
@@ -32,6 +32,26 @@ boost::shared_ptr<PubSubAffiliation> PubSubAffiliationConvertor::doConvertFromLu
 	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "type");
+	if (lua_isstring(L, -1)) {
+		if (std::string(lua_tostring(L, -1)) == "none") {
+			result->setType(PubSubAffiliation::None);
+		}
+		if (std::string(lua_tostring(L, -1)) == "member") {
+			result->setType(PubSubAffiliation::Member);
+		}
+		if (std::string(lua_tostring(L, -1)) == "outcast") {
+			result->setType(PubSubAffiliation::Outcast);
+		}
+		if (std::string(lua_tostring(L, -1)) == "owner") {
+			result->setType(PubSubAffiliation::Owner);
+		}
+		if (std::string(lua_tostring(L, -1)) == "publisher") {
+			result->setType(PubSubAffiliation::Publisher);
+		}
+		if (std::string(lua_tostring(L, -1)) == "publish_only") {
+			result->setType(PubSubAffiliation::PublishOnly);
+		}
+	}
 	lua_pop(L, 1);
 	return result;
 }
diff --git a/Sluift/ElementConvertors/PubSubDefaultConvertor.cpp b/Sluift/ElementConvertors/PubSubDefaultConvertor.cpp
index 89609ed..d9b68ac 100644
--- a/Sluift/ElementConvertors/PubSubDefaultConvertor.cpp
+++ b/Sluift/ElementConvertors/PubSubDefaultConvertor.cpp
@@ -32,6 +32,17 @@ boost::shared_ptr<PubSubDefault> PubSubDefaultConvertor::doConvertFromLua(lua_St
 	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "type");
+	if (lua_isstring(L, -1)) {
+		if (std::string(lua_tostring(L, -1)) == "none") {
+			result->setType(PubSubDefault::None);
+		}
+		if (std::string(lua_tostring(L, -1)) == "collection") {
+			result->setType(PubSubDefault::Collection);
+		}
+		if (std::string(lua_tostring(L, -1)) == "leaf") {
+			result->setType(PubSubDefault::Leaf);
+		}
+	}
 	lua_pop(L, 1);
 	return result;
 }
diff --git a/Sluift/ElementConvertors/PubSubEventSubscriptionConvertor.cpp b/Sluift/ElementConvertors/PubSubEventSubscriptionConvertor.cpp
index 68cb34a..a4c160f 100644
--- a/Sluift/ElementConvertors/PubSubEventSubscriptionConvertor.cpp
+++ b/Sluift/ElementConvertors/PubSubEventSubscriptionConvertor.cpp
@@ -37,6 +37,20 @@ boost::shared_ptr<PubSubEventSubscription> PubSubEventSubscriptionConvertor::doC
 	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "subscription");
+	if (lua_isstring(L, -1)) {
+		if (std::string(lua_tostring(L, -1)) == "none") {
+			result->setSubscription(PubSubEventSubscription::None);
+		}
+		if (std::string(lua_tostring(L, -1)) == "pending") {
+			result->setSubscription(PubSubEventSubscription::Pending);
+		}
+		if (std::string(lua_tostring(L, -1)) == "subscribed") {
+			result->setSubscription(PubSubEventSubscription::Subscribed);
+		}
+		if (std::string(lua_tostring(L, -1)) == "unconfigured") {
+			result->setSubscription(PubSubEventSubscription::Unconfigured);
+		}
+	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "subscriptionid");
 	if (lua_isstring(L, -1)) {
diff --git a/Sluift/ElementConvertors/PubSubOwnerAffiliationConvertor.cpp b/Sluift/ElementConvertors/PubSubOwnerAffiliationConvertor.cpp
index d7edaf4..f1a7b50 100644
--- a/Sluift/ElementConvertors/PubSubOwnerAffiliationConvertor.cpp
+++ b/Sluift/ElementConvertors/PubSubOwnerAffiliationConvertor.cpp
@@ -32,6 +32,26 @@ boost::shared_ptr<PubSubOwnerAffiliation> PubSubOwnerAffiliationConvertor::doCon
 	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "type");
+	if (lua_isstring(L, -1)) {
+		if (std::string(lua_tostring(L, -1)) == "none") {
+			result->setType(PubSubOwnerAffiliation::None);
+		}
+		if (std::string(lua_tostring(L, -1)) == "member") {
+			result->setType(PubSubOwnerAffiliation::Member);
+		}
+		if (std::string(lua_tostring(L, -1)) == "outcast") {
+			result->setType(PubSubOwnerAffiliation::Outcast);
+		}
+		if (std::string(lua_tostring(L, -1)) == "owner") {
+			result->setType(PubSubOwnerAffiliation::Owner);
+		}
+		if (std::string(lua_tostring(L, -1)) == "publisher") {
+			result->setType(PubSubOwnerAffiliation::Publisher);
+		}
+		if (std::string(lua_tostring(L, -1)) == "publish_only") {
+			result->setType(PubSubOwnerAffiliation::PublishOnly);
+		}
+	}
 	lua_pop(L, 1);
 	return result;
 }
diff --git a/Sluift/ElementConvertors/PubSubOwnerSubscriptionConvertor.cpp b/Sluift/ElementConvertors/PubSubOwnerSubscriptionConvertor.cpp
index 0216874..dbba238 100644
--- a/Sluift/ElementConvertors/PubSubOwnerSubscriptionConvertor.cpp
+++ b/Sluift/ElementConvertors/PubSubOwnerSubscriptionConvertor.cpp
@@ -32,6 +32,20 @@ boost::shared_ptr<PubSubOwnerSubscription> PubSubOwnerSubscriptionConvertor::doC
 	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "subscription");
+	if (lua_isstring(L, -1)) {
+		if (std::string(lua_tostring(L, -1)) == "none") {
+			result->setSubscription(PubSubOwnerSubscription::None);
+		}
+		if (std::string(lua_tostring(L, -1)) == "pending") {
+			result->setSubscription(PubSubOwnerSubscription::Pending);
+		}
+		if (std::string(lua_tostring(L, -1)) == "subscribed") {
+			result->setSubscription(PubSubOwnerSubscription::Subscribed);
+		}
+		if (std::string(lua_tostring(L, -1)) == "unconfigured") {
+			result->setSubscription(PubSubOwnerSubscription::Unconfigured);
+		}
+	}
 	lua_pop(L, 1);
 	return result;
 }
diff --git a/Sluift/ElementConvertors/PubSubSubscriptionConvertor.cpp b/Sluift/ElementConvertors/PubSubSubscriptionConvertor.cpp
index 9ec9fec..69cd85a 100644
--- a/Sluift/ElementConvertors/PubSubSubscriptionConvertor.cpp
+++ b/Sluift/ElementConvertors/PubSubSubscriptionConvertor.cpp
@@ -49,6 +49,20 @@ boost::shared_ptr<PubSubSubscription> PubSubSubscriptionConvertor::doConvertFrom
 	}
 	lua_pop(L, 1);
 	lua_getfield(L, -1, "subscription");
+	if (lua_isstring(L, -1)) {
+		if (std::string(lua_tostring(L, -1)) == "none") {
+			result->setSubscription(PubSubSubscription::None);
+		}
+		if (std::string(lua_tostring(L, -1)) == "pending") {
+			result->setSubscription(PubSubSubscription::Pending);
+		}
+		if (std::string(lua_tostring(L, -1)) == "subscribed") {
+			result->setSubscription(PubSubSubscription::Subscribed);
+		}
+		if (std::string(lua_tostring(L, -1)) == "unconfigured") {
+			result->setSubscription(PubSubSubscription::Unconfigured);
+		}
+	}
 	lua_pop(L, 1);
 	return result;
 }
-- 
cgit v0.10.2-6-g49f6