diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-03 21:44:24 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-04 15:52:04 +0000 |
commit | 575947589fecadef5ff5b5414c8d521d7f87fda3 (patch) | |
tree | cd4e6a3fa8d0b21353d7c6a4ebfee1e231208801 | |
parent | A single ycm config that gets its args from b2 (diff) | |
download | project2-575947589fecadef5ff5b5414c8d521d7f87fda3.tar.bz2 project2-575947589fecadef5ff5b5414c8d521d7f87fda3.tar.xz project2-575947589fecadef5ff5b5414c8d521d7f87fda3.zip |
Use native for instead BOOST_FOREACH
60 files changed, 116 insertions, 175 deletions
diff --git a/project2/basics/aggregates/distinct.cpp b/project2/basics/aggregates/distinct.cpp index 6039588..33d71b0 100644 --- a/project2/basics/aggregates/distinct.cpp +++ b/project2/basics/aggregates/distinct.cpp @@ -1,5 +1,4 @@ #include <aggregate.h> -#include <boost/foreach.hpp> class Distinct : public SetAggregate { public: @@ -17,7 +16,7 @@ class Distinct : public SetAggregate { } void onResultValues(const SetAggregate::UseAgg & u) const { - BOOST_FOREACH(const VariableType & v, result) { + for (const VariableType & v : result) { u(v); } } diff --git a/project2/basics/caches/memoryCache.cpp b/project2/basics/caches/memoryCache.cpp index a69ca16..16bdfa8 100644 --- a/project2/basics/caches/memoryCache.cpp +++ b/project2/basics/caches/memoryCache.cpp @@ -1,7 +1,6 @@ #include <pch.hpp> #include "logger.h" #include "rowSetCache.h" -#include <boost/foreach.hpp> #include "options.h" #include "rowSet.h" #include "presenter.h" @@ -44,7 +43,7 @@ class MemoryCache : public RowSetCache { } void execute(const Glib::ustring&, const RowProcessorCallback & rp, ExecContext *) const { - BOOST_FOREACH(const DataCache::value_type & mcr, dataCache) { + for (const DataCache::value_type & mcr : dataCache) { mcr->process(rp, false); } } diff --git a/project2/basics/options/preload.cpp b/project2/basics/options/preload.cpp index b3c126e..f871e57 100644 --- a/project2/basics/options/preload.cpp +++ b/project2/basics/options/preload.cpp @@ -33,7 +33,7 @@ class Preload { libs[librarypath.as<std::string>()] = boost::shared_ptr<void>(handle, &dlclose); const auto afterOpts = InstanceSet<Options>::GetAll(); - BOOST_FOREACH(const auto & opt, afterOpts) { + for (const auto & opt : afterOpts) { if (std::find(beforeOpts.begin(), beforeOpts.end(), opt) == beforeOpts.end()) { opt->reset(); } diff --git a/project2/basics/options/showHelp.cpp b/project2/basics/options/showHelp.cpp index acdede6..86dbc6f 100644 --- a/project2/basics/options/showHelp.cpp +++ b/project2/basics/options/showHelp.cpp @@ -1,7 +1,6 @@ #include "showHelp.h" #include <options.h> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <options/flagSet.h> void ShowHelpComponent::onConfigLoad() @@ -16,7 +15,7 @@ void ShowHelpComponent::onConfigLoad() void ShowHelpComponent::outputOptions(const Options * options) const { fprintf(stdout, " * %s\n", options->name.c_str()); - BOOST_FOREACH(const auto & option, options->allOptions()) { + for (const auto & option : options->allOptions()) { fprintf(stdout, " * %s - %s\n", option->name().c_str(), option->description().c_str()); } } diff --git a/project2/basics/pch.hpp b/project2/basics/pch.hpp index 0421cfb..67ec9b4 100644 --- a/project2/basics/pch.hpp +++ b/project2/basics/pch.hpp @@ -8,7 +8,6 @@ #include <boost/bind.hpp> #include <boost/date_time.hpp> #include <boost/filesystem/operations.hpp> -#include <boost/foreach.hpp> #include <commonObjects.h> #include <iHaveParameters.h> #include <iostream> diff --git a/project2/basics/tasks/session/sessionClearTask.cpp b/project2/basics/tasks/session/sessionClearTask.cpp index 265bb1c..8a21791 100644 --- a/project2/basics/tasks/session/sessionClearTask.cpp +++ b/project2/basics/tasks/session/sessionClearTask.cpp @@ -1,5 +1,4 @@ #include <pch.hpp> -#include <boost/foreach.hpp> #include "scriptLoader.h" #include "sessionClearTask.h" #include "session.h" diff --git a/project2/basics/tasks/session/sessionSetTask.cpp b/project2/basics/tasks/session/sessionSetTask.cpp index f46571b..120dd06 100644 --- a/project2/basics/tasks/session/sessionSetTask.cpp +++ b/project2/basics/tasks/session/sessionSetTask.cpp @@ -1,5 +1,4 @@ #include <pch.hpp> -#include <boost/foreach.hpp> #include "scriptLoader.h" #include "sessionSetTask.h" #include "session.h" diff --git a/project2/basics/tasks/structExceptHandling.cpp b/project2/basics/tasks/structExceptHandling.cpp index 917f030..b79dae6 100644 --- a/project2/basics/tasks/structExceptHandling.cpp +++ b/project2/basics/tasks/structExceptHandling.cpp @@ -3,7 +3,6 @@ #include "scriptLoader.h" #include "scriptStorage.h" #include "scripts.h" -#include <boost/foreach.hpp> DECLARE_LOADER("handler", StructuredExceptionHandler); diff --git a/project2/basics/tests/compoundTest.cpp b/project2/basics/tests/compoundTest.cpp index 119026e..3799d06 100644 --- a/project2/basics/tests/compoundTest.cpp +++ b/project2/basics/tests/compoundTest.cpp @@ -1,7 +1,6 @@ #include <pch.hpp> #include "compoundTest.h" #include <scriptLoader.h> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <algorithm> diff --git a/project2/basics/tests/isdistinct.cpp b/project2/basics/tests/isdistinct.cpp index 303f88d..47ed647 100644 --- a/project2/basics/tests/isdistinct.cpp +++ b/project2/basics/tests/isdistinct.cpp @@ -2,7 +2,6 @@ #include <test.h> #include <scriptLoader.h> #include <iHaveParameters.h> -#include <boost/foreach.hpp> #include <rowProcessor.h> class IsDistinct : public Test, IHaveParameters { @@ -14,7 +13,7 @@ class IsDistinct : public Test, IHaveParameters { scope(s, "scope") { } - + void loadComplete(const CommonObjects *) { findComponent(scope(NULL))->registerFor(RowProcessor::Complete, boost::bind(&IsDistinct::reset, this)); @@ -22,12 +21,12 @@ class IsDistinct : public Test, IHaveParameters { bool passes(ExecContext * ec) const { Vars row; - BOOST_FOREACH(const Parameters::value_type & p, parameters) { + for (const Parameters::value_type & p : parameters) { row.push_back(p.second(ec)); } return previous.insert(row).second; } - + void reset() const { previous.clear(); } diff --git a/project2/basics/tests/isuniq.cpp b/project2/basics/tests/isuniq.cpp index e33aba8..dc71ac5 100644 --- a/project2/basics/tests/isuniq.cpp +++ b/project2/basics/tests/isuniq.cpp @@ -2,7 +2,6 @@ #include <test.h> #include <scriptLoader.h> #include <iHaveParameters.h> -#include <boost/foreach.hpp> #include <rowProcessor.h> class IsUniq : public Test, IHaveParameters { @@ -23,20 +22,20 @@ class IsUniq : public Test, IHaveParameters { bool passes(ExecContext * ec) const { if (previous.size() > 0) { Vars row; - BOOST_FOREACH(const Parameters::value_type & p, parameters) { + for (const Parameters::value_type & p : parameters) { row.push_back(p.second(ec)); } std::swap(row, previous); return row != previous; } else { - BOOST_FOREACH(const Parameters::value_type & p, parameters) { + for (const Parameters::value_type & p : parameters) { previous.push_back(p.second(ec)); } return true; } } - + void reset() const { previous.clear(); } diff --git a/project2/basics/views/autotree.cpp b/project2/basics/views/autotree.cpp index bef9695..2f5bb68 100644 --- a/project2/basics/views/autotree.cpp +++ b/project2/basics/views/autotree.cpp @@ -4,7 +4,6 @@ #include "scopeObject.h" #include "scriptLoader.h" #include "scopeObject.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> DECLARE_LOADER("autotree", AutoTree); @@ -51,10 +50,10 @@ AutoTreeNode::AutoTreeNode(ScriptNodePtr sn, unsigned int p, unsigned int d) : pos(p), depth(d) { - BOOST_FOREACH (const auto & n, sn->children("key")) { + for (const auto & n : sn->children("key")) { keys.insert({n->value("name", NULL).as<Glib::ustring>(), Variable::fromScriptNode(n)} ); } - BOOST_FOREACH (const auto & n, sn->children("include")) { + for (const auto & n : sn->children("include")) { includes.insert({n->value("name", NULL).as<Glib::ustring>(), Variable::fromScriptNode(n)} ); } if (sn->valueExists("tree")) { @@ -67,7 +66,7 @@ AutoTreeNode::rowReady(const RowState * rs, const MultiRowSetPresenter * p, Exec { std::vector<VariableType> values; values.reserve(keys.size()); - BOOST_FOREACH (const auto & v, keys) { + for (const auto & v : keys) { values.push_back(v.second(ec)); } bool isNew = false; @@ -87,11 +86,11 @@ AutoTreeNode::rowReady(const RowState * rs, const MultiRowSetPresenter * p, Exec state.values.resize(pos); openObject(p, ec, state); unsigned int k = 0; - BOOST_FOREACH (const auto & v, keys) { + for (const auto & v : keys) { state.values.push_back(values[k]); p->addNamedValue(v.first, values[k++]); } - BOOST_FOREACH (const auto & v, includes) { + for (const auto & v : includes) { p->addNamedValue(v.first, v.second(ec)); } if (tree) { diff --git a/project2/basics/views/flatView.cpp b/project2/basics/views/flatView.cpp index 05e8b09..af49d0d 100644 --- a/project2/basics/views/flatView.cpp +++ b/project2/basics/views/flatView.cpp @@ -4,7 +4,6 @@ #include "scopeObject.h" #include "scriptLoader.h" #include "scopeObject.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> DECLARE_LOADER("flatview", FlatView); @@ -15,7 +14,7 @@ FlatView::FlatView(ScriptNodePtr p) : recordName(p, "recordname"), required(p, "required", false) { - BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("columns")) { + for (ScriptNodePtr node : p->childrenIn("columns")) { viewColumns.insert(Columns::value_type(node->get_name(), Variable(node))); } } @@ -39,7 +38,7 @@ FlatView::rowReady(const RowState * rs, const RowSetPresenter * presenter, ExecC rs->foreachColumn(ec, boost::bind(&RowSetPresenter::addNamedValue, presenter, _2, _3)); } else { - BOOST_FOREACH(const Columns::value_type & col, viewColumns) { + for (const Columns::value_type & col : viewColumns) { presenter->addNamedValue(col.first, col.second(ec)); } } diff --git a/project2/basics/views/rowView.cpp b/project2/basics/views/rowView.cpp index 07917ff..9727480 100644 --- a/project2/basics/views/rowView.cpp +++ b/project2/basics/views/rowView.cpp @@ -4,7 +4,6 @@ #include "scopeObject.h" #include "scriptLoader.h" #include "scopeObject.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> DECLARE_LOADER("view", RowView); @@ -21,7 +20,7 @@ RowView::RowView(ScriptNodePtr p) : auto userColumns = p->child("columns", false); if (userColumns) { viewColumns = Columns(); - BOOST_FOREACH(ScriptNodePtr node, userColumns->children()) { + for (ScriptNodePtr node : userColumns->children()) { viewColumns->insert(Columns::value_type(node->get_name(), Variable(node))); } } @@ -51,7 +50,7 @@ RowView::rowReady(const RowState * rs, const MultiRowSetPresenter * presenter, E rs->foreachColumn(ec, boost::bind(&RowSetPresenter::addNamedValue, presenter, _2, _3)); } else { - BOOST_FOREACH(const Columns::value_type & col, *viewColumns) { + for (const Columns::value_type & col : *viewColumns) { presenter->addNamedValue(col.first, col.second(ec)); } } @@ -59,10 +58,10 @@ RowView::rowReady(const RowState * rs, const MultiRowSetPresenter * presenter, E executeChildren(presenter, ec); presenter->finishRow(); } - BOOST_FOREACH(SetAggregateCPtr s, setAggregates) { + for (SetAggregateCPtr s : setAggregates) { s->pushValue(ec); } - BOOST_FOREACH(ValueAggregateCPtr a, valueAggregates) { + for (ValueAggregateCPtr a : valueAggregates) { a->pushValue(ec); } } @@ -84,13 +83,13 @@ RowView::execute(const MultiRowSetPresenter * p, ExecContext * ec) const throw EmptyRequiredRows(name); } - BOOST_FOREACH(SetAggregateCPtr s, setAggregates) { + for (SetAggregateCPtr s : setAggregates) { p->addNewArray(s->name, false); ScopeObject pres(boost::bind(&MultiRowSetPresenter::finishArray, p, false)); s->onResultValues(boost::bind(&MultiRowSetPresenter::addNamedValue, p, "value", _1)); s->reset(); } - BOOST_FOREACH(ValueAggregateCPtr a, valueAggregates) { + for (ValueAggregateCPtr a : valueAggregates) { p->addNamedValue(a->name, a->resultValue()); a->reset(); } @@ -99,7 +98,7 @@ RowView::execute(const MultiRowSetPresenter * p, ExecContext * ec) const void RowView::executeChildren(const MultiRowSetPresenter * presenter, ExecContext * ec) const { - BOOST_FOREACH(const SubViews::value_type & sq, subViews) { + for (const SubViews::value_type & sq : subViews) { sq->execute(presenter, ec); } } diff --git a/project2/basics/views/singleton.cpp b/project2/basics/views/singleton.cpp index eff3f94..c67fb12 100644 --- a/project2/basics/views/singleton.cpp +++ b/project2/basics/views/singleton.cpp @@ -3,7 +3,6 @@ #include "iHaveParameters.h" #include "presenter.h" #include "scopeObject.h" -#include <boost/foreach.hpp> class Singleton : public View { public: @@ -12,7 +11,7 @@ class Singleton : public View { View(p), rootName(p, "rootname") { - BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("columns")) { + for (ScriptNodePtr node : p->childrenIn("columns")) { viewColumns.insert(Columns::value_type(node->get_name(), Variable(node))); } p->script->loader.addLoadTarget(p, Storer::into<ElementLoader>(&subViews)); @@ -21,7 +20,7 @@ class Singleton : public View { { p->addNewRowSet(rootName(ec)); ScopeObject pres(boost::bind(&MultiRowSetPresenter::finishRowSet, p)); - BOOST_FOREACH(const Columns::value_type & col, viewColumns) { + for (const Columns::value_type & col : viewColumns) { p->addNamedValue(col.first, col.second(ec)); } } @@ -30,7 +29,7 @@ class Singleton : public View { private: void executeChildren(const MultiRowSetPresenter * p, ExecContext * ec) const { - BOOST_FOREACH(const SubViews::value_type & sq, subViews) { + for (const SubViews::value_type & sq : subViews) { sq->execute(p, ec); } } diff --git a/project2/basics/views/viewGroup.cpp b/project2/basics/views/viewGroup.cpp index e6e84d0..0049e9d 100644 --- a/project2/basics/views/viewGroup.cpp +++ b/project2/basics/views/viewGroup.cpp @@ -1,5 +1,4 @@ #include "view.h" -#include <boost/foreach.hpp> #include "presenter.h" class ViewGroup : public View { @@ -14,7 +13,7 @@ class ViewGroup : public View { void execute(const MultiRowSetPresenter * presenter, ExecContext * ec) const { presenter->addNewRowSet(name); - BOOST_FOREACH(const SubViews::value_type & sq, subViews) { + for (const SubViews::value_type & sq : subViews) { sq->execute(presenter, ec); } presenter->finishRowSet(); diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp index 234cbeb..7de9218 100644 --- a/project2/cgi/cgiAppEngine.cpp +++ b/project2/cgi/cgiAppEngine.cpp @@ -8,7 +8,6 @@ #include "cgiRequestContext.h" #include "iterate.h" #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include "ostreamWrapper.h" #include "scopeObject.h" #include "logger.h" @@ -112,7 +111,7 @@ finalTransformSource(TransformSourcePtr ts) if (ts->getTargets().empty()) { return ts; } - BOOST_FOREACH(const Targets::value_type & t, ts->getTargets()) { + for (const Targets::value_type & t : ts->getTargets()) { if (TransformSource * tr = dynamic_cast<TransformSource *>(t.first.get())) { if (TransformSourcePtr f = finalTransformSource(tr)) { return f; @@ -190,11 +189,11 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const } } if (outputCachingActive) { - BOOST_FOREACH(const PresenterCachePtr & p, rs->caches) { + for (const PresenterCachePtr & p : rs->caches) { final->addTarget(p, crc, NULL); } ts->doTransforms(crc); - BOOST_FOREACH(const PresenterCachePtr & p, rs->caches) { + for (const PresenterCachePtr & p : rs->caches) { p->flushCache(); } if (rs->caches.front()->check(0, crc)) { @@ -249,7 +248,7 @@ CgiApplicationEngine::addEnvData(const MultiRowSetPresenter * p, OutputOptionsPt if (!o || o->Parameters(crc)) { // Parameters p->addNewRowSet("params", Scripts::scriptNamespacePrefix); - BOOST_FOREACH(cgicc::FormEntry fe, crc->cgi.getElements()) { + for (cgicc::FormEntry fe : crc->cgi.getElements()) { p->addNamedValue(fe.getName(), fe.getValue()); } p->finishRowSet(); diff --git a/project2/cgi/cgiContentNegotiate.cpp b/project2/cgi/cgiContentNegotiate.cpp index 0b6623e..2494ba8 100644 --- a/project2/cgi/cgiContentNegotiate.cpp +++ b/project2/cgi/cgiContentNegotiate.cpp @@ -2,7 +2,6 @@ #include "cgiAppEngine.h" #include <boost/tokenizer.hpp> #include <boost/bind.hpp> -#include <boost/foreach.hpp> class ContentNegotiateLoader : public PresenterLoader { public: @@ -10,10 +9,10 @@ class ContentNegotiateLoader : public PresenterLoader { { auto accept = static_cast<const CgiRequestContext *>(ec)->getAccept(); typedef boost::tokenizer<boost::char_separator<char>> tokenizer; - BOOST_FOREACH(auto mimetypeAndWeight, tokenizer(accept, boost::char_separator<char>(","))) { + for (auto mimetypeAndWeight : tokenizer(accept, boost::char_separator<char>(","))) { const auto mimetype = mimetypeAndWeight.substr(0, mimetypeAndWeight.find(';')); if (mimetype == "*/*") break; - BOOST_FOREACH(const auto & t, mappedTypes) { + for (const auto & t : mappedTypes) { if (t->Matches(mimetype)) { return PresenterLoader::getFor(t->present)->create(s, os, ec); } diff --git a/project2/cgi/cgiHttpHeader.cpp b/project2/cgi/cgiHttpHeader.cpp index 28dcec9..8b31c80 100644 --- a/project2/cgi/cgiHttpHeader.cpp +++ b/project2/cgi/cgiHttpHeader.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "cgiHttpHeader.h" -#include <boost/foreach.hpp> Project2HttpHeader::Project2HttpHeader(const std::string & s) : cgicc::HTTPHeader("") @@ -18,10 +17,10 @@ Project2HttpHeader::addHeader(const std::string & name, const Glib::ustring & va void Project2HttpHeader::render(std::ostream & out) const { - BOOST_FOREACH(const Headers::value_type & h, headers) { + for (const Headers::value_type & h : headers) { out << h.first << ": " << h.second.raw() << std::endl; } - BOOST_FOREACH(const cgicc::HTTPCookie & cookie, getCookies()) { + for (const cgicc::HTTPCookie & cookie : getCookies()) { out << cookie << std::endl; } out << std::endl; diff --git a/project2/cgi/cgiProgRouter.cpp b/project2/cgi/cgiProgRouter.cpp index 8fce50d..1d69151 100644 --- a/project2/cgi/cgiProgRouter.cpp +++ b/project2/cgi/cgiProgRouter.cpp @@ -1,5 +1,4 @@ #include <pch.hpp> -#include <boost/foreach.hpp> #include <boost/filesystem/path.hpp> #include <boost/algorithm/string/predicate.hpp> #include "cgiRequestContext.h" @@ -47,7 +46,7 @@ class RoutingTable { std::string routeScriptPath; const std::string & present(const std::string & path, VarMap & vars) const { - BOOST_FOREACH(const auto & route, routes) { + for (const auto & route : routes) { vars.clear(); if (route->matches(path, vars)) { return route->present; @@ -177,7 +176,7 @@ class ProgRouter : public Router { } p->finishArray(true); p->addNewArray("uriParam", true); - BOOST_FOREACH(const auto & v, vars) { + for (const auto & v : vars) { p->addNewRow("uriParam"); p->addNamedValue(v.first, v.second); p->finishRow(); @@ -210,7 +209,7 @@ class Routes : public RowSet { void execute(const Glib::ustring & filter, const RowProcessorCallback & rp, ExecContext *) const { RouteRowState rs; - BOOST_FOREACH(const auto & r, ProgRouterLoader::routingTable.routes) { + for (const auto & r : ProgRouterLoader::routingTable.routes) { if (boost::algorithm::starts_with(r->path, filter)) { rs.fields[0] = VariableType(r->present); rs.fields[1] = VariableType(r->path); diff --git a/project2/cgi/cgiRequestContext.cpp b/project2/cgi/cgiRequestContext.cpp index 2827aa7..636d2f6 100644 --- a/project2/cgi/cgiRequestContext.cpp +++ b/project2/cgi/cgiRequestContext.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/algorithm/string.hpp> #include "cgiRequestContext.h" #include "cgiAppEngine.h" @@ -44,7 +43,7 @@ CgiRequestContext::getSessionInternal() const std::string CgiRequestContext::getCookieValue(const std::string & name) const { - BOOST_FOREACH(const cgicc::HTTPCookie & c, cgi.getEnvironment().getCookieList()) { + for (const cgicc::HTTPCookie & c : cgi.getEnvironment().getCookieList()) { if (c.getName() == name) { return c.getValue(); } @@ -106,7 +105,7 @@ CgiRequestContext::getParamUriCount() const void CgiRequestContext::applyAllParameters(const boost::function<void (const std::string &, const std::string &)> & func) const { - BOOST_FOREACH(const auto & f, cgi.getElements()) { + for (const auto & f : cgi.getElements()) { func(f.getName(), f.getValue()); } } diff --git a/project2/cgi/cgiStageCacheHit.cpp b/project2/cgi/cgiStageCacheHit.cpp index d74c02f..3a6a665 100644 --- a/project2/cgi/cgiStageCacheHit.cpp +++ b/project2/cgi/cgiStageCacheHit.cpp @@ -2,7 +2,6 @@ #include "cgiAppEngine.h" #include "cgiRequestContext.h" #include "cgiHttpHeader.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> CgiApplicationEngine::CacheHitStage::CacheHitStage(ScriptNodePtr s, PresenterCachePtr pcp) : diff --git a/project2/cgi/cgiStagePresent.cpp b/project2/cgi/cgiStagePresent.cpp index f077111..a708bc0 100644 --- a/project2/cgi/cgiStagePresent.cpp +++ b/project2/cgi/cgiStagePresent.cpp @@ -3,7 +3,6 @@ #include "cgiRequestContext.h" #include "cgiHttpHeader.h" #include "safeMapFind.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> CgiApplicationEngine::PresentStage::PresentStage(ScriptReaderPtr s, CgiRequestContext * crc) : @@ -34,7 +33,7 @@ CgiApplicationEngine::PresentStage::run(CgiRequestContext * crc) PresenterCaches backFill; time_t reqMS = crc->getRequestModifiedSince(); CgiRequestContext::ETags etags = crc->getRequestETags(); - BOOST_FOREACH(const PresenterCachePtr & pc, caches) { + for (const PresenterCachePtr & pc : caches) { if (pc->check(root->script->modifiedTime(), crc)) { if (reqMS >= pc->getModifiedTime() && (etags.empty() || containerContains(etags, pc->getSHA1()))) { header = HttpHeaderPtr(new Project2HttpHeader("304 Not Modified")); diff --git a/project2/cgi/cgiStageRequest.cpp b/project2/cgi/cgiStageRequest.cpp index 78d933b..1cf03c9 100644 --- a/project2/cgi/cgiStageRequest.cpp +++ b/project2/cgi/cgiStageRequest.cpp @@ -3,7 +3,6 @@ #include "cgiRequestContext.h" #include "cgiHttpHeader.h" #include "scriptLoader.h" -#include <boost/foreach.hpp> CgiApplicationEngine::RequestStage::RequestStage(ScriptReaderPtr s) : SourceObject(s->root()), diff --git a/project2/cgi/pch.hpp b/project2/cgi/pch.hpp index 5f68b7c..065558b 100644 --- a/project2/cgi/pch.hpp +++ b/project2/cgi/pch.hpp @@ -6,7 +6,6 @@ #include "cgiHttpHeader.h" #include "scriptLoader.h" #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include "options.h" #include <cgicc/CgiEnvironment.h> #include <cgicc/Cgicc.h> diff --git a/project2/cgi/testCgi.cpp b/project2/cgi/testCgi.cpp index 0c2b472..196ecc3 100644 --- a/project2/cgi/testCgi.cpp +++ b/project2/cgi/testCgi.cpp @@ -1,6 +1,5 @@ #include <iostream> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <map> #include "options.h" #include "safeMapFind.h" @@ -67,7 +66,7 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput { const auto localUrls(urls); auto localRunCount(runCount); while (localRunCount-- > 0) { - BOOST_FOREACH(const auto & url, localUrls) { + for (const auto & url : localUrls) { int qm = url.find('?'); if (qm != -1) { optStore()["REDIRECT_URL"] = StrPtr(new std::string(url.substr(0, qm))); diff --git a/project2/cli/claOptions.cpp b/project2/cli/claOptions.cpp index da6121d..c5aa751 100644 --- a/project2/cli/claOptions.cpp +++ b/project2/cli/claOptions.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include <stdio.h> -#include <boost/foreach.hpp> #include "../common/optionsSource.h" #include "../common/exceptions.h" #include "claOptions.h" diff --git a/project2/console/consoleAppEngine.cpp b/project2/console/consoleAppEngine.cpp index d2d70c6..487c1f1 100644 --- a/project2/console/consoleAppEngine.cpp +++ b/project2/console/consoleAppEngine.cpp @@ -9,7 +9,6 @@ #include "taskHost.h" #include "scriptLoader.h" #include <options/showHelp.h> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/uuid/uuid_generators.hpp> #include <iostream> @@ -106,7 +105,7 @@ ConsoleApplicationEngine::getParameter(const VariableType & key) const void ConsoleApplicationEngine::process() { - BOOST_FOREACH(const auto & todo, todolist) { + for (const auto & todo : todolist) { Plugable::onAllComponents(boost::bind(&ComponentLoader::onBefore, _1)); Logger()->messagebf(LOG_DEBUG, "%s: Beginning script '%s/%s'", __FUNCTION__, todo.get<0>(), todo.get<1>()); diff --git a/project2/console/pch.hpp b/project2/console/pch.hpp index 4bd02fb..e79f446 100644 --- a/project2/console/pch.hpp +++ b/project2/console/pch.hpp @@ -9,7 +9,6 @@ #include "logger.h" #include "scriptLoader.h" #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include "options.h" #include <iostream> #include <string> diff --git a/project2/ice/iceDaemon.cpp b/project2/ice/iceDaemon.cpp index d09f85e..cd752b8 100644 --- a/project2/ice/iceDaemon.cpp +++ b/project2/ice/iceDaemon.cpp @@ -7,7 +7,6 @@ #include <scriptLoader.h> #include <options.h> #include <sys/stat.h> -#include <boost/foreach.hpp> #include <boost/filesystem.hpp> #include <boost/lexical_cast.hpp> #include <commonObjects.h> @@ -102,7 +101,7 @@ class IceDaemonViewHost : public virtual CommonObjects, public virtual CheckHost Logger()->messagebf(LOG_DEBUG, "%s: execute view", __PRETTY_FUNCTION__); view->execute(presenter.get(), ec); // Caches might open transactions - BOOST_FOREACH(const CommonObjects::DataSources::value_type & ds, CommonObjects::datasources) { + for (const CommonObjects::DataSources::value_type & ds : CommonObjects::datasources) { ds.second->commit(); } } diff --git a/project2/ice/pch.hpp b/project2/ice/pch.hpp index 21f44dc..3ed09f0 100644 --- a/project2/ice/pch.hpp +++ b/project2/ice/pch.hpp @@ -4,7 +4,6 @@ #include <Ice/Ice.h> #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/optional.hpp> #include <commonObjects.h> diff --git a/project2/ice/slice2Common.cpp b/project2/ice/slice2Common.cpp index 8068b03..9dfcf9f 100644 --- a/project2/ice/slice2Common.cpp +++ b/project2/ice/slice2Common.cpp @@ -1,6 +1,5 @@ #include "slice2Common.h" #include <Slice/CPlusPlusUtil.h> -#include <boost/foreach.hpp> Slice2Common::Slice2Common(FILE * c) : code(c), @@ -18,7 +17,7 @@ void Slice2Common::FunctionBegin(Slice::OperationPtr o) { // Create typed variables for call - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { if (p->optional()) { fprintf(code, "\t\t\t\t\t\tconst auto _%s = IceConvert< ::IceUtil::Optional< %s > >::FromVariable(%s(ec));\n", p->name().c_str(), @@ -36,12 +35,12 @@ Slice2Common::FunctionBegin(Slice::OperationPtr o) // Log call and parameters fprintf(code, "\t\t\t\t\t\tLogger()->messagebf(LOG_DEBUG, \"%%s: "); - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, "%s = %%s, ", p->name().c_str()); } fprintf(code, "ice @ %%p\", \n"); fprintf(code, "\t\t\t\t\t\t\t\t__PRETTY_FUNCTION__, "); - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, "%s(ec), ", p->name().c_str()); } fprintf(code, "ice);\n"); @@ -54,7 +53,7 @@ Slice2Common::FunctionBegin(Slice::OperationPtr o) void Slice2Common::ParameterVariables(Slice::OperationPtr o) { - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, "\t\t\t\t\tconst Variable %s;\n", p->name().c_str()); } } @@ -62,15 +61,15 @@ Slice2Common::ParameterVariables(Slice::OperationPtr o) void Slice2Common::Declaration(Slice::OperationPtr o) { - fprintf(code, "\t\t\tDECLARE_LOADER(\"%s-%s-%s\", %s);\n\n", - module.c_str(), interface.c_str(), o->name().c_str(), o->name().c_str()); + fprintf(code, "\t\t\tDECLARE_LOADER(\"%s-%s-%s\", %s);\n\n", + module.c_str(), interface.c_str(), o->name().c_str(), o->name().c_str()); } void Slice2Common::CallOperation(Slice::OperationPtr o) { fprintf(code, "service->%s(", o->name().c_str()); - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, "_%s, ", p->name().c_str()); } fprintf(code, "ctx)"); diff --git a/project2/ice/slice2Daemon.cpp b/project2/ice/slice2Daemon.cpp index 98a3883..177e406 100644 --- a/project2/ice/slice2Daemon.cpp +++ b/project2/ice/slice2Daemon.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "slice2Daemon.h" -#include <boost/foreach.hpp> #include <Slice/CPlusPlusUtil.h> Slice2Daemon::Slice2Daemon(FILE * c) : @@ -44,7 +43,7 @@ Slice2Daemon::visitOperation(const Slice::OperationPtr & o) else { fprintf(code, "\t\t\tvoid %s(", o->name().c_str()); } - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, "%s %s, ", inputTypeToString(p->type(), p->optional(), p->getMetaData(), 0).c_str(), p->name().c_str()); } fprintf(code, "const ::Ice::Current &) {\n"); @@ -86,7 +85,7 @@ Slice2Daemon::visitParameterMap(const Slice::OperationPtr & o) if (!code) return; fprintf(code, "\t\t\t\tParamMap params {\n"); - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { Slice::StructPtr s = dynamic_cast<Slice::Struct *>(p->type().get()); fprintf(code, "\t\t\t\t\t\t{\"%s\", IceConvert< %s >::ToVariable(%s) },\n", p->name().c_str(), Slice::typeToString(p->type()).c_str(), p->name().c_str()); diff --git a/project2/ice/slice2Rows.cpp b/project2/ice/slice2Rows.cpp index 2f1c6f2..1001f4c 100644 --- a/project2/ice/slice2Rows.cpp +++ b/project2/ice/slice2Rows.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "slice2Rows.h" -#include <boost/foreach.hpp> #include <Slice/CPlusPlusUtil.h> Slice2Rows::Slice2Rows(FILE * c) : @@ -46,7 +45,7 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o) // Constructor fprintf(code, "\t\t\t\t\t%s(ScriptNodePtr p) :\n", o->name().c_str()); fprintf(code, "\t\t\t\t\t\tIceRows< ::%s::%sPrx >(p)", module.c_str(), interface.c_str()); - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, ",\n\t\t\t\t\t\t%s(p, \"%s\")", p->name().c_str(), p->name().c_str()); } fprintf(code, "\n\t\t\t\t\t{\n"); diff --git a/project2/ice/slice2Task.cpp b/project2/ice/slice2Task.cpp index fa60bd0..84a4f29 100644 --- a/project2/ice/slice2Task.cpp +++ b/project2/ice/slice2Task.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "slice2Task.h" -#include <boost/foreach.hpp> #include <Slice/CPlusPlusUtil.h> Slice2Task::Slice2Task(FILE * c) : @@ -47,7 +46,7 @@ Slice2Task::visitOperation(const Slice::OperationPtr & o) fprintf(code, "\t\t\t\t\t%s(ScriptNodePtr p) :\n", o->name().c_str()); fprintf(code, "\t\t\t\t\t\tSourceObject(p),\n"); fprintf(code, "\t\t\t\t\t\tIceTask< ::%s::%sPrx >(p)", module.c_str(), interface.c_str()); - BOOST_FOREACH(const auto & p, o->parameters()) { + for (const auto & p : o->parameters()) { fprintf(code, ",\n\t\t\t\t\t\t%s(p, \"%s\")", p->name().c_str(), p->name().c_str()); } fprintf(code, "\n\t\t\t\t\t{\n"); diff --git a/project2/json/couchSession.cpp b/project2/json/couchSession.cpp index 60acefa..51d466c 100644 --- a/project2/json/couchSession.cpp +++ b/project2/json/couchSession.cpp @@ -8,7 +8,6 @@ #include <scriptLoader.h> #include <sessionContainer.h> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <boost/uuid/uuid_io.hpp> #include <boost/uuid/uuid_generators.hpp> @@ -28,7 +27,7 @@ class CouchSessionContainer : public SessionContainer { json::Object obj = getSessionFromServer(uuid); if (boost::get<json::Number>(*safeMapLookup<Session::VariableNotFound>(obj, ExpiryKey)) > time(NULL)) { SessionPtr s = new Session(uuid); - BOOST_FOREACH(const json::Object::value_type & v, obj) { + for (const json::Object::value_type & v : obj) { s->SetValue(v.first, boost::apply_visitor(JsonToProject2(), *v.second)); } return s; @@ -49,7 +48,7 @@ class CouchSessionContainer : public SessionContainer { Glib::ustring out = json::serializeObject(obj, "utf-8"); c->setopt(CURLOPT_INFILESIZE_LARGE, (curl_off_t)out.size()); unsigned int off = 0; - BOOST_FOREACH(const std::string & b, baseUrls) { + for (const std::string & b : baseUrls) { c->setopt(CURLOPT_URL, (b + boost::lexical_cast<std::string>(s->ID())).c_str()); try { c->performSend(boost::bind(send, &out, &off, _1, _2)); @@ -65,7 +64,7 @@ class CouchSessionContainer : public SessionContainer { CurlPtr c = new Curl(); c->setopt(CURLOPT_FAILONERROR, 1); Glib::ustring msg; - BOOST_FOREACH(const std::string & b, baseUrls) { + for (const std::string & b : baseUrls) { try { c->setopt(CURLOPT_URL, (b + boost::lexical_cast<std::string>(uuid)).c_str()); c->performRead(boost::bind(append, &msg, _1, _2)); @@ -131,7 +130,7 @@ class CustomCouchSessionLoader : public SessionContainerLoader::For<CouchSession CurlPtr c = new Curl(); c->setopt(CURLOPT_POST, 1); c->appendHeader("Content-Type: application/json"); - BOOST_FOREACH(const std::string & b, CouchSessionContainer::baseUrls) { + for (const std::string & b : CouchSessionContainer::baseUrls) { c->setopt(CURLOPT_URL, (b + "_compact").c_str()); c->performRead(boost::bind(discard, _2)); } @@ -151,13 +150,13 @@ class CustomCouchSessionLoader : public SessionContainerLoader::For<CouchSession c->setopt(CURLOPT_POST, 1); c->setopt(CURLOPT_POSTFIELDS, mapStr.c_str()); c->setopt(CURLOPT_POSTFIELDSIZE, mapStr.bytes()); - BOOST_FOREACH(const std::string & b, CouchSessionContainer::baseUrls) { + for (const std::string & b : CouchSessionContainer::baseUrls) { Glib::ustring msg; try { c->setopt(CURLOPT_URL, (b + "_temp_view").c_str()); c->performRead(boost::bind(CouchSessionContainer::append, &msg, _1, _2)); json::Object o = json::parseObject(msg); - BOOST_FOREACH(const json::Array::value_type & v, boost::get<json::Array>(*safeMapLookup<ParamNotFound>(o, "rows"))) { + for (const json::Array::value_type & v : boost::get<json::Array>(*safeMapLookup<ParamNotFound>(o, "rows"))) { json::Object rec = boost::get<json::Object>(*v); boost::uuids::uuid u = boost::uuids::string_generator()(boost::get<json::String>(*safeMapLookup<ParamNotFound>(rec, "id")).raw()); Glib::ustring & rev = boost::get<json::String>(*safeMapLookup<ParamNotFound>(rec, "value")); @@ -173,7 +172,7 @@ class CustomCouchSessionLoader : public SessionContainerLoader::For<CouchSession void deleteSession(const boost::uuids::uuid & sid, const Glib::ustring & rev) const { CurlPtr c = new Curl(); c->setopt(CURLOPT_CUSTOMREQUEST, "DELETE"); - BOOST_FOREACH(const std::string & b, CouchSessionContainer::baseUrls) { + for (const std::string & b : CouchSessionContainer::baseUrls) { c->setopt(CURLOPT_URL, (b + boost::lexical_cast<std::string>(sid) + "?rev=" + rev).c_str()); c->performRead(boost::bind(discard, _2)); return; diff --git a/project2/mail/sendmailTask.cpp b/project2/mail/sendmailTask.cpp index 3b3253a..054f844 100644 --- a/project2/mail/sendmailTask.cpp +++ b/project2/mail/sendmailTask.cpp @@ -1,6 +1,5 @@ #include "sendmailTask.h" #include "logger.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include "scriptLoader.h" #include "viewHost.h" diff --git a/project2/processes/processStream.cpp b/project2/processes/processStream.cpp index 1ed8388..3067533 100644 --- a/project2/processes/processStream.cpp +++ b/project2/processes/processStream.cpp @@ -6,7 +6,6 @@ #include <exception> #include <sys/wait.h> #include <misc.h> -#include <boost/foreach.hpp> SimpleMessageException(SubProcessFailedToStart); SimpleMessageException(SubProcessFailed); @@ -26,7 +25,7 @@ class ProcessStream : public Stream, IHaveParameters { std::vector<std::string> callProc; callProc.reserve(parameters.size() + 2); callProc.push_back(path(ec)); - BOOST_FOREACH(const Parameters::value_type & p, parameters) { + for (const Parameters::value_type & p : parameters) { callProc.push_back(p.second(ec)); } int fds[2]; diff --git a/project2/sql/pch.hpp b/project2/sql/pch.hpp index f1ff842..2d8e99b 100644 --- a/project2/sql/pch.hpp +++ b/project2/sql/pch.hpp @@ -23,7 +23,6 @@ #include "scriptLoader.h" #include "scripts.h" #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include "options.h" #include <buffer.h> #include <column.h> diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp index 86c6a6e..b25e8dc 100644 --- a/project2/sql/rdbmsDataSource.cpp +++ b/project2/sql/rdbmsDataSource.cpp @@ -5,7 +5,6 @@ #include "logger.h" #include "scripts.h" #include <errno.h> -#include <boost/foreach.hpp> SimpleMessageException(UnknownConnectionProvider); #define LOCK(l) std::lock_guard<std::mutex> _lock##l(l) @@ -47,7 +46,7 @@ RdbmsDataSource::RdbmsDataSource(ScriptNodePtr p) : masterDsn(p->child("masterdsn")), preferLocal(p->value("preferlocal", true, NULL)) { - BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("readonly")) { + for (ScriptNodePtr node : p->childrenIn("readonly")) { roDSNs.insert(ReadonlyDSNs::value_type(node->value("host", NULL).as<std::string>(), node)); } } @@ -106,7 +105,7 @@ RdbmsDataSource::getReadonly() const // Failed to connect to a preferred DB... carry on and try the others... } } - BOOST_FOREACH(ReadonlyDSNs::value_type db, roDSNs) { + for (ReadonlyDSNs::value_type db : roDSNs) { try { return connectTo(db.second).get(); } diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp index f20bfe4..3fca870 100644 --- a/project2/sql/sqlCache.cpp +++ b/project2/sql/sqlCache.cpp @@ -12,7 +12,6 @@ #include "scriptLoader.h" #include "iHaveParameters.h" #include "rowSet.h" -#include <boost/foreach.hpp> #include "options.h" #include <boost/algorithm/string/predicate.hpp> #include <boost/date_time/posix_time/posix_time.hpp> @@ -111,7 +110,7 @@ class SqlCache : public RowSetCache { break; } } - BOOST_FOREACH(const unsigned int & c, colCols) { + for (const unsigned int & c : colCols) { const DB::Column & col = (*s)[c]; col.apply(h); ss.fields[&c - &colCols.front()] = h.variable; @@ -169,10 +168,10 @@ class SqlCache : public RowSetCache { void finishRow() const { Buffer sql; sql.appendf("INSERT INTO %s_%s_%s_rows(p2_row", HeaderTable.c_str(), n.c_str(), f.c_str()); - BOOST_FOREACH(const Values::value_type & a, attrs) { + for (const Values::value_type & a : attrs) { sql.appendf(", p2attr_%s", a.first.c_str()); } - BOOST_FOREACH(const Values::value_type & v, cols) { + for (const Values::value_type & v : cols) { sql.appendf(", %s", v.first.c_str()); } sql.appendf(") VALUES(?"); @@ -187,10 +186,10 @@ class SqlCache : public RowSetCache { ModifyPtr m(con->newModifyCommand(sql)); unsigned int offset = 0; m->bindParamI(offset++, row++); - BOOST_FOREACH(const Values::value_type & a, attrs) { + for (const Values::value_type & a : attrs) { boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(m.get(), offset++), a.second); } - BOOST_FOREACH(const Values::value_type & v, cols) { + for (const Values::value_type & v : cols) { boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(m.get(), offset++), v.second); } m->execute(); diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp index f70e1ae..d0f6499 100644 --- a/project2/sql/sqlMergeTask.cpp +++ b/project2/sql/sqlMergeTask.cpp @@ -11,7 +11,6 @@ #include <stdio.h> #include <stdexcept> #include <boost/algorithm/string/join.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> bool SqlMergeTask::defaultUseTempTable = true; @@ -30,7 +29,7 @@ class SqlMergeInsert : IHaveParameters, public Task { } void execute(ExecContext * ec) const { unsigned int col = 0; - BOOST_FOREACH(const Parameters::value_type & v, parameters) { + for (const Parameters::value_type & v : parameters) { boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(insert, col++), v.second(ec)); } insert->execute(); @@ -93,7 +92,7 @@ SqlMergeTask::SqlMergeTask(ScriptNodePtr p) : throw NotSupported("useview not supported with iterate fillers"); } - BOOST_FOREACH(ScriptNodePtr e, p->childrenIn("columns")) { + for (ScriptNodePtr e : p->childrenIn("columns")) { TargetColumnPtr tcp(new TargetColumn(e->get_name())); tcp->maptable = e->value("maptable", "", NULL).as<std::string>(); if (!tcp->maptable.empty()) { @@ -124,7 +123,7 @@ SqlMergeTask::loadComplete(const CommonObjects * co) { destdb = co->dataSource<RdbmsDataSource>(dataSource(NULL))->getWritable(); insCmd = insertCommand(); - BOOST_FOREACH(const Sources::value_type & i, sources) { + for (const Sources::value_type & i : sources) { attach(i, insCmd); } } @@ -160,14 +159,14 @@ SqlMergeTask::execute(ExecContext * ec) const createTempKey(); } std::set<std::string> colNames; - BOOST_FOREACH(const TargetColumnPtr & c, cols) { + for (const TargetColumnPtr & c : cols) { colNames.insert(c->column); } TablePatch tp(*destdb, dtablet, dtable, colNames); tp.doDelete = doDelete(NULL); tp.doUpdate = doUpdate(NULL); tp.doInsert = doInsert(NULL); - BOOST_FOREACH(const Keys::value_type & k, keys) { + for (const Keys::value_type & k : keys) { tp.addKey(k); } tp.patch(ec, insteadOfDelete, updateWhere, patchOrder); @@ -192,7 +191,7 @@ SqlMergeTask::createTempTable() const dtable.c_str())); ctt->execute(); delete ctt; - BOOST_FOREACH(Columns::value_type c, cols) { + for (Columns::value_type c : cols) { if (!c->maptable.empty()) { DB::ModifyCommand * at = destdb->newModifyCommand(stringf( "ALTER TABLE %s ADD COLUMN %s VARCHAR(1000)", @@ -234,7 +233,7 @@ SqlMergeTask::createTempKey() const delete at; /* Indexes */ int n = 0; - BOOST_FOREACH(const Keys::value_type & i, indexes) { + for (const Keys::value_type & i : indexes) { DB::ModifyCommand * ci = destdb->newModifyCommand(stringf( "CREATE INDEX idx_%s_%d ON %s(%s)", dtablet.c_str(), n, dtablet.c_str(), i.c_str())); @@ -308,7 +307,7 @@ attach(boost::intrusive_ptr<IHaveSubTasks> i, DB::ModifyCommand * insert) i->normal.push_back(new Populate(insert)); } else { - BOOST_FOREACH(const IHaveSubTasks::Tasks::value_type & n, i->normal) { + for (const IHaveSubTasks::Tasks::value_type & n : i->normal) { attach(boost::dynamic_pointer_cast<IHaveSubTasks>(n), insert); attach(boost::dynamic_pointer_cast<SqlMergeInsert>(n), insert); } @@ -321,7 +320,7 @@ SqlMergeTask::copyToTempTable(ExecContext * ec) const if (useView(NULL)) { return; } - BOOST_FOREACH(const Sources::value_type & i, sources) { + for (const Sources::value_type & i : sources) { i->execute(ec); } if (sqlCommand) { @@ -347,7 +346,7 @@ SqlMergeTask::copyToTempTable(ExecContext * ec) const cttt->execute(); delete cttt; } - BOOST_FOREACH(Columns::value_type c, cols) { + for (Columns::value_type c : cols) { if (!c->maptable.empty()) { DB::ModifyCommand * utt = destdb->newModifyCommand( stringf( diff --git a/project2/sql/sqlRows.cpp b/project2/sql/sqlRows.cpp index 1395db9..59aa0e8 100644 --- a/project2/sql/sqlRows.cpp +++ b/project2/sql/sqlRows.cpp @@ -9,7 +9,6 @@ #include "scriptLoader.h" #include "commonObjects.h" #include <boost/date_time/gregorian/gregorian_types.hpp> -#include <boost/foreach.hpp> DECLARE_LOADER("sqlrows", SqlRows); diff --git a/project2/sql/sqlTask.cpp b/project2/sql/sqlTask.cpp index eab00d5..a98748f 100644 --- a/project2/sql/sqlTask.cpp +++ b/project2/sql/sqlTask.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "sqlTask.h" -#include <boost/foreach.hpp> #include "scriptLoader.h" #include "modifycommand.h" #include "rdbmsDataSource.h" @@ -41,12 +40,12 @@ SqlTask::execute(ExecContext * ec) const unsigned int offset = 0; sqlCommand.bindParams(ec, modify.get(), offset); if (modify->execute() == 0) { - BOOST_FOREACH(const SubNOEs::value_type & sq, noChangesNOEs) { + for (const SubNOEs::value_type & sq : noChangesNOEs) { sq->execute(ec); } } else { - BOOST_FOREACH(const SubNOEs::value_type & sq, changesNOEs) { + for (const SubNOEs::value_type & sq : changesNOEs) { sq->execute(ec); } } diff --git a/project2/sql/sqlTest.cpp b/project2/sql/sqlTest.cpp index 30b43b8..3c41fef 100644 --- a/project2/sql/sqlTest.cpp +++ b/project2/sql/sqlTest.cpp @@ -6,7 +6,6 @@ #include "rdbmsDataSource.h" #include "commonObjects.h" #include "sqlVariableBinder.h" -#include <boost/foreach.hpp> #include <boost/date_time/posix_time/posix_time.hpp> DECLARE_LOADER("sqltest", SqlTest); diff --git a/project2/sql/sqlWriter.cpp b/project2/sql/sqlWriter.cpp index cd9108d..f654636 100644 --- a/project2/sql/sqlWriter.cpp +++ b/project2/sql/sqlWriter.cpp @@ -1,7 +1,6 @@ #include <pch.hpp> #include "sqlWriter.h" #include "scripts.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include "sqlVariableBinder.h" @@ -47,7 +46,7 @@ DynamicSql::SqlCommand::SqlCommand(ScriptNodePtr s) Glib::ustring DynamicSql::SqlCommand::getSqlFor(const Glib::ustring & f) const { - BOOST_FOREACH(const SqlCommand::Filters::value_type & filter, filters) { + for (const SqlCommand::Filters::value_type & filter : filters) { filter.second->active = (filter.second->name == f); } Buffer sql; @@ -58,7 +57,7 @@ DynamicSql::SqlCommand::getSqlFor(const Glib::ustring & f) const void DynamicSql::SqlCommand::writeSql(Buffer & sql) const { - BOOST_FOREACH(const SqlWriterPtr & w, writers) { + for (const SqlWriterPtr & w : writers) { w->writeSql(sql); } } @@ -66,7 +65,7 @@ DynamicSql::SqlCommand::writeSql(Buffer & sql) const void DynamicSql::SqlCommand::bindParams(ExecContext * ec, DB::Command * cmd, unsigned int & offset) const { - BOOST_FOREACH(const SqlWriterPtr & w, writers) { + for (const SqlWriterPtr & w : writers) { w->bindParams(ec, cmd, offset); } } @@ -84,7 +83,7 @@ void DynamicSql::SqlFilter::writeSql(Buffer & sql) const { if (active) { - BOOST_FOREACH(const SqlWriterPtr & w, writers) { + for (const SqlWriterPtr & w : writers) { w->writeSql(sql); } } @@ -94,7 +93,7 @@ void DynamicSql::SqlFilter::bindParams(ExecContext * ec, DB::Command * cmd, unsigned int & offset) const { if (active) { - BOOST_FOREACH(const SqlWriterPtr & w, writers) { + for (const SqlWriterPtr & w : writers) { w->bindParams(ec, cmd, offset); } } diff --git a/project2/xml/mutators/copy.cpp b/project2/xml/mutators/copy.cpp index 5c16ef6..f58bef7 100644 --- a/project2/xml/mutators/copy.cpp +++ b/project2/xml/mutators/copy.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "../xmlPresenter.h" -#include <boost/foreach.hpp> #include <libxml++/document.h> class Copy : public XmlDocMutator { @@ -14,8 +13,8 @@ class Copy : public XmlDocMutator { } void mutateElement(xmlpp::Element * root) const { - BOOST_FOREACH(xmlpp::Node * e, root->find(from(NULL))) { - BOOST_FOREACH(xmlpp::Node * t, e->find(to(NULL))) { + for (xmlpp::Node * e : root->find(from(NULL))) { + for (xmlpp::Node * t : e->find(to(NULL))) { t->import_node(e); if (delAfter(NULL)) { e->get_parent()->remove_child(e); diff --git a/project2/xml/mutators/copyToAttr.cpp b/project2/xml/mutators/copyToAttr.cpp index 9f0db5b..a58ac93 100644 --- a/project2/xml/mutators/copyToAttr.cpp +++ b/project2/xml/mutators/copyToAttr.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "../xmlPresenter.h" -#include <boost/foreach.hpp> #include <libxml++/document.h> class CopyToAttr : public XmlDocMutator { @@ -14,9 +13,9 @@ class CopyToAttr : public XmlDocMutator { } void mutateElement(xmlpp::Element * root) const { - BOOST_FOREACH(xmlpp::Node * e, root->find(from(NULL))) { + for (xmlpp::Node * e : root->find(from(NULL))) { if (xmlpp::Element * ee = dynamic_cast<xmlpp::Element *>(e)) { - BOOST_FOREACH(xmlpp::Node * t, e->find(to(NULL))) { + for (xmlpp::Node * t : e->find(to(NULL))) { if (xmlpp::Element * te = dynamic_cast<xmlpp::Element *>(t)) { te->set_attribute(e->get_name(), ee->get_child_text()->get_content()); if (delAfter(NULL)) { diff --git a/project2/xml/mutators/create.cpp b/project2/xml/mutators/create.cpp index 2c271dd..88d8808 100644 --- a/project2/xml/mutators/create.cpp +++ b/project2/xml/mutators/create.cpp @@ -1,7 +1,6 @@ #include <pch.hpp> #include "../xmlPresenter.h" #include <libxml++/document.h> -#include <boost/foreach.hpp> class Create : public XmlDocMutator { public: @@ -13,7 +12,7 @@ class Create : public XmlDocMutator { } void mutateElement(xmlpp::Element * root) const { - BOOST_FOREACH(xmlpp::Node * e, root->find(xpath(NULL))) { + for (xmlpp::Node * e : root->find(xpath(NULL))) { e->add_child(name(NULL)); } } diff --git a/project2/xml/mutators/delete.cpp b/project2/xml/mutators/delete.cpp index ed4d620..6e4d597 100644 --- a/project2/xml/mutators/delete.cpp +++ b/project2/xml/mutators/delete.cpp @@ -1,7 +1,6 @@ #include <pch.hpp> #include "../xmlPresenter.h" #include <libxml++/document.h> -#include <boost/foreach.hpp> class Delete : public XmlDocMutator { public: @@ -12,7 +11,7 @@ class Delete : public XmlDocMutator { } void mutateElement(xmlpp::Element * root) const { - BOOST_FOREACH(xmlpp::Node * e, root->find(xpath(NULL))) { + for (xmlpp::Node * e : root->find(xpath(NULL))) { e->get_parent()->remove_child(e); } } diff --git a/project2/xml/mutators/rename.cpp b/project2/xml/mutators/rename.cpp index 544afd9..ec347d8 100644 --- a/project2/xml/mutators/rename.cpp +++ b/project2/xml/mutators/rename.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "../xmlPresenter.h" -#include <boost/foreach.hpp> #include <libxml++/document.h> class Rename : public XmlDocMutator { @@ -13,7 +12,7 @@ class Rename : public XmlDocMutator { } void mutateElement(xmlpp::Element * root) const { - BOOST_FOREACH(xmlpp::Node * e, root->find(xpath(NULL))) { + for (xmlpp::Node * e : root->find(xpath(NULL))) { e->set_name(newname(NULL)); } } diff --git a/project2/xml/pch.hpp b/project2/xml/pch.hpp index 453f8cc..1eb8309 100644 --- a/project2/xml/pch.hpp +++ b/project2/xml/pch.hpp @@ -11,7 +11,6 @@ #include "safeMapFind.h" #include "variables.h" #include <boost/filesystem/path.hpp> -#include <boost/foreach.hpp> #include "options.h" #include <libxml++/document.h> #include <libxml++/nodes/element.h> diff --git a/project2/xml/rawView.cpp b/project2/xml/rawView.cpp index 1cd1676..c583e00 100644 --- a/project2/xml/rawView.cpp +++ b/project2/xml/rawView.cpp @@ -5,7 +5,6 @@ #include "scriptLoader.h" #include "xmlDocumentCache.h" #include "xmlScriptParser.h" -#include <boost/foreach.hpp> #include <libxml++/nodes/textnode.h> class RawViewBase : public View { @@ -16,7 +15,7 @@ class RawViewBase : public View { void execute(const MultiRowSetPresenter * mp, ExecContext * ec) const { if (const Presenter * p = dynamic_cast<const Presenter *>(mp)) { - BOOST_FOREACH(const auto * node, getCopyRoot(ec)->get_children()) { + for (const auto * node : getCopyRoot(ec)->get_children()) { const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(node); if (e) { copyNode(p, e); @@ -34,11 +33,11 @@ class RawViewBase : public View { p->pushSub(n->get_name()); p->setNamespace(n->get_namespace_prefix(), n->get_namespace_uri()); xmlpp::Element::AttributeList al = n->get_attributes(); - BOOST_FOREACH(const xmlpp::Attribute * a, al) { + for (const xmlpp::Attribute * a : al) { p->addAttribute(a->get_name(), a->get_value()); } const xmlpp::Node::NodeList ch = n->get_children(); - BOOST_FOREACH(const xmlpp::Node * c, ch) { + for (const xmlpp::Node * c : ch) { if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(c)) { copyNode(p, e); } diff --git a/project2/xml/sessionXml.cpp b/project2/xml/sessionXml.cpp index 73bdccc..866d5b2 100644 --- a/project2/xml/sessionXml.cpp +++ b/project2/xml/sessionXml.cpp @@ -5,7 +5,6 @@ #include <libxml++/nodes/element.h> #include <libxml++/parsers/domparser.h> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/filesystem/convenience.hpp> #include <boost/lexical_cast.hpp> #include "options.h" @@ -82,7 +81,7 @@ SessionContainerXml::getSession(const boost::uuids::uuid & sid) const return NULL; } SessionPtr s = new Session(sid); - BOOST_FOREACH(const xmlpp::Node * n, sess->get_children()) { + for (const xmlpp::Node * n : sess->get_children()) { if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) { if (e->get_child_text()) { s->SetValue(e->get_name(), e->get_child_text()->get_content()); diff --git a/project2/xml/xmlCache.cpp b/project2/xml/xmlCache.cpp index 649ce02..52e693a 100644 --- a/project2/xml/xmlCache.cpp +++ b/project2/xml/xmlCache.cpp @@ -6,7 +6,6 @@ #include "xmlRawRows.h" #include "xmlPresenter.h" #include <sys/stat.h> -#include <boost/foreach.hpp> #include "options.h" #include <boost/filesystem/path.hpp> #include <boost/filesystem/convenience.hpp> diff --git a/project2/xml/xmlPresenter.cpp b/project2/xml/xmlPresenter.cpp index e7abc3a..a43f9f8 100644 --- a/project2/xml/xmlPresenter.cpp +++ b/project2/xml/xmlPresenter.cpp @@ -7,7 +7,6 @@ #include <libxml++/document.h> #include <boost/date_time/posix_time/time_formatters.hpp> #include <boost/date_time/gregorian/formatters.hpp> -#include <boost/foreach.hpp> #include "instanceStore.impl.h" DECLARE_OPTIONS(XmlPresenter, "XML Presenter options") @@ -267,7 +266,7 @@ XmlPresenter::writeTo(std::ostream & o, const std::string & enc, ExecContext *) void XmlPresenter::finalizeContent() const { - BOOST_FOREACH(const XmlDocMutatorPtr & m, mutators) { + for (const XmlDocMutatorPtr & m : mutators) { m->mutateElement(responseDoc->get_root_node()); } } diff --git a/project2/xml/xmlRawRows.cpp b/project2/xml/xmlRawRows.cpp index e686375..f9a236e 100644 --- a/project2/xml/xmlRawRows.cpp +++ b/project2/xml/xmlRawRows.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "xmlRawRows.h" -#include <boost/foreach.hpp> #include <libxml++/parsers/domparser.h> #include <libxml++/nodes/textnode.h> @@ -15,7 +14,7 @@ class XmlRowState : public RowState { void foreachAttr(const AttrAction & action) const { - BOOST_FOREACH(const xmlpp::Attribute * a, e->get_attributes()) { + for (const xmlpp::Attribute * a : e->get_attributes()) { action(a->get_name(), a->get_value()); } RowState::foreachAttr(action); @@ -55,11 +54,11 @@ XmlRawRowsBase::XmlRawRowsBase() : void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCallback & rp, ExecContext *) const { XmlRowState rs; - BOOST_FOREACH(const xmlpp::Node * n, doc->get_root_node()->get_children()) { + for (const xmlpp::Node * n : doc->get_root_node()->get_children()) { if ((rs.e = dynamic_cast<const xmlpp::Element *>(n))) { if (rs.cols.empty()) { unsigned int col = 0; - BOOST_FOREACH(const xmlpp::Node * in, rs.e->get_children()) { + for (const xmlpp::Node * in : rs.e->get_children()) { if (const xmlpp::Element * ie = dynamic_cast<const xmlpp::Element *>(in)) { rs.cols.insert(new Column(col++, ie->get_name())); } @@ -67,7 +66,7 @@ void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCall rs.fields.resize(col); } unsigned int col = 0; - BOOST_FOREACH(const xmlpp::Node * in, rs.e->get_children()) { + for (const xmlpp::Node * in : rs.e->get_children()) { if (const xmlpp::Element * ie = dynamic_cast<const xmlpp::Element *>(in)) { const xmlpp::TextNode * t = ie->get_child_text(); if (t) { diff --git a/project2/xml/xmlRows.cpp b/project2/xml/xmlRows.cpp index 7916a37..e45ec03 100644 --- a/project2/xml/xmlRows.cpp +++ b/project2/xml/xmlRows.cpp @@ -10,7 +10,6 @@ #include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/predicate.hpp> -#include <boost/foreach.hpp> DECLARE_LOADER("xmlrows", XmlRows); @@ -29,7 +28,7 @@ XmlRows::XmlRows(ScriptNodePtr p) : boost::split(trigger, rT, boost::is_any_of("/")); unsigned int col = 0; - BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("fields")) { + for (ScriptNodePtr node : p->childrenIn("fields")) { Path p(root); Glib::ustring path = node->value("path", NULL); diff --git a/project2/xml/xmlScriptParser.cpp b/project2/xml/xmlScriptParser.cpp index 3bb8b4a..1c4c798 100644 --- a/project2/xml/xmlScriptParser.cpp +++ b/project2/xml/xmlScriptParser.cpp @@ -4,7 +4,6 @@ #include "commonObjects.h" #include "variables/literal.h" #include <boost/filesystem/convenience.hpp> -#include <boost/foreach.hpp> static const std::string XIncludeNS("http://www.w3.org/2001/XInclude"); static const std::string XIncludeInclude("include"); @@ -26,7 +25,7 @@ XmlScriptParser::doIncludes(xmlpp::Element * e, const boost::filesystem::path & { if (e->get_namespace_uri().raw() == XIncludeNS && e->get_name().raw() == XIncludeInclude) { boost::filesystem::path inc = f.parent_path(); - BOOST_FOREACH(boost::filesystem::path c, boost::filesystem::path(e->get_attribute_value("href").raw())) { + for (boost::filesystem::path c : boost::filesystem::path(e->get_attribute_value("href").raw())) { if (c.string() == "..") { inc = inc.parent_path(); } @@ -41,7 +40,7 @@ XmlScriptParser::doIncludes(xmlpp::Element * e, const boost::filesystem::path & files.insert(Files::value_type(inc, boost::filesystem::last_write_time(inc))); } else { - BOOST_FOREACH(xmlpp::Node * n, e->get_children()) { + for (xmlpp::Node * n : e->get_children()) { if (xmlpp::Element * c = dynamic_cast<xmlpp::Element *>(n)) { doIncludes(c, f); } @@ -76,7 +75,7 @@ XmlScriptParser::modifiedTime() const bool XmlScriptParser::isCurrent() const { - BOOST_FOREACH(const Files::value_type & f, files) { + for (const Files::value_type & f : files) { try { if (boost::filesystem::last_write_time(f.first) != f.second) { _root.reset(); @@ -138,7 +137,7 @@ XmlScriptNode::children() const { if (!childrenCache) { childrenCache = boost::shared_ptr<ScriptNodes>(new ScriptNodes()); - BOOST_FOREACH(const xmlpp::Node * n, element->get_children()) { + for (const xmlpp::Node * n : element->get_children()) { if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) { childrenCache->push_back(new XmlScriptNode(e, script)); } @@ -166,9 +165,9 @@ ScriptNode::ScriptNodes XmlScriptNode::childrenIn(const Glib::ustring & c) const { ScriptNodes sns; - BOOST_FOREACH(const xmlpp::Node * n, element->get_children(c)) { + for (const xmlpp::Node * n : element->get_children(c)) { if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) { - BOOST_FOREACH(const xmlpp::Node * n1, e->get_children()) { + for (const xmlpp::Node * n1 : e->get_children()) { if (const xmlpp::Element * e1 = dynamic_cast<const xmlpp::Element *>(n1)) { sns.push_back(new XmlScriptNode(e1, script)); } @@ -239,7 +238,7 @@ XmlScriptNode::applyValue(const Glib::ustring & n, VariableType & val, ExecConte void XmlScriptNode::composeWithCallbacks(const LiteralCallback & lcb, const NodeCallback & ncb) const { - BOOST_FOREACH(const xmlpp::Node * n, element->get_children()) { + for (const xmlpp::Node * n : element->get_children()) { if (const xmlpp::TextNode * t = dynamic_cast<const xmlpp::TextNode *>(n)) { lcb(t->get_content()); } diff --git a/project2/xml/xpathRows.cpp b/project2/xml/xpathRows.cpp index 8537b35..a73dd39 100644 --- a/project2/xml/xpathRows.cpp +++ b/project2/xml/xpathRows.cpp @@ -10,7 +10,6 @@ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> #include "../libmisc/curlsup.h" -#include <boost/foreach.hpp> DECLARE_LOADER("xpathrows", XPathRows); @@ -24,11 +23,11 @@ XPathRows::XPathRows(ScriptNodePtr p) : warnings(p, "warnings", true), encoding(p, "encoding", Null()) { - BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("filterviews")) { + for (ScriptNodePtr node : p->childrenIn("filterviews")) { FilterViewPtr fv = new FilterView(node); fvs[fv->name] = fv; } - BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("namespaces")) { + for (ScriptNodePtr node : p->childrenIn("namespaces")) { namespaces[node->value("prefix", NULL)] = node->value("url", NULL).as<Glib::ustring>(); } } @@ -67,7 +66,7 @@ XPathRows::execute(const Glib::ustring & filter, const RowProcessorCallback & rp if (!xpathCtx) { throw XpathInitError(xmlGetLastError()->message); } - BOOST_FOREACH(const Namespaces::value_type & ns, namespaces) { + for (const Namespaces::value_type & ns : namespaces) { xmlXPathRegisterNs(xpathCtx.get(), BAD_CAST ns.first.c_str(), BAD_CAST ns.second.c_str()); } xmlXPathObjectSPtr xpathObj = xmlXPathObjectSPtr(xmlXPathEvalExpression(fv->root(ec), xpathCtx.get()), xmlXPathFreeObject); @@ -79,7 +78,7 @@ XPathRows::execute(const Glib::ustring & filter, const RowProcessorCallback & rp for (int row = 0; row < xpathObj->nodesetval->nodeNr; row += 1) { xmlNodePtr rowRoot = xpathObj->nodesetval->nodeTab[row]; xpathCtx->node = rowRoot; - BOOST_FOREACH(const Columns::value_type & _xp, fv->columns.get<byColIdx>()) { + for (const Columns::value_type & _xp : fv->columns.get<byColIdx>()) { const FilterViewColumn * xp = static_cast<const FilterViewColumn *>(_xp.get()); const VariableType & path(xp->path(ec)); if (path.isNull()) { |