summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-11-23 07:09:39 (GMT)
committerTobias Markmann <tm@ayena.de>2016-11-23 11:30:02 (GMT)
commite405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch)
tree9118ef838ebfaec1df90ec24761944b5d833774c /Sluift/ElementConvertors/FormConvertor.cpp
parent8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff)
downloadswift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip
swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information: Build on macOS 10.12.1 and all tests pass. Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Sluift/ElementConvertors/FormConvertor.cpp')
-rw-r--r--Sluift/ElementConvertors/FormConvertor.cpp14
1 files changed, 6 insertions, 8 deletions
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;
}