summaryrefslogtreecommitdiff
path: root/slicer
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-01-03 03:38:19 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-01-03 03:38:19 +0000
commitfcb04f92517a35f8f7ffb8ebea1c11e003596ef6 (patch)
treea8f2b884f543d2e7e3f217bcd573006afdb26637 /slicer
parentRemoved the modulePath() hack in favoured of scoped() (diff)
downloadslicer-fcb04f92517a35f8f7ffb8ebea1c11e003596ef6.tar.bz2
slicer-fcb04f92517a35f8f7ffb8ebea1c11e003596ef6.tar.xz
slicer-fcb04f92517a35f8f7ffb8ebea1c11e003596ef6.zip
Use native for instead BOOST_FOREACH
Diffstat (limited to 'slicer')
-rw-r--r--slicer/json/serializer.cpp4
-rw-r--r--slicer/slicer/modelParts.h7
-rw-r--r--slicer/slicer/parser.cpp29
3 files changed, 19 insertions, 21 deletions
diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp
index bb6a357..31a8a2a 100644
--- a/slicer/json/serializer.cpp
+++ b/slicer/json/serializer.cpp
@@ -135,7 +135,7 @@ namespace Slicer {
}
}
modelPart->Create();
- BOOST_FOREACH(const auto & element, o) {
+ for (const auto & element : o) {
auto emp = modelPart->GetChild(element.first);
if (emp) {
emp->Create();
@@ -148,7 +148,7 @@ namespace Slicer {
void operator()(const json::Array & a) const
{
modelPart->Create();
- BOOST_FOREACH(const auto & element, a) {
+ for (const auto & element : a) {
auto emp = modelPart->GetChild(std::string());
if (emp) {
emp->Create();
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index bd3889b..4fb2856 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -9,7 +9,6 @@
#include <Slice/Parser.h>
#include <stdexcept>
#include <boost/function.hpp>
-#include <boost/foreach.hpp>
#include <boost/bimap.hpp>
#include <vector>
@@ -289,7 +288,7 @@ namespace Slicer {
virtual void OnEachChild(const ChildHandler & ch)
{
- BOOST_FOREACH (const auto & h, hooks) {
+ for (const auto & h : hooks) {
auto modelPart = h->Get(GetModel());
ch(h->PartName(), modelPart && modelPart->HasValue() ? modelPart : ModelPartPtr());
}
@@ -447,7 +446,7 @@ namespace Slicer {
virtual void OnEachChild(const ChildHandler & ch) override
{
- BOOST_FOREACH(auto & element, sequence) {
+ for(auto & element : sequence) {
ch(elementName, elementModelPart(element));
}
}
@@ -523,7 +522,7 @@ namespace Slicer {
virtual void OnEachChild(const ChildHandler & ch) override
{
- BOOST_FOREACH(auto & pair, dictionary) {
+ for (auto & pair : dictionary) {
ch(pairName, new ModelPartForDictionaryElement<T>(const_cast<typename T::key_type *>(&pair.first), &pair.second));
}
}
diff --git a/slicer/slicer/parser.cpp b/slicer/slicer/parser.cpp
index 1375328..9c72d09 100644
--- a/slicer/slicer/parser.cpp
+++ b/slicer/slicer/parser.cpp
@@ -1,7 +1,6 @@
#include "parser.h"
#include <Slice/Parser.h>
#include <Slice/Preprocessor.h>
-#include <boost/foreach.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
@@ -32,7 +31,7 @@ namespace Slicer {
auto type = dm->type();
auto c = Slice::ContainedPtr::dynamicCast(dm->container());
auto conversions = getConversions(dm);
- BOOST_FOREACH(const auto & conversion, conversions) {
+ for (const auto & conversion : conversions) {
fprintf(cpp, "%s %s(const %s &);\n",
conversion.ExchangeType.c_str(),
conversion.ConvertToExchangeFunc.c_str(),
@@ -50,7 +49,7 @@ namespace Slicer {
dm->scoped().c_str());
fprintf(cpp, "{\n");
- BOOST_FOREACH(const auto & conversion, conversions) {
+ for (const auto & conversion : conversions) {
fprintf(cpp, "\tif (auto vspt = dynamic_cast<TValueSource< %s > *>(vsp.get())) {\n",
conversion.ExchangeType.c_str());
fprintf(cpp, "\t\t%s tmp;\n",
@@ -70,7 +69,7 @@ namespace Slicer {
dm->scoped().c_str());
fprintf(cpp, "{\n");
- BOOST_FOREACH(const auto & conversion, conversions) {
+ for (const auto & conversion : conversions) {
fprintf(cpp, "\tif (auto vtpt = dynamic_cast<TValueTarget< %s > *>(vtp.get())) {\n",
conversion.ExchangeType.c_str());
fprintf(cpp, "\t\tvtpt->get(%s(Member));\n",
@@ -112,13 +111,13 @@ namespace Slicer {
if (!cpp) return true;
fprintf(cpp, "// Begin module %s\n\n", m->name().c_str());
- BOOST_FOREACH(const auto & c, m->structs()) {
- BOOST_FOREACH(const auto & dm, c->dataMembers()) {
+ for (const auto & c : m->structs()) {
+ for (const auto & dm : c->dataMembers()) {
defineConversions(dm);
}
}
- BOOST_FOREACH(const auto & c, m->classes()) {
- BOOST_FOREACH(const auto & dm, c->dataMembers()) {
+ for (const auto & c : m->classes()) {
+ for (const auto & dm : c->dataMembers()) {
defineConversions(dm);
}
}
@@ -218,7 +217,7 @@ namespace Slicer {
it->scoped().c_str());
fprintf(cpp, "ModelPartForComplex< %s >::hooks {\n",
it->scoped().c_str());
- BOOST_FOREACH (const auto & dm, dataMembers) {
+ for (const auto & dm : dataMembers) {
auto c = Slice::ContainedPtr::dynamicCast(dm->container());
auto t = Slice::TypePtr::dynamicCast(dm->container());
if (!t) {
@@ -257,7 +256,7 @@ namespace Slicer {
}
fprintf(cpp, "\t};\n\n");
- BOOST_FOREACH (const auto & dm, dataMembers) {
+ for (const auto & dm : dataMembers) {
auto c = Slice::ContainedPtr::dynamicCast(dm->container());
auto t = Slice::TypePtr::dynamicCast(dm->container());
if (!t) {
@@ -421,7 +420,7 @@ namespace Slicer {
Slicer::copyMetadata(const std::list<std::string> & metadata) const
{
fprintf(cpp, "{\n");
- BOOST_FOREACH (const auto & md, metadata) {
+ for (const auto & md : metadata) {
if (boost::algorithm::starts_with(md, "slicer:")) {
fprintf(cpp, "\t\"%.*s\",\n", (int)md.length() - 7, md.c_str() + 7);
}
@@ -432,7 +431,7 @@ namespace Slicer {
boost::optional<std::string>
Slicer::metaDataValue(const std::string & prefix, const std::list<std::string> & metadata)
{
- BOOST_FOREACH (const auto & md, metadata) {
+ for (const auto & md : metadata) {
if (boost::algorithm::starts_with(md, prefix)) {
return md.substr(prefix.length());
}
@@ -444,7 +443,7 @@ namespace Slicer {
Slicer::metaDataValues(const std::string & prefix, const std::list<std::string> & metadata)
{
std::list<std::string> mds;
- BOOST_FOREACH (const auto & md, metadata) {
+ for (const auto & md : metadata) {
if (boost::algorithm::starts_with(md, prefix)) {
mds.push_back(md.substr(prefix.length()));
}
@@ -465,12 +464,12 @@ namespace Slicer {
{
std::vector<ConversionSpec> rtn;
auto conversions = metaDataValues("slicer:conversion:", dm->getMetaData());
- BOOST_FOREACH(const auto & conversion, conversions) {
+ for (const auto & conversion : conversions) {
auto split = metaDataSplit(conversion);
if (split.size() != 3) {
throw std::runtime_error("conversion needs 3 parts type:toModelFunc:toExchangeFunc");
}
- BOOST_FOREACH(auto & p, split) {
+ for (auto & p : split) {
boost::algorithm::replace_all(p, ".", "::");
}
rtn.push_back(ConversionSpec({split[0], split[1], split[2]}));