diff options
Diffstat (limited to 'Sluift/ElementConvertors')
16 files changed, 22 insertions, 51 deletions
diff --git a/Sluift/ElementConvertors/CommandConvertor.cpp b/Sluift/ElementConvertors/CommandConvertor.cpp index 1e2f8e3..de7a439 100644 --- a/Sluift/ElementConvertors/CommandConvertor.cpp +++ b/Sluift/ElementConvertors/CommandConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/Lua/Check.h> #include <Sluift/Lua/Value.h> #include <Sluift/LuaElementConvertors.h> @@ -154,7 +152,7 @@ void CommandConvertor::doConvertToLua(lua_State* L, std::shared_ptr<Command> pay if (!payload->getNotes().empty()) { std::vector<Lua::Value> notes; - foreach (const Command::Note& note, payload->getNotes()) { + for (const auto& note : payload->getNotes()) { Lua::Table noteTable; if (!note.note.empty()) { noteTable["note"] = Lua::valueRef(note.note); @@ -179,7 +177,7 @@ void CommandConvertor::doConvertToLua(lua_State* L, std::shared_ptr<Command> pay if (!payload->getAvailableActions().empty()) { std::vector<Lua::Value> availableActions; - foreach (const Command::Action& action, payload->getAvailableActions()) { + for (const auto& action : payload->getAvailableActions()) { if (action != Command::NoAction) { availableActions.push_back(convertActionToString(action)); } diff --git a/Sluift/ElementConvertors/DOMElementConvertor.cpp b/Sluift/ElementConvertors/DOMElementConvertor.cpp index c03eb8c..b957686 100644 --- a/Sluift/ElementConvertors/DOMElementConvertor.cpp +++ b/Sluift/ElementConvertors/DOMElementConvertor.cpp @@ -10,7 +10,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> #include <Swiften/Elements/RawXMLPayload.h> #include <Swiften/Parser/Attribute.h> #include <Swiften/Parser/AttributeMap.h> @@ -48,7 +47,7 @@ namespace { if (!attributes.getEntries().empty()) { lua_newtable(L); int i = 1; - foreach(const AttributeMap::Entry& entry, attributes.getEntries()) { + for (const auto& entry : attributes.getEntries()) { lua_pushnumber(L, i); lua_newtable(L); lua_pushstring(L, entry.getAttribute().getName().c_str()); diff --git a/Sluift/ElementConvertors/FormConvertor.cpp b/Sluift/ElementConvertors/FormConvertor.cpp index 85f40a1..90fd9fe 100644 --- a/Sluift/ElementConvertors/FormConvertor.cpp +++ b/Sluift/ElementConvertors/FormConvertor.cpp @@ -14,8 +14,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/Lua/Check.h> #include <Sluift/Lua/Value.h> @@ -105,7 +103,7 @@ namespace { } if (!field->getOptions().empty()) { Lua::Array options; - foreach(const FormField::Option& option, field->getOptions()) { + for (const auto& option : field->getOptions()) { Lua::Table luaOption = boost::assign::map_list_of ("label", Lua::valueRef(option.label)) ("value", Lua::valueRef(option.value)); @@ -118,7 +116,7 @@ namespace { Lua::Array convertFieldListToLua(const std::vector< std::shared_ptr<FormField> >& fieldList) { Lua::Array fields; - foreach(std::shared_ptr<FormField> field, fieldList) { + for (auto&& field : fieldList) { fields.push_back(convertFieldToLua(field)); } return fields; @@ -245,7 +243,7 @@ namespace { lua_getfield(L, -1, "fields"); if (lua_istable(L, -1)) { - foreach (std::shared_ptr<FormField> formField, convertFieldListFromLua(L)) { + for (auto&& formField : convertFieldListFromLua(L)) { result->addField(formField); } } @@ -253,7 +251,7 @@ namespace { lua_getfield(L, -1, "reported_fields"); if (lua_istable(L, -1)) { - foreach (std::shared_ptr<FormField> formField, convertFieldListFromLua(L)) { + for (auto&& formField : convertFieldListFromLua(L)) { result->addReportedField(formField); } } @@ -294,7 +292,7 @@ namespace { if (!payload->getItems().empty()) { Lua::Array luaItems; - foreach(const Form::FormItem& item, payload->getItems()) { + for (const auto& item : payload->getItems()) { if (!item.empty()) { luaItems.push_back(convertFieldListToLua(item)); } @@ -322,7 +320,7 @@ namespace { form->clearReportedFields(); std::vector< std::shared_ptr<FormField> > fields(form->getFields()); form->clearFields(); - foreach (std::shared_ptr<FormField> field, fields) { + for (auto&& field : fields) { if (field->getType() == FormField::FixedType) { continue; } diff --git a/Sluift/ElementConvertors/ForwardedConvertor.cpp b/Sluift/ElementConvertors/ForwardedConvertor.cpp index 8474252..b353eea 100644 --- a/Sluift/ElementConvertors/ForwardedConvertor.cpp +++ b/Sluift/ElementConvertors/ForwardedConvertor.cpp @@ -12,7 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> #include <Swiften/Elements/Delay.h> #include <Swiften/Elements/IQ.h> #include <Swiften/Elements/Message.h> diff --git a/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp b/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp index 8eae795..c6ba09e 100644 --- a/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -60,7 +58,7 @@ void PubSubAffiliationsConvertor::doConvertToLua(lua_State* L, std::shared_ptr<P if (!payload->getAffiliations().empty()) { { int i = 0; - foreach(std::shared_ptr<PubSubAffiliation> item, payload->getAffiliations()) { + for (auto&& item : payload->getAffiliations()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp b/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp index e8ba5b5..ac86024 100644 --- a/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -77,7 +75,7 @@ void PubSubEventItemConvertor::doConvertToLua(lua_State* L, std::shared_ptr<PubS lua_createtable(L, boost::numeric_cast<int>(payload->getData().size()), 0); { int i = 0; - foreach(std::shared_ptr<Payload> item, payload->getData()) { + for (auto&& item : payload->getData()) { if (convertors->convertToLua(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp b/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp index c89c4a6..7a3cde1 100644 --- a/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -78,7 +76,7 @@ void PubSubEventItemsConvertor::doConvertToLua(lua_State* L, std::shared_ptr<Pub lua_createtable(L, boost::numeric_cast<int>(payload->getItems().size()), 0); { int i = 0; - foreach(std::shared_ptr<PubSubEventItem> item, payload->getItems()) { + for (auto&& item : payload->getItems()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; @@ -91,7 +89,7 @@ void PubSubEventItemsConvertor::doConvertToLua(lua_State* L, std::shared_ptr<Pub lua_createtable(L, boost::numeric_cast<int>(payload->getRetracts().size()), 0); { int i = 0; - foreach(std::shared_ptr<PubSubEventRetract> item, payload->getRetracts()) { + for (auto&& item : payload->getRetracts()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubItemConvertor.cpp b/Sluift/ElementConvertors/PubSubItemConvertor.cpp index 99802bf..27fd4a3 100644 --- a/Sluift/ElementConvertors/PubSubItemConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubItemConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -59,7 +57,7 @@ void PubSubItemConvertor::doConvertToLua(lua_State* L, std::shared_ptr<PubSubIte lua_createtable(L, boost::numeric_cast<int>(payload->getData().size()), 0); { int i = 0; - foreach(std::shared_ptr<Payload> item, payload->getData()) { + for (auto&& item : payload->getData()) { if (convertors->convertToLua(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubItemsConvertor.cpp b/Sluift/ElementConvertors/PubSubItemsConvertor.cpp index 8e1f08d..5fa1bd3 100644 --- a/Sluift/ElementConvertors/PubSubItemsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubItemsConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -68,7 +66,7 @@ void PubSubItemsConvertor::doConvertToLua(lua_State* L, std::shared_ptr<PubSubIt if (!payload->getItems().empty()) { { int i = 0; - foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) { + for (auto&& item : payload->getItems()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp b/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp index b66443f..ee8a8cb 100644 --- a/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -58,7 +56,7 @@ void PubSubOwnerAffiliationsConvertor::doConvertToLua(lua_State* L, std::shared_ if (!payload->getAffiliations().empty()) { { int i = 0; - foreach(std::shared_ptr<PubSubOwnerAffiliation> item, payload->getAffiliations()) { + for (auto&& item : payload->getAffiliations()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp b/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp index 50cfb9b..88085b5 100644 --- a/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -58,7 +56,7 @@ void PubSubOwnerSubscriptionsConvertor::doConvertToLua(lua_State* L, std::shared if (!payload->getSubscriptions().empty()) { { int i = 0; - foreach(std::shared_ptr<PubSubOwnerSubscription> item, payload->getSubscriptions()) { + for (auto&& item : payload->getSubscriptions()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubPublishConvertor.cpp b/Sluift/ElementConvertors/PubSubPublishConvertor.cpp index 38aca0a..63c97bc 100644 --- a/Sluift/ElementConvertors/PubSubPublishConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubPublishConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -61,7 +59,7 @@ void PubSubPublishConvertor::doConvertToLua(lua_State* L, std::shared_ptr<PubSub lua_createtable(L, boost::numeric_cast<int>(payload->getItems().size()), 0); { int i = 0; - foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) { + for (auto&& item : payload->getItems()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubRetractConvertor.cpp b/Sluift/ElementConvertors/PubSubRetractConvertor.cpp index 38e15a1..c070ad6 100644 --- a/Sluift/ElementConvertors/PubSubRetractConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubRetractConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -66,7 +64,7 @@ void PubSubRetractConvertor::doConvertToLua(lua_State* L, std::shared_ptr<PubSub lua_createtable(L, boost::numeric_cast<int>(payload->getItems().size()), 0); { int i = 0; - foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) { + for (auto&& item : payload->getItems()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp b/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp index 4cc5686..3712192 100644 --- a/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - #include <Sluift/LuaElementConvertors.h> using namespace Swift; @@ -60,7 +58,7 @@ void PubSubSubscriptionsConvertor::doConvertToLua(lua_State* L, std::shared_ptr< if (!payload->getSubscriptions().empty()) { { int i = 0; - foreach(std::shared_ptr<PubSubSubscription> item, payload->getSubscriptions()) { + for (auto&& item : payload->getSubscriptions()) { if (convertors->convertToLuaUntyped(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/SecurityLabelConvertor.cpp b/Sluift/ElementConvertors/SecurityLabelConvertor.cpp index 133b123..21d9a8f 100644 --- a/Sluift/ElementConvertors/SecurityLabelConvertor.cpp +++ b/Sluift/ElementConvertors/SecurityLabelConvertor.cpp @@ -12,8 +12,6 @@ #include <lua.hpp> -#include <Swiften/Base/foreach.h> - using namespace Swift; SecurityLabelConvertor::SecurityLabelConvertor() : @@ -69,7 +67,7 @@ void SecurityLabelConvertor::doConvertToLua(lua_State* L, std::shared_ptr<Securi lua_createtable(L, boost::numeric_cast<int>(payload->getEquivalentLabels().size()), 0); { int i = 0; - foreach(const std::string& item, payload->getEquivalentLabels()) { + for (const auto& item : payload->getEquivalentLabels()) { lua_pushstring(L, item.c_str()); lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; diff --git a/Sluift/ElementConvertors/StanzaConvertor.h b/Sluift/ElementConvertors/StanzaConvertor.h index e1d0cb3..bdaaad3 100644 --- a/Sluift/ElementConvertors/StanzaConvertor.h +++ b/Sluift/ElementConvertors/StanzaConvertor.h @@ -8,7 +8,6 @@ #include <boost/numeric/conversion/cast.hpp> -#include <Swiften/Base/foreach.h> #include <Swiften/Elements/IQ.h> #include <Swiften/Elements/Message.h> #include <Swiften/Elements/Payload.h> @@ -75,7 +74,7 @@ namespace Swift { lua_createtable(L, boost::numeric_cast<int>(stanza->getPayloads().size()), 0); { int i = 0; - foreach(const std::shared_ptr<Payload> &item, stanza->getPayloads()) { + for (const auto& item : stanza->getPayloads()) { if (convertors->convertToLua(L, item) > 0) { lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); ++i; |