Replace BOOST_FOREACH with range-based for loops

fixes #12538
This commit is contained in:
Gunnar Beutner 2016-08-25 06:19:44 +02:00
parent bdaf02295f
commit 288413f046
203 changed files with 808 additions and 1007 deletions

View File

@ -34,7 +34,6 @@
#include "config.h"
#include <boost/program_options.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
#ifndef _WIN32
# include <sys/types.h>
@ -243,7 +242,7 @@ int Main(void)
#endif /* _WIN32 */
if (vm.count("define")) {
BOOST_FOREACH(const String& define, vm["define"].as<std::vector<std::string> >()) {
for (const String& define : vm["define"].as<std::vector<std::string> >()) {
String key, value;
size_t pos = define.FindFirstOf('=');
if (pos != String::NPos) {
@ -269,7 +268,7 @@ int Main(void)
ConfigCompiler::AddIncludeSearchDir(Application::GetIncludeConfDir());
if (!autocomplete && vm.count("include")) {
BOOST_FOREACH(const String& includePath, vm["include"].as<std::vector<std::string> >()) {
for (const String& includePath : vm["include"].as<std::vector<std::string> >()) {
ConfigCompiler::AddIncludeSearchDir(includePath);
}
}
@ -293,7 +292,7 @@ int Main(void)
}
if (vm.count("library")) {
BOOST_FOREACH(const String& libraryName, vm["library"].as<std::vector<std::string> >()) {
for (const String& libraryName : vm["library"].as<std::vector<std::string> >()) {
try {
(void) Loader::LoadExtensionLibrary(libraryName);
} catch (const std::exception& ex) {

View File

@ -21,7 +21,6 @@
#include "icinga-studio/aboutform.hpp"
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/foreach.hpp>
#include <wx/msgdlg.h>
using namespace icinga;
@ -72,11 +71,11 @@ void MainForm::TypesCompletionHandler(boost::exception_ptr eptr, const std::vect
wxTreeItemId rootNode = m_TypesTree->AddRoot("root");
BOOST_FOREACH(const ApiType::Ptr& type, types) {
for (const ApiType::Ptr& type : types) {
m_Types[type->Name] = type;
}
BOOST_FOREACH(const ApiType::Ptr& type, types) {
for (const ApiType::Ptr& type : types) {
if (type->Abstract)
continue;
@ -146,7 +145,7 @@ void MainForm::ObjectsCompletionHandler(boost::exception_ptr eptr, const std::ve
std::vector<ApiObject::Ptr> sortedObjects = objects;
std::sort(sortedObjects.begin(), sortedObjects.end(), ApiObjectLessComparer);
BOOST_FOREACH(const ApiObject::Ptr& object, sortedObjects) {
for (const ApiObject::Ptr& object : sortedObjects) {
std::string name = object->Name;
m_ObjectsList->InsertItem(0, name);
}
@ -195,7 +194,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
{
ObjectLock olock(arr);
BOOST_FOREACH(const Value& aitem, arr) {
for (const Value& aitem : arr) {
String val1 = aitem;
val.Add(val1.GetData());
}
@ -211,7 +210,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
{
ObjectLock olock(dict);
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
for (const Dictionary::Pair& kv : dict) {
if (kv.first != "type")
prop->AppendChild(ValueToProperty(kv.first, kv.second));
}
@ -268,8 +267,7 @@ void MainForm::ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const s
std::map<String, wxStringProperty *> parents;
typedef std::pair<String, Value> kv_pair_attr;
BOOST_FOREACH(const kv_pair_attr& kv, object->Attrs) {
for (const auto& kv : object->Attrs) {
std::vector<String> tokens;
boost::algorithm::split(tokens, kv.first, boost::is_any_of("."));
@ -298,8 +296,7 @@ void MainForm::ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const s
parents.erase(propName);
}
typedef std::pair<String, wxStringProperty *> kv_pair_prop;
BOOST_FOREACH(const kv_pair_prop& kv, parents) {
for (const auto& kv : parents) {
m_PropertyGrid->Append(kv.second);
m_PropertyGrid->SetPropertyReadOnly(kv.second);
}

View File

@ -32,7 +32,6 @@
#include "base/scriptglobal.hpp"
#include "base/process.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/exception/errinfo_api_function.hpp>
@ -115,7 +114,7 @@ void Application::Exit(int rc)
std::cout.flush();
std::cerr.flush();
BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
for (const Logger::Ptr& logger : Logger::GetLoggers()) {
logger->Flush();
}
@ -452,7 +451,7 @@ String Application::GetExePath(const String& argv0)
boost::algorithm::split(paths, pathEnv, boost::is_any_of(":"));
bool foundPath = false;
BOOST_FOREACH(String& path, paths) {
for (const String& path : paths) {
String pathTest = path + "/" + argv0;
if (access(pathTest.CStr(), X_OK) == 0) {

View File

@ -23,7 +23,6 @@
#include "base/scriptframe.hpp"
#include "base/objectlock.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -123,7 +122,7 @@ static Value ArrayJoin(const Value& separator)
bool first = true;
ObjectLock olock(self);
BOOST_FOREACH(const Value& item, self) {
for (const Value& item : self) {
if (first) {
first = false;
} else {
@ -154,7 +153,7 @@ static Array::Ptr ArrayMap(const Function::Ptr& function)
Array::Ptr result = new Array();
ObjectLock olock(self);
BOOST_FOREACH(const Value& item, self) {
for (const Value& item : self) {
std::vector<Value> args;
args.push_back(item);
result->Add(function->Invoke(args));
@ -198,7 +197,7 @@ static Array::Ptr ArrayFilter(const Function::Ptr& function)
Array::Ptr result = new Array();
ObjectLock olock(self);
BOOST_FOREACH(const Value& item, self) {
for (const Value& item : self) {
std::vector<Value> args;
args.push_back(item);
if (function->Invoke(args))
@ -216,7 +215,7 @@ static Array::Ptr ArrayUnique(void)
std::set<Value> result;
ObjectLock olock(self);
BOOST_FOREACH(const Value& item, self) {
for (const Value& item : self) {
result.insert(item);
}

View File

@ -25,7 +25,6 @@
#include "base/configwriter.hpp"
#include "base/convert.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -185,7 +184,7 @@ Object::Ptr Array::Clone(void) const
Array::Ptr arr = new Array();
ObjectLock olock(this);
BOOST_FOREACH(const Value& val, m_Data) {
for (const Value& val : m_Data) {
arr->Add(val.Clone());
}

View File

@ -142,33 +142,16 @@ private:
std::vector<Value> m_Data; /**< The data for the array. */
};
inline Array::Iterator range_begin(Array::Ptr x)
inline Array::Iterator begin(Array::Ptr x)
{
return x->Begin();
}
inline Array::Iterator range_end(Array::Ptr x)
inline Array::Iterator end(Array::Ptr x)
{
return x->End();
}
}
namespace boost
{
template<>
struct range_mutable_iterator<icinga::Array::Ptr>
{
typedef icinga::Array::Iterator type;
};
template<>
struct range_const_iterator<icinga::Array::Ptr>
{
typedef icinga::Array::Iterator type;
};
}
#endif /* ARRAY_H */

View File

@ -34,7 +34,6 @@
#include "base/context.hpp"
#include "base/application.hpp"
#include <fstream>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/exception/errinfo_api_function.hpp>
@ -181,7 +180,7 @@ void ConfigObject::ModifyAttribute(const String& attr, const Value& value, bool
if (oldValue.IsObjectType<Dictionary>()) {
Dictionary::Ptr oldDict = oldValue;
ObjectLock olock(oldDict);
BOOST_FOREACH(const Dictionary::Pair& kv, oldDict) {
for (const auto& kv : oldDict) {
String key = prefix + "." + kv.first;
if (!original_attributes->Contains(key))
original_attributes->Set(key, kv.second);
@ -191,7 +190,7 @@ void ConfigObject::ModifyAttribute(const String& attr, const Value& value, bool
if (value.IsObjectType<Dictionary>()) {
Dictionary::Ptr valueDict = value;
ObjectLock olock(valueDict);
BOOST_FOREACH(const Dictionary::Pair& kv, valueDict) {
for (const auto& kv : valueDict) {
String key = attr + "." + kv.first;
if (!original_attributes->Contains(key))
original_attributes->Set(key, Empty);
@ -282,7 +281,7 @@ void ConfigObject::RestoreAttribute(const String& attr, bool updateVersion)
{
ObjectLock olock(original_attributes);
BOOST_FOREACH(const Dictionary::Pair& kv, original_attributes) {
for (const auto& kv : original_attributes) {
std::vector<String> originalTokens;
boost::algorithm::split(originalTokens, kv.first, boost::is_any_of("."));
@ -325,7 +324,7 @@ void ConfigObject::RestoreAttribute(const String& attr, bool updateVersion)
}
}
BOOST_FOREACH(const String& attr, restoredAttrs)
for (const String& attr : restoredAttrs)
original_attributes->Remove(attr);
@ -497,13 +496,13 @@ void ConfigObject::DumpObjects(const String& filename, int attributeTypes)
StdioStream::Ptr sfp = new StdioStream(&fp, false);
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
for (const Type::Ptr& type : Type::GetAllTypes()) {
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype)
continue;
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
Dictionary::Ptr persistentObject = new Dictionary();
persistentObject->Set("type", type->GetName());
@ -599,13 +598,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
unsigned long no_state = 0;
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
for (const Type::Ptr& type : Type::GetAllTypes()) {
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype)
continue;
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
if (!object->GetStateLoaded()) {
object->OnStateLoaded();
object->SetStateLoaded(true);
@ -621,13 +620,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
void ConfigObject::StopObjects(void)
{
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
for (const Type::Ptr& type : Type::GetAllTypes()) {
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype)
continue;
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
object->Deactivate();
}
}
@ -635,20 +634,20 @@ void ConfigObject::StopObjects(void)
void ConfigObject::DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& callback)
{
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
for (const Type::Ptr& type : Type::GetAllTypes()) {
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype)
continue;
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
Dictionary::Ptr originalAttributes = object->GetOriginalAttributes();
if (!originalAttributes)
continue;
ObjectLock olock(originalAttributes);
BOOST_FOREACH(const Dictionary::Pair& kv, originalAttributes) {
for (const Dictionary::Pair& kv : originalAttributes) {
String key = kv.first;
Type::Ptr type = object->GetReflectionType();

View File

@ -24,7 +24,6 @@
#include "base/object.hpp"
#include "base/type.hpp"
#include "base/dictionary.hpp"
#include <boost/foreach.hpp>
namespace icinga
{
@ -55,7 +54,7 @@ public:
{
std::vector<intrusive_ptr<ConfigObject> > objects = GetObjectsHelper(T::TypeInstance.get());
std::vector<intrusive_ptr<T> > result;
BOOST_FOREACH(const intrusive_ptr<ConfigObject>& object, objects) {
for (const auto& object : objects) {
result.push_back(static_pointer_cast<T>(object));
}
return result;

View File

@ -19,7 +19,6 @@
#include "base/configwriter.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
@ -63,7 +62,7 @@ void ConfigWriter::EmitArrayItems(std::ostream& fp, int indentLevel, const Array
bool first = true;
ObjectLock olock(val);
BOOST_FOREACH(const Value& item, val) {
for (const Value& item : val) {
if (first)
first = false;
else
@ -80,7 +79,7 @@ void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary
if (imports && imports->GetLength() > 0) {
ObjectLock xlock(imports);
BOOST_FOREACH(const Value& import, imports) {
for (const Value& import : imports) {
fp << "\n";
EmitIndent(fp, indentLevel);
fp << "import \"" << import << "\"";
@ -91,7 +90,7 @@ void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary
if (val) {
ObjectLock olock(val);
BOOST_FOREACH(const Dictionary::Pair& kv, val) {
for (const Dictionary::Pair& kv : val) {
fp << "\n";
EmitIndent(fp, indentLevel);

View File

@ -19,7 +19,6 @@
#include "base/context.hpp"
#include <boost/thread/tss.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
@ -52,7 +51,7 @@ void ContextTrace::Print(std::ostream& fp) const
fp << std::endl;
int i = 0;
BOOST_FOREACH(const String& frame, m_Frames) {
for (const String& frame : m_Frames) {
fp << "\t(" << i << ") " << frame << std::endl;
i++;
}

View File

@ -18,7 +18,6 @@
******************************************************************************/
#include "base/dependencygraph.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -59,7 +58,7 @@ std::vector<Object::Ptr> DependencyGraph::GetParents(const Object::Ptr& child)
if (it != m_Dependencies.end()) {
typedef std::pair<Object *, int> kv_pair;
BOOST_FOREACH(const kv_pair& kv, it->second) {
for (const kv_pair& kv : it->second) {
objects.push_back(kv.first);
}
}

View File

@ -22,7 +22,6 @@
#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
#include "base/array.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -74,7 +73,7 @@ static Array::Ptr DictionaryKeys(void)
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
Array::Ptr keys = new Array();
ObjectLock olock(self);
BOOST_FOREACH(const Dictionary::Pair& kv, self) {
for (const Dictionary::Pair& kv : self) {
keys->Add(kv.first);
}
return keys;

View File

@ -22,7 +22,6 @@
#include "base/debug.hpp"
#include "base/primitivetype.hpp"
#include "base/configwriter.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -137,7 +136,7 @@ void Dictionary::CopyTo(const Dictionary::Ptr& dest) const
{
ObjectLock olock(this);
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
for (const Dictionary::Pair& kv : m_Data) {
dest->Set(kv.first, kv.second);
}
}
@ -165,7 +164,7 @@ Object::Ptr Dictionary::Clone(void) const
Dictionary::Ptr dict = new Dictionary();
ObjectLock olock(this);
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
for (const Dictionary::Pair& kv : m_Data) {
dict->Set(kv.first, kv.second.Clone());
}
@ -184,7 +183,7 @@ std::vector<String> Dictionary::GetKeys(void) const
std::vector<String> keys;
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
for (const Dictionary::Pair& kv : m_Data) {
keys.push_back(kv.first);
}

View File

@ -125,33 +125,16 @@ private:
std::map<String, Value> m_Data; /**< The data for the dictionary. */
};
inline Dictionary::Iterator range_begin(Dictionary::Ptr x)
inline Dictionary::Iterator begin(Dictionary::Ptr x)
{
return x->Begin();
}
inline Dictionary::Iterator range_end(Dictionary::Ptr x)
inline Dictionary::Iterator end(Dictionary::Ptr x)
{
return x->End();
}
}
namespace boost
{
template<>
struct range_mutable_iterator<icinga::Dictionary::Ptr>
{
typedef icinga::Dictionary::Iterator type;
};
template<>
struct range_const_iterator<icinga::Dictionary::Ptr>
{
typedef icinga::Dictionary::Iterator type;
};
}
#endif /* DICTIONARY_H */

View File

@ -18,8 +18,6 @@
******************************************************************************/
#include "base/exception.hpp"
#include <boost/thread/tss.hpp>
#include <boost/foreach.hpp>
#ifdef HAVE_CXXABI_H
# include <cxxabi.h>
@ -160,7 +158,7 @@ String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, Sta
Array::Ptr messages;
if (currentHint) {
BOOST_FOREACH(const String& attr, vex->GetAttributePath()) {
for (const String& attr : vex->GetAttributePath()) {
Dictionary::Ptr props = currentHint->Get("properties");
if (!props)
@ -326,7 +324,7 @@ ValidationError::ValidationError(const ConfigObject::Ptr& object, const std::vec
{
String path;
BOOST_FOREACH(const String& attribute, attributePath) {
for (const String& attribute : attributePath) {
if (!path.IsEmpty())
path += " -> ";

View File

@ -34,7 +34,7 @@ void FileLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const FileLogger::Ptr& filelogger, ConfigType::GetObjectsByType<FileLogger>()) {
for (const FileLogger::Ptr& filelogger : ConfigType::GetObjectsByType<FileLogger>()) {
nodes->Set(filelogger->GetName(), 1); //add more stats
}

View File

@ -23,7 +23,6 @@
#include "base/array.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
#include <boost/exception_ptr.hpp>
#include <yajl/yajl_version.h>
#include <yajl/yajl_gen.h>
@ -45,7 +44,7 @@ static void EncodeDictionary(yajl_gen handle, const Dictionary::Ptr& dict)
yajl_gen_map_open(handle);
ObjectLock olock(dict);
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
for (const Dictionary::Pair& kv : dict) {
yajl_gen_string(handle, reinterpret_cast<const unsigned char *>(kv.first.CStr()), kv.first.GetLength());
Encode(handle, kv.second);
}
@ -58,7 +57,7 @@ static void EncodeArray(yajl_gen handle, const Array::Ptr& arr)
yajl_gen_array_open(handle);
ObjectLock olock(arr);
BOOST_FOREACH(const Value& value, arr) {
for (const Value& value : arr) {
Encode(handle, value);
}

View File

@ -20,7 +20,6 @@
#include "base/loader.hpp"
#include "base/logger.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -26,7 +26,6 @@
#include "base/objectlock.hpp"
#include "base/context.hpp"
#include "base/scriptglobal.hpp"
#include <boost/foreach.hpp>
#include <iostream>
using namespace icinga;
@ -102,7 +101,7 @@ void icinga::IcingaLog(LogSeverity severity, const String& facility,
}
}
BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
for (const Logger::Ptr& logger : Logger::GetLoggers()) {
ObjectLock llock(logger);
if (!logger->IsActive())

View File

@ -24,7 +24,6 @@
#include "base/initialize.hpp"
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/foreach.hpp>
#include <cmath>
using namespace icinga;
@ -84,7 +83,7 @@ static Value MathMax(const std::vector<Value>& args)
bool first = true;
Value result = -INFINITY;
BOOST_FOREACH(const Value& arg, args) {
for (const Value& arg : args) {
if (first || arg > result) {
first = false;
result = arg;
@ -99,7 +98,7 @@ static Value MathMin(const std::vector<Value>& args)
bool first = true;
Value result = INFINITY;
BOOST_FOREACH(const Value& arg, args) {
for (const Value& arg : args) {
if (first || arg < result) {
first = false;
result = arg;

View File

@ -25,7 +25,6 @@
#include "base/timer.hpp"
#include "base/logger.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
using namespace icinga;
@ -227,7 +226,7 @@ static void TypeInfoTimerHandler(void)
boost::mutex::scoped_lock lock(l_ObjectCountLock);
typedef std::map<String, int>::value_type kv_pair;
BOOST_FOREACH(kv_pair& kv, l_ObjectCounts) {
for (kv_pair& kv : l_ObjectCounts) {
if (kv.second == 0)
continue;

View File

@ -27,7 +27,6 @@
#include "base/logger.hpp"
#include "base/utility.hpp"
#include "base/scriptglobal.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/thread/once.hpp>
@ -128,7 +127,7 @@ Process::Arguments Process::PrepareCommand(const Value& command)
Array::Ptr arguments = command;
ObjectLock olock(arguments);
BOOST_FOREACH(const Value& argument, arguments) {
for (const Value& argument : arguments) {
#ifdef _WIN32
if (args != "")
args += " ";
@ -200,7 +199,7 @@ void Process::IOThreadProc(int tid)
int i = 1;
typedef std::pair<ProcessHandle, Process::Ptr> kv_pair;
BOOST_FOREACH(const kv_pair& kv, l_Processes[tid]) {
for (const kv_pair& kv : l_Processes[tid]) {
const Process::Ptr& process = kv.second;
#ifdef _WIN32
handles[i] = kv.first;
@ -454,7 +453,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
if (m_ExtraEnvironment) {
ObjectLock olock(m_ExtraEnvironment);
BOOST_FOREACH(const Dictionary::Pair& kv, m_ExtraEnvironment) {
for (const Dictionary::Pair& kv : m_ExtraEnvironment) {
String skv = kv.first + "=" + Convert::ToString(kv.second);
envp = static_cast<char *>(realloc(envp, offset + skv.GetLength() + 1));
@ -560,7 +559,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
ObjectLock olock(m_ExtraEnvironment);
int index = envc;
BOOST_FOREACH(const Dictionary::Pair& kv, m_ExtraEnvironment) {
for (const Dictionary::Pair& kv : m_ExtraEnvironment) {
String skv = kv.first + "=" + Convert::ToString(kv.second);
envp[index] = strdup(skv.CStr());
index++;

View File

@ -25,7 +25,6 @@
#include <map>
#include <boost/thread/mutex.hpp>
#include <boost/signals2.hpp>
#include <boost/foreach.hpp>
namespace icinga
{
@ -80,9 +79,7 @@ public:
items = m_Items;
}
typedef typename std::pair<String, T> ItemMapPair;
BOOST_FOREACH(const ItemMapPair& kv, items) {
for (const auto& kv : items) {
OnUnregistered(kv.first);
}

View File

@ -26,7 +26,6 @@
#include "base/convert.hpp"
#include "base/objectlock.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/split.hpp>
#include <fstream>
@ -105,7 +104,7 @@ void ScriptGlobal::WriteToFile(const String& filename)
StdioStream::Ptr sfp = new StdioStream(&fp, false);
ObjectLock olock(m_Globals);
BOOST_FOREACH(const Dictionary::Pair& kv, m_Globals) {
for (const Dictionary::Pair& kv : m_Globals) {
Dictionary::Ptr persistentVariable = new Dictionary();
persistentVariable->Set("name", kv.first);

View File

@ -27,7 +27,6 @@
#include "base/configtype.hpp"
#include "base/application.hpp"
#include "base/dependencygraph.hpp"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <algorithm>
#include <set>
@ -115,19 +114,19 @@ Array::Ptr ScriptUtils::Union(const std::vector<Value>& arguments)
{
std::set<Value> values;
BOOST_FOREACH(const Value& varr, arguments) {
for (const Value& varr : arguments) {
Array::Ptr arr = varr;
if (arr) {
ObjectLock olock(arr);
BOOST_FOREACH(const Value& value, arr) {
for (const Value& value : arr) {
values.insert(value);
}
}
}
Array::Ptr result = new Array();
BOOST_FOREACH(const Value& value, values) {
for (const Value& value : values) {
result->Add(value);
}
@ -252,7 +251,7 @@ Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict)
if (dict) {
ObjectLock olock(dict);
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
for (const Dictionary::Pair& kv : dict) {
result->Add(kv.first);
}
}
@ -289,7 +288,7 @@ Array::Ptr ScriptUtils::GetObjects(const Type::Ptr& type)
Array::Ptr result = new Array();
BOOST_FOREACH(const ConfigObject::Ptr& object, ctype->GetObjects())
for (const ConfigObject::Ptr& object : ctype->GetObjects())
result->Add(object);
return result;

View File

@ -21,7 +21,6 @@
#include "base/type.hpp"
#include "base/application.hpp"
#include "base/objectlock.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -31,7 +30,7 @@ static Array::Ptr SerializeArray(const Array::Ptr& input, int attributeTypes)
ObjectLock olock(input);
BOOST_FOREACH(const Value& value, input) {
for (const Value& value : input) {
result->Add(Serialize(value, attributeTypes));
}
@ -44,7 +43,7 @@ static Dictionary::Ptr SerializeDictionary(const Dictionary::Ptr& input, int att
ObjectLock olock(input);
BOOST_FOREACH(const Dictionary::Pair& kv, input) {
for (const Dictionary::Pair& kv : input) {
result->Set(kv.first, Serialize(kv.second, attributeTypes));
}
@ -80,7 +79,7 @@ static Array::Ptr DeserializeArray(const Array::Ptr& input, bool safe_mode, int
ObjectLock olock(input);
BOOST_FOREACH(const Value& value, input) {
for (const Value& value : input) {
result->Add(Deserialize(value, safe_mode, attributeTypes));
}
@ -93,7 +92,7 @@ static Dictionary::Ptr DeserializeDictionary(const Dictionary::Ptr& input, bool
ObjectLock olock(input);
BOOST_FOREACH(const Dictionary::Pair& kv, input) {
for (const Dictionary::Pair& kv : input) {
result->Set(kv.first, Deserialize(kv.second, safe_mode, attributeTypes));
}
@ -123,7 +122,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
instance = type->Instantiate(std::vector<Value>());
ObjectLock olock(input);
BOOST_FOREACH(const Dictionary::Pair& kv, input) {
for (const Dictionary::Pair& kv : input) {
if (kv.first.IsEmpty())
continue;

View File

@ -21,7 +21,6 @@
#include "base/exception.hpp"
#include "base/logger.hpp"
#include <boost/thread/once.hpp>
#include <boost/foreach.hpp>
#include <map>
#ifdef __linux__
# include <sys/epoll.h>
@ -121,7 +120,7 @@ void SocketEventEngineEpoll::ThreadProc(int tid)
}
}
BOOST_FOREACH(const EventDescription& event, events) {
for (const EventDescription& event : events) {
try {
event.Descriptor.EventInterface->OnEvent(event.REvents);
} catch (const std::exception& ex) {

View File

@ -21,7 +21,6 @@
#include "base/exception.hpp"
#include "base/logger.hpp"
#include <boost/thread/once.hpp>
#include <boost/foreach.hpp>
#include <map>
using namespace icinga;
@ -54,7 +53,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
typedef std::map<SOCKET, SocketEventDescriptor>::value_type kv_pair;
BOOST_FOREACH(const kv_pair& desc, m_Sockets[tid]) {
for (const kv_pair& desc : m_Sockets[tid]) {
if (desc.second.Events == 0)
continue;
@ -113,7 +112,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
}
}
BOOST_FOREACH(const EventDescription& event, events) {
for (const EventDescription& event : events) {
try {
event.Descriptor.EventInterface->OnEvent(event.REvents);
} catch (const std::exception& ex) {

View File

@ -23,7 +23,6 @@
#include "base/application.hpp"
#include "base/scriptglobal.hpp"
#include <boost/thread/once.hpp>
#include <boost/foreach.hpp>
#include <map>
#ifdef __linux__
# include <sys/epoll.h>

View File

@ -24,7 +24,6 @@
#include "base/scriptframe.hpp"
#include "base/exception.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
@ -80,7 +79,7 @@ static Array::Ptr StringSplit(const String& delims)
boost::algorithm::split(tokens, self, boost::is_any_of(delims));
Array::Ptr result = new Array();
BOOST_FOREACH(const String& token, tokens) {
for (const String& token : tokens) {
result->Add(token);
}
return result;

View File

@ -439,6 +439,25 @@ inline bool operator!=(const char *lhs, const String& rhs)
return lhs != rhs.GetData();
}
inline String::Iterator begin(String& x)
{
return x.Begin();
}
inline String::ConstIterator begin(const String& x)
{
return x.Begin();
}
inline String::Iterator end(String& x)
{
return x.End();
}
inline String::ConstIterator end(const String& x)
{
return x.End();
}
inline String::Iterator range_begin(String& x)
{
return x.Begin();

View File

@ -34,7 +34,7 @@ void SyslogLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, ConfigType::GetObjectsByType<SyslogLogger>()) {
for (const SyslogLogger::Ptr& sysloglogger : ConfigType::GetObjectsByType<SyslogLogger>()) {
nodes->Set(sysloglogger->GetName(), 1); //add more stats
}

View File

@ -21,7 +21,6 @@
#include "base/debug.hpp"
#include "base/utility.hpp"
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
@ -223,7 +222,7 @@ void Timer::AdjustTimers(double adjustment)
std::vector<Timer *> timers;
BOOST_FOREACH(Timer *timer, idx) {
for (Timer *timer : idx) {
if (std::fabs(now - (timer->m_Next + adjustment)) <
std::fabs(now - timer->m_Next)) {
timer->m_Next += adjustment;
@ -231,7 +230,7 @@ void Timer::AdjustTimers(double adjustment)
}
}
BOOST_FOREACH(Timer *timer, timers) {
for (Timer *timer : timers) {
l_Timers.erase(timer);
l_Timers.insert(timer);
}

View File

@ -20,7 +20,6 @@
#include "base/type.hpp"
#include "base/scriptglobal.hpp"
#include "base/objectlock.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -72,11 +71,10 @@ std::vector<Type::Ptr> Type::GetAllTypes(void)
if (typesNS) {
ObjectLock olock(typesNS);
BOOST_FOREACH(const Dictionary::Pair& kv, typesNS) {
for (const Dictionary::Pair& kv : typesNS) {
if (kv.second.IsObjectType<Type>())
types.push_back(kv.second);
}
}
}
return types;

View File

@ -28,7 +28,6 @@
#include "base/objectlock.hpp"
#include <mmatch.h>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/trim.hpp>
@ -264,7 +263,7 @@ String Utility::DirName(const String& path)
String dupPath = path;
/* PathRemoveFileSpec doesn't properly handle forward slashes. */
BOOST_FOREACH(char& ch, dupPath) {
for (char& ch : dupPath) {
if (ch == '/')
ch = '\\';
}
@ -543,7 +542,7 @@ bool Utility::Glob(const String& pathSpec, const boost::function<void (const Str
if (!GlobHelper(part1, GlobDirectory, files2, dirs2))
return false;
BOOST_FOREACH(const String& dir, dirs2) {
for (const String& dir : dirs2) {
if (!Utility::Glob(dir + "/" + part2, callback, type))
return false;
}
@ -595,12 +594,12 @@ bool Utility::Glob(const String& pathSpec, const boost::function<void (const Str
#endif /* _WIN32 */
std::sort(files.begin(), files.end());
BOOST_FOREACH(const String& cpath, files) {
for (const String& cpath : files) {
callback(cpath);
}
std::sort(dirs.begin(), dirs.end());
BOOST_FOREACH(const String& cpath, dirs) {
for (const String& cpath : dirs) {
callback(cpath);
}
@ -721,17 +720,17 @@ bool Utility::GlobRecursive(const String& path, const String& pattern, const boo
#endif /* _WIN32 */
std::sort(files.begin(), files.end());
BOOST_FOREACH(const String& cpath, files) {
for (const String& cpath : files) {
callback(cpath);
}
std::sort(dirs.begin(), dirs.end());
BOOST_FOREACH(const String& cpath, dirs) {
for (const String& cpath : dirs) {
callback(cpath);
}
std::sort(alldirs.begin(), alldirs.end());
BOOST_FOREACH(const String& cpath, alldirs) {
for (const String& cpath : alldirs) {
GlobRecursive(cpath, pattern, callback, type);
}
@ -782,7 +781,7 @@ void Utility::RemoveDirRecursive(const String& path)
first before recursing into subdirectories. */
std::reverse(paths.begin(), paths.end());
BOOST_FOREACH(const String& path, paths) {
for (const String& path : paths) {
if (remove(path.CStr()) < 0)
BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("remove")
@ -945,7 +944,7 @@ String Utility::Join(const Array::Ptr& tokens, char separator, bool escapeSepara
bool first = true;
ObjectLock olock(tokens);
BOOST_FOREACH(const Value& vtoken, tokens) {
for (const Value& vtoken : tokens) {
String token = Convert::ToString(vtoken);
if (escapeSeparator) {
@ -1071,7 +1070,7 @@ String Utility::EscapeShellCmd(const String& s)
size_t prev_quote = String::NPos;
int index = -1;
BOOST_FOREACH(char ch, s) {
for (char ch : s) {
bool escape = false;
index++;
@ -1121,7 +1120,7 @@ String Utility::EscapeShellArg(const String& s)
result = "'";
#endif /* _WIN32 */
BOOST_FOREACH(char ch, s) {
for (char ch : s) {
#ifdef _WIN32
if (ch == '"' || ch == '%') {
result += ' ';
@ -1236,7 +1235,7 @@ unsigned long Utility::SDBM(const String& str, size_t len)
unsigned long hash = 0;
size_t current = 0;
BOOST_FOREACH(char c, str) {
for (char c : str) {
if (current >= len)
break;
@ -1424,7 +1423,7 @@ String Utility::EscapeString(const String& s, const String& chars, const bool il
{
std::ostringstream result;
if (illegal) {
BOOST_FOREACH(char ch, s) {
for (char ch : s) {
if (chars.FindFirstOf(ch) != String::NPos || ch == '%') {
result << '%';
HexEncode(ch, result);
@ -1432,7 +1431,7 @@ String Utility::EscapeString(const String& s, const String& chars, const bool il
result << ch;
}
} else {
BOOST_FOREACH(char ch, s) {
for (char ch : s) {
if (chars.FindFirstOf(ch) == String::NPos || ch == '%') {
result << '%';
HexEncode(ch, result);

View File

@ -24,7 +24,6 @@
#include "base/convert.hpp"
#include "base/utility.hpp"
#include "base/objectlock.hpp"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
using namespace icinga;
@ -297,10 +296,10 @@ Value icinga::operator-(const Value& lhs, const Value& rhs)
Array::Ptr right = rhs;
ObjectLock olock(left);
BOOST_FOREACH(const Value& lv, left) {
for (const Value& lv : left) {
bool found = false;
ObjectLock xlock(right);
BOOST_FOREACH(const Value& rv, right) {
for (const Value& rv : right) {
if (lv == rv) {
found = true;
break;

View File

@ -24,7 +24,6 @@
#include "base/application.hpp"
#include "base/exception.hpp"
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/tss.hpp>
using namespace icinga;
@ -173,7 +172,7 @@ void WorkQueue::ReportExceptions(const String& facility) const
{
std::vector<boost::exception_ptr> exceptions = GetExceptions();
BOOST_FOREACH(const boost::exception_ptr& eptr, exceptions) {
for (const auto& eptr : exceptions) {
Log(LogCritical, facility)
<< DiagnosticInformation(eptr);
}

View File

@ -30,7 +30,6 @@
#include "base/exception.hpp"
#include "base/convert.hpp"
#include "base/statsfunction.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -42,7 +41,7 @@ void CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const CheckerComponent::Ptr& checker, ConfigType::GetObjectsByType<CheckerComponent>()) {
for (const CheckerComponent::Ptr& checker : ConfigType::GetObjectsByType<CheckerComponent>()) {
unsigned long idle = checker->GetIdleCheckables();
unsigned long pending = checker->GetPendingCheckables();

View File

@ -27,7 +27,6 @@
#include "base/tlsutility.hpp"
#include "base/scriptglobal.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/case_conv.hpp>
@ -141,7 +140,7 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
files.push_back(csr);
files.push_back(cert);
BOOST_FOREACH(const String& file, files) {
for (const String& file : files) {
if (!Utility::SetFileOwnership(file, user, group)) {
Log(LogWarning, "cli")
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << file << "'.";

View File

@ -23,7 +23,6 @@
#include "base/serializer.hpp"
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/foreach.hpp>
#include <boost/program_options.hpp>
#include <algorithm>
#include <iostream>
@ -173,7 +172,7 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
std::vector<String> best_match;
int arg_end = 0;
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
for (const CLIKeyValue& kv : GetRegistry()) {
const std::vector<String>& vname = kv.first;
std::vector<String>::size_type i;
@ -234,7 +233,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
int arg_begin = 0;
CLICommand::Ptr command;
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
for (const CLIKeyValue& kv : GetRegistry()) {
const std::vector<String>& vname = kv.first;
arg_begin = 0;
@ -276,7 +275,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
} else
std::cout << "Supported commands: " << std::endl;
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
for (const CLIKeyValue& kv : GetRegistry()) {
const std::vector<String>& vname = kv.first;
if (vname.size() < best_match.size() || kv.second->IsHidden())
@ -345,25 +344,25 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
if (odesc->semantic()->min_tokens() == 0)
goto complete_option;
BOOST_FOREACH(const String& suggestion, globalArgCompletionCallback(odesc->long_name(), pword)) {
for (const String& suggestion : globalArgCompletionCallback(odesc->long_name(), pword)) {
std::cout << prefix << suggestion << "\n";
}
BOOST_FOREACH(const String& suggestion, command->GetArgumentSuggestions(odesc->long_name(), pword)) {
for (const String& suggestion : command->GetArgumentSuggestions(odesc->long_name(), pword)) {
std::cout << prefix << suggestion << "\n";
}
return;
complete_option:
BOOST_FOREACH(const boost::shared_ptr<po::option_description>& odesc, visibleDesc->options()) {
for (const boost::shared_ptr<po::option_description>& odesc : visibleDesc->options()) {
String cname = "--" + odesc->long_name();
if (cname.Find(aword) == 0)
std::cout << cname << "\n";
}
BOOST_FOREACH(const String& suggestion, command->GetPositionalSuggestions(aword)) {
for (const String& suggestion : command->GetPositionalSuggestions(aword)) {
std::cout << suggestion << "\n";
}
}

View File

@ -35,7 +35,6 @@
#include "config.h"
#include <boost/program_options.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
#include <iostream>
#include <fstream>

View File

@ -105,7 +105,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile);
if (!configs.empty()) {
BOOST_FOREACH(const String& configPath, configs) {
for (const String& configPath : configs) {
Expression *expression = ConfigCompiler::CompileFile(configPath, String(), "_etc");
success = ExecuteExpression(expression);
delete expression;

View File

@ -22,7 +22,6 @@
#include "base/logger.hpp"
#include "base/convert.hpp"
#include "base/console.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <iostream>

View File

@ -21,7 +21,6 @@
#include "base/logger.hpp"
#include "base/console.hpp"
#include "base/application.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <fstream>
@ -48,7 +47,7 @@ std::vector<String> FeatureUtility::GetFieldCompletionSuggestions(const String&
std::sort(cache.begin(), cache.end());
BOOST_FOREACH(const String& suggestion, cache) {
for (const String& suggestion : cache) {
if (suggestion.Find(word) == 0)
suggestions.push_back(suggestion);
}
@ -75,7 +74,7 @@ int FeatureUtility::EnableFeatures(const std::vector<std::string>& features)
std::vector<std::string> errors;
BOOST_FOREACH(const String& feature, features) {
for (const String& feature : features) {
String source = features_available_dir + "/" + feature + ".conf";
if (!Utility::PathExists(source) ) {
@ -143,7 +142,7 @@ int FeatureUtility::DisableFeatures(const std::vector<std::string>& features)
std::vector<std::string> errors;
BOOST_FOREACH(const String& feature, features) {
for (const String& feature : features) {
String target = features_enabled_dir + "/" + feature + ".conf";
if (!Utility::PathExists(target) ) {
@ -242,7 +241,7 @@ bool FeatureUtility::CheckFeatureInternal(const String& feature, bool check_disa
if (!FeatureUtility::GetFeatures(features, check_disabled))
return false;
BOOST_FOREACH(const String& check_feature, features) {
for (const String& check_feature : features) {
if (check_feature == feature)
return true;
}

View File

@ -21,7 +21,6 @@
#include "cli/nodeutility.hpp"
#include "base/logger.hpp"
#include "base/application.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <iostream>

View File

@ -23,7 +23,6 @@
#include "base/application.hpp"
#include "base/objectlock.hpp"
#include "base/json.hpp"
#include <boost/foreach.hpp>
#include <iostream>
#include <fstream>

View File

@ -22,7 +22,6 @@
#include "base/logger.hpp"
#include "base/application.hpp"
#include "base/console.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <iostream>

View File

@ -21,7 +21,6 @@
#include "cli/nodeutility.hpp"
#include "base/logger.hpp"
#include "base/application.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <iostream>
@ -65,7 +64,7 @@ int NodeRemoveCommand::GetMaxArguments(void) const
*/
int NodeRemoveCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
{
BOOST_FOREACH(const String& node, ap) {
for (const String& node : ap) {
NodeUtility::RemoveNode(node);
}

View File

@ -21,7 +21,6 @@
#include "cli/nodeutility.hpp"
#include "base/logger.hpp"
#include "base/application.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <iostream>

View File

@ -28,7 +28,6 @@
#include "base/tlsutility.hpp"
#include "base/scriptglobal.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>

View File

@ -27,7 +27,6 @@
#include "base/tlsutility.hpp"
#include "base/json.hpp"
#include "base/objectlock.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <iostream>
@ -93,7 +92,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
std::vector<Dictionary::Ptr> nodes = NodeUtility::GetNodes();
/* first make sure that all nodes are valid and should not be removed */
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {
for (const Dictionary::Ptr& node : nodes) {
Dictionary::Ptr repository = node->Get("repository");
String zone = node->Get("zone");
String endpoint = node->Get("endpoint");
@ -106,7 +105,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
if (old_inventory) {
/* check if there are objects inside the old_inventory which do not exist anymore */
ObjectLock ulock(old_inventory);
BOOST_FOREACH(const Dictionary::Pair& old_node_objs, old_inventory) {
for (const Dictionary::Pair& old_node_objs : old_inventory) {
String old_node_name = old_node_objs.first;
@ -121,7 +120,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
if (old_node_repository) {
ObjectLock olock(old_node_repository);
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
for (const Dictionary::Pair& kv : old_node_repository) {
String host = kv.first;
Dictionary::Ptr host_attrs = new Dictionary();
@ -150,7 +149,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
if (old_node_repository) {
ObjectLock xlock(old_node_repository);
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
for (const Dictionary::Pair& kv : old_node_repository) {
String old_host = kv.first;
if (old_host == "localhost") {
@ -180,7 +179,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
Array::Ptr new_services = new_node_repository->Get(old_host);
ObjectLock ylock(old_services);
BOOST_FOREACH(const String& old_service, old_services) {
for (const String& old_service : old_services) {
/* check against black/whitelist before trying to remove service */
if (NodeUtility::CheckAgainstBlackAndWhiteList("blacklist", old_node_name, old_host, old_service) &&
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", old_node_name, old_host, old_service)) {
@ -209,7 +208,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
}
/* next iterate over all nodes and add hosts/services */
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {
for (const Dictionary::Ptr& node : nodes) {
Dictionary::Ptr repository = node->Get("repository");
String zone = node->Get("zone");
String endpoint = node->Get("endpoint");
@ -242,7 +241,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
if (repository) {
ObjectLock olock(repository);
BOOST_FOREACH(const Dictionary::Pair& kv, repository) {
for (const Dictionary::Pair& kv : repository) {
String host = kv.first;
String host_pattern = host + ".conf";
bool skip_host = false;
@ -253,7 +252,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
continue;
}
BOOST_FOREACH(const String& object_path, object_paths) {
for (const String& object_path : object_paths) {
if (object_path.Contains(host_pattern)) {
Log(LogNotice, "cli")
<< "Host '" << host << "' already exists.";
@ -313,12 +312,12 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
}
ObjectLock xlock(services);
BOOST_FOREACH(const String& service, services) {
for (const String& service : services) {
bool skip_service = false;
String service_pattern = host + "/" + service + ".conf";
BOOST_FOREACH(const String& object_path, object_paths) {
for (const String& object_path : object_paths) {
if (object_path.Contains(service_pattern)) {
Log(LogNotice, "cli")
<< "Service '" << service << "' on Host '" << host << "' already exists.";

View File

@ -34,7 +34,6 @@
#include "base/console.hpp"
#include "base/exception.hpp"
#include "base/configwriter.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
@ -77,7 +76,7 @@ std::vector<String> NodeUtility::GetNodeCompletionSuggestions(const String& word
{
std::vector<String> suggestions;
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
for (const Dictionary::Ptr& node : GetNodes()) {
String node_name = node->Get("endpoint");
if (node_name.Find(word) == 0)
@ -91,7 +90,7 @@ void NodeUtility::PrintNodes(std::ostream& fp)
{
bool first = true;
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
for (const Dictionary::Ptr& node : GetNodes()) {
if (first)
first = false;
else
@ -126,13 +125,13 @@ void NodeUtility::PrintNodeRepository(std::ostream& fp, const Dictionary::Ptr& r
return;
ObjectLock olock(repository);
BOOST_FOREACH(const Dictionary::Pair& kv, repository) {
for (const Dictionary::Pair& kv : repository) {
fp << std::setw(4) << " "
<< "* Host '" << ConsoleColorTag(Console_ForegroundGreen | Console_Bold) << kv.first << ConsoleColorTag(Console_Normal) << "'\n";
Array::Ptr services = kv.second;
ObjectLock xlock(services);
BOOST_FOREACH(const String& service, services) {
for (const String& service : services) {
fp << std::setw(8) << " " << "* Service '" << ConsoleColorTag(Console_ForegroundGreen | Console_Bold) << service << ConsoleColorTag(Console_Normal) << "'\n";
}
}
@ -142,7 +141,7 @@ void NodeUtility::PrintNodesJson(std::ostream& fp)
{
Dictionary::Ptr result = new Dictionary();
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
for (const Dictionary::Ptr& node : GetNodes()) {
result->Set(node->Get("endpoint"), node);
}
@ -264,7 +263,7 @@ int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoi
String master_zone_name = "master"; //TODO: Find a better name.
BOOST_FOREACH(const std::string& endpoint, endpoints) {
for (const std::string& endpoint : endpoints) {
/* extract all --endpoint arguments and store host,port info */
std::vector<String> tokens;
@ -394,7 +393,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
fp << " */\n\n";
ObjectLock olock(objects);
BOOST_FOREACH(const Dictionary::Ptr& object, objects) {
for (const Dictionary::Ptr& object : objects) {
SerializeObject(fp, object);
}
@ -443,7 +442,7 @@ int NodeUtility::UpdateBlackAndWhiteList(const String& type, const String& zone_
{
ObjectLock olock(lists);
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
for (const Dictionary::Ptr& filter : lists) {
if (filter->Get("zone") == zone_filter) {
if (filter->Get("host") == host_filter && service_filter.IsEmpty()) {
@ -484,7 +483,7 @@ int NodeUtility::RemoveBlackAndWhiteList(const String& type, const String& zone_
{
ObjectLock olock(lists);
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
for (const Dictionary::Ptr& filter : lists) {
if (filter->Get("zone") == zone_filter) {
if (filter->Get("host") == host_filter && service_filter.IsEmpty()) {
@ -509,7 +508,7 @@ int NodeUtility::RemoveBlackAndWhiteList(const String& type, const String& zone_
return 1;
}
BOOST_FOREACH(int remove, remove_filters) {
for (int remove : remove_filters) {
lists->Remove(remove);
}
@ -530,7 +529,7 @@ int NodeUtility::PrintBlackAndWhiteList(std::ostream& fp, const String& type)
fp << "Listing all " << type << " entries:\n";
ObjectLock olock(lists);
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
for (const Dictionary::Ptr& filter : lists) {
fp << type << " filter for Node: '" << filter->Get("zone") << "' Host: '"
<< filter->Get("host") << "' Service: '" << filter->Get("service") << "'.\n";
}
@ -546,7 +545,7 @@ bool NodeUtility::CheckAgainstBlackAndWhiteList(const String& type, const String
<< "Checking object against " << type << ".";
ObjectLock olock(lists);
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
for (const Dictionary::Ptr& filter : lists) {
String zone_filter = filter->Get("zone");
String host_filter = filter->Get("host");
String service_filter;
@ -620,7 +619,7 @@ void NodeUtility::SerializeObject(std::ostream& fp, const Dictionary::Ptr& objec
fp << " {\n";
ObjectLock olock(object);
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
for (const Dictionary::Pair& kv : object) {
if (kv.first == "__type" || kv.first == "__name")
continue;

View File

@ -28,7 +28,6 @@
#include "base/tlsutility.hpp"
#include "base/scriptglobal.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/case_conv.hpp>

View File

@ -30,7 +30,6 @@
#include "base/debug.hpp"
#include "base/objectlock.hpp"
#include "base/console.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <fstream>
@ -129,7 +128,7 @@ void ObjectListCommand::PrintTypeCounts(std::ostream& fp, const std::map<String,
{
typedef std::map<String, int>::value_type TypeCount;
BOOST_FOREACH(const TypeCount& kv, type_count) {
for (const TypeCount& kv : type_count) {
fp << "Found " << kv.second << " " << kv.first << " object";
if (kv.second != 1)

View File

@ -23,7 +23,6 @@
#include "base/console.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
#include <iostream>
#include <iomanip>
@ -77,7 +76,7 @@ void ObjectListUtility::PrintProperties(std::ostream& fp, const Dictionary::Ptr&
int offset = 2;
ObjectLock olock(props);
BOOST_FOREACH(const Dictionary::Pair& kv, props)
for (const Dictionary::Pair& kv : props)
{
String key = kv.first;
Value val = kv.second;
@ -114,7 +113,7 @@ void ObjectListUtility::PrintHints(std::ostream& fp, const Dictionary::Ptr& debu
if (messages) {
ObjectLock olock(messages);
BOOST_FOREACH(const Value& msg, messages)
for (const Value& msg : messages)
{
PrintHint(fp, msg, indent);
}
@ -155,7 +154,7 @@ void ObjectListUtility::PrintArray(std::ostream& fp, const Array::Ptr& arr)
if (arr) {
ObjectLock olock(arr);
BOOST_FOREACH(const Value& value, arr)
for (const Value& value : arr)
{
if (first)
first = false;

View File

@ -22,7 +22,6 @@
#include "base/logger.hpp"
#include "base/application.hpp"
#include "base/utility.hpp"
#include <boost/foreach.hpp>
#include <fstream>
#include <iostream>
@ -164,7 +163,7 @@ int RepositoryObjectCommand::Run(const boost::program_options::variables_map& vm
if (vm.count("import")) {
Array::Ptr imports = new Array();
BOOST_FOREACH(const String& import, vm["import"].as<std::vector<std::string> >()) {
for (const String& import : vm["import"].as<std::vector<std::string> >()) {
imports->Add(import);
}

View File

@ -33,7 +33,6 @@
#include "base/console.hpp"
#include "base/serializer.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
@ -49,7 +48,7 @@ Dictionary::Ptr RepositoryUtility::GetArgumentAttributes(const std::vector<std::
{
Dictionary::Ptr attrs = new Dictionary();
BOOST_FOREACH(const String& kv, arguments) {
for (const String& kv : arguments) {
std::vector<String> tokens;
boost::algorithm::split(tokens, kv, boost::is_any_of("="));
@ -144,7 +143,7 @@ void RepositoryUtility::PrintObjects(std::ostream& fp, const String& type)
{
std::vector<String> objects = GetObjects(); //full path
BOOST_FOREACH(const String& object, objects) {
for (const String& object : objects) {
if (!FilterRepositoryObjects(type, object)) {
Log(LogDebug, "cli")
<< "Ignoring object '" << object << "'. Type '" << type << "' does not match.";
@ -184,7 +183,7 @@ void RepositoryUtility::PrintChangeLog(std::ostream& fp)
std::cout << "Changes to be committed:\n\n";
BOOST_FOREACH(const Value& entry, changelog) {
for (const Value& entry : changelog) {
FormatChangelogEntry(std::cout, entry);
}
}
@ -209,7 +208,7 @@ bool RepositoryUtility::AddObject(const std::vector<String>& object_paths, const
else
pattern = EscapeName(name) + ".conf";
BOOST_FOREACH(const String& object_path, object_paths) {
for (const String& object_path : object_paths) {
if (object_path.Contains(pattern)) {
Log(LogWarning, "cli")
<< type << " '" << name << "' already exists. Skipping creation.";
@ -303,7 +302,7 @@ bool RepositoryUtility::CheckChangeExists(const Dictionary::Ptr& change, const A
Dictionary::Ptr attrs = change->Get("attrs");
ObjectLock olock(changes);
BOOST_FOREACH(const Dictionary::Ptr& entry, changes) {
for (const Dictionary::Ptr& entry : changes) {
if (entry->Get("type") != change->Get("type"))
continue;
@ -432,7 +431,7 @@ bool RepositoryUtility::RemoveObjectInternal(const String& name, const String& t
boost::bind(&RepositoryUtility::CollectObjects, _1, boost::ref(files)), GlobFile);
BOOST_FOREACH(const String& file, files) {
for (const String& file : files) {
RemoveObjectFileInternal(file);
}
#ifndef _WIN32
@ -569,7 +568,7 @@ bool RepositoryUtility::GetChangeLog(const boost::function<void (const Dictionar
/* sort by timestamp ascending */
std::sort(changelog.begin(), changelog.end());
BOOST_FOREACH(const String& entry, changelog) {
for (const String& entry : changelog) {
String file = path + entry + ".change";
Dictionary::Ptr change = GetObjectFromRepositoryChangeLog(file);
@ -664,7 +663,7 @@ void RepositoryUtility::FormatChangelogEntry(std::ostream& fp, const Dictionary:
fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << change->Get("name") << ConsoleColorTag(Console_Normal) << "'\n";
ObjectLock olock(attrs);
BOOST_FOREACH(const Dictionary::Pair& kv, attrs) {
for (const Dictionary::Pair& kv : attrs) {
/* skip the name */
if (kv.first == "name" || kv.first == "__name")
continue;
@ -694,7 +693,7 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co
Array::Ptr imports = object->Get("import");
ObjectLock olock(imports);
BOOST_FOREACH(const String& import, imports) {
for (const String& import : imports) {
fp << "\t" << "import ";
ConfigWriter::EmitString(fp, import);
fp << '\n';
@ -702,7 +701,7 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co
}
ObjectLock xlock(object);
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
for (const Dictionary::Pair& kv : object) {
if (kv.first == "import" || kv.first == "name" || kv.first == "__name") {
continue;
} else {

View File

@ -34,7 +34,6 @@
#include <boost/algorithm/string/join.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <fstream>
#include <iostream>
@ -325,9 +324,9 @@ bool TroubleshootCommand::CheckFeatures(InfoLog& log)
return false;
}
BOOST_FOREACH(const String feature, disabled_features)
for (const String feature : disabled_features)
features->Set(feature, false);
BOOST_FOREACH(const String feature, enabled_features)
for (const String feature : enabled_features)
features->Set(feature, true);
InfoLogLine(log)
@ -518,7 +517,7 @@ void TroubleshootCommand::CheckObjectFile(const String& objectfile, InfoLog& log
Dictionary::Ptr properties = object->Get("properties");
ObjectLock olock(properties);
BOOST_FOREACH(const Dictionary::Pair& kv, properties) {
for (const Dictionary::Pair& kv : properties) {
if (Utility::Match(kv.first, "path"))
logs->Set(name, kv.second);
}
@ -540,7 +539,7 @@ void TroubleshootCommand::CheckObjectFile(const String& objectfile, InfoLog& log
<< "Found the " << countTotal << " objects:\n"
<< " Type" << std::string(typeL-4, ' ') << " : Count\n";
BOOST_FOREACH(const Dictionary::Pair& kv, type_count) {
for (const Dictionary::Pair& kv : type_count) {
InfoLogLine(log)
<< " " << kv.first << std::string(typeL - kv.first.GetLength(), ' ')
<< " : " << kv.second << '\n';
@ -577,7 +576,7 @@ void TroubleshootCommand::PrintLoggers(InfoLog& log, Dictionary::Ptr& logs)
<< "Getting the last 20 lines of " << logs->GetLength() << " FileLogger objects.\n";
ObjectLock ulock(logs);
BOOST_FOREACH(const Dictionary::Pair& kv, logs) {
for (const Dictionary::Pair& kv : logs) {
InfoLogLine(log)
<< "Logger " << kv.first << " at path: " << kv.second << '\n';

View File

@ -31,7 +31,6 @@
#include "base/objectlock.hpp"
#include "base/console.hpp"
#include "base/scriptglobal.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <fstream>

View File

@ -26,7 +26,6 @@
#include "base/debug.hpp"
#include "base/objectlock.hpp"
#include "base/console.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <fstream>

View File

@ -44,7 +44,7 @@ void CheckResultReader::StatsFunc(const Dictionary::Ptr& status, const Array::Pt
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, ConfigType::GetObjectsByType<CheckResultReader>()) {
for (const CheckResultReader::Ptr& checkresultreader : ConfigType::GetObjectsByType<CheckResultReader>()) {
nodes->Set(checkresultreader->GetName(), 1); //add more stats
}

View File

@ -34,7 +34,6 @@
#include "base/application.hpp"
#include "base/utility.hpp"
#include "base/statsfunction.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
using namespace icinga;
@ -47,7 +46,7 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, ConfigType::GetObjectsByType<CompatLogger>()) {
for (const CompatLogger::Ptr& compat_logger : ConfigType::GetObjectsByType<CompatLogger>()) {
nodes->Set(compat_logger->GetName(), 1); //add more stats
}
@ -476,7 +475,7 @@ void CompatLogger::ReopenFile(bool rotate)
WriteLine("LOG ROTATION: " + GetRotationMethod());
WriteLine("LOG VERSION: 2.0");
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
String output;
CheckResult::Ptr cr = host->GetLastCheckResult();
@ -494,7 +493,7 @@ void CompatLogger::ReopenFile(bool rotate)
WriteLine(msgbuf.str());
}
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
Host::Ptr host = service->GetHost();
String output;

View File

@ -36,7 +36,7 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, ConfigType::GetObjectsByType<ExternalCommandListener>()) {
for (const ExternalCommandListener::Ptr& externalcommandlistener : ConfigType::GetObjectsByType<ExternalCommandListener>()) {
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
}

View File

@ -38,7 +38,6 @@
#include "base/application.hpp"
#include "base/context.hpp"
#include "base/statsfunction.hpp"
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
@ -54,7 +53,7 @@ void StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, ConfigType::GetObjectsByType<StatusDataWriter>()) {
for (const StatusDataWriter::Ptr& statusdatawriter : ConfigType::GetObjectsByType<StatusDataWriter>()) {
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
}
@ -92,7 +91,7 @@ void StatusDataWriter::DumpComments(std::ostream& fp, const Checkable::Ptr& chec
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
BOOST_FOREACH(const Comment::Ptr& comment, checkable->GetComments()) {
for (const Comment::Ptr& comment : checkable->GetComments()) {
if (comment->IsExpired())
continue;
@ -126,7 +125,7 @@ void StatusDataWriter::DumpTimePeriod(std::ostream& fp, const TimePeriod::Ptr& t
if (ranges) {
ObjectLock olock(ranges);
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
for (const Dictionary::Pair& kv : ranges) {
fp << "\t" << kv.first << "\t" << kv.second << "\n";
}
}
@ -158,7 +157,7 @@ void StatusDataWriter::DumpDowntimes(std::ostream& fp, const Checkable::Ptr& che
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
BOOST_FOREACH(const Downtime::Ptr& downtime, checkable->GetDowntimes()) {
for (const Downtime::Ptr& downtime : checkable->GetDowntimes()) {
if (downtime->IsExpired())
continue;
@ -296,7 +295,7 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {
for (const String& name : groups) {
HostGroup::Ptr hg = HostGroup::GetByName(name);
if (hg) {
@ -481,7 +480,7 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {
for (const String& name : groups) {
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
if (sg) {
@ -513,7 +512,7 @@ void StatusDataWriter::DumpCustomAttributes(std::ostream& fp, const CustomVarObj
bool is_json = false;
ObjectLock olock(vars);
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
for (const Dictionary::Pair& kv : vars) {
if (kv.first.IsEmpty())
continue;
@ -547,13 +546,13 @@ void StatusDataWriter::UpdateObjectsCache(void)
"# This file is auto-generated. Do not modify this file." "\n"
"\n";
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
DumpHostObject(tempobjectfp, host);
objectfp << tempobjectfp.str();
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
for (const Service::Ptr& service : host->GetServices()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
DumpServiceObject(tempobjectfp, service);
@ -561,7 +560,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
}
}
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
for (const HostGroup::Ptr& hg : ConfigType::GetObjectsByType<HostGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -592,7 +591,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType<ServiceGroup>()) {
for (const ServiceGroup::Ptr& sg : ConfigType::GetObjectsByType<ServiceGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -618,7 +617,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
tempobjectfp << "\t" "members" "\t";
std::vector<String> sglist;
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
for (const Service::Ptr& service : sg->GetMembers()) {
Host::Ptr host = service->GetHost();
sglist.push_back(host->GetName());
@ -633,7 +632,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType<User>()) {
for (const User::Ptr& user : ConfigType::GetObjectsByType<User>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -661,7 +660,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType<UserGroup>()) {
for (const UserGroup::Ptr& ug : ConfigType::GetObjectsByType<UserGroup>()) {
std::ostringstream tempobjectfp;
tempobjectfp << std::fixed;
@ -677,23 +676,23 @@ void StatusDataWriter::UpdateObjectsCache(void)
objectfp << tempobjectfp.str();
}
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<CheckCommand>()) {
for (const Command::Ptr& command : ConfigType::GetObjectsByType<CheckCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<NotificationCommand>()) {
for (const Command::Ptr& command : ConfigType::GetObjectsByType<NotificationCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<EventCommand>()) {
for (const Command::Ptr& command : ConfigType::GetObjectsByType<EventCommand>()) {
DumpCommand(objectfp, command);
}
BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
for (const TimePeriod::Ptr& tp : ConfigType::GetObjectsByType<TimePeriod>()) {
DumpTimePeriod(objectfp, tp);
}
BOOST_FOREACH(const Dependency::Ptr& dep, ConfigType::GetObjectsByType<Dependency>()) {
for (const Dependency::Ptr& dep : ConfigType::GetObjectsByType<Dependency>()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
@ -824,13 +823,13 @@ void StatusDataWriter::StatusTimerHandler(void)
statusfp << "\t" "}" "\n"
"\n";
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
std::ostringstream tempstatusfp;
tempstatusfp << std::fixed;
DumpHostStatus(tempstatusfp, host);
statusfp << tempstatusfp.str();
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
for (const Service::Ptr& service : host->GetServices()) {
std::ostringstream tempstatusfp;
tempstatusfp << std::fixed;
DumpServiceStatus(tempstatusfp, service);

View File

@ -19,7 +19,6 @@
#include "config/applyrule.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
#include <set>
using namespace icinga;
@ -121,7 +120,7 @@ bool ApplyRule::IsValidTargetType(const String& sourceType, const String& target
if (it->second.size() == 1 && targetType == "")
return true;
BOOST_FOREACH(const String& type, it->second) {
for (const String& type : it->second) {
if (type == targetType)
return true;
}
@ -161,8 +160,8 @@ std::vector<ApplyRule>& ApplyRule::GetRules(const String& type)
void ApplyRule::CheckMatches(void)
{
BOOST_FOREACH(const RuleMap::value_type& kv, m_Rules) {
BOOST_FOREACH(const ApplyRule& rule, kv.second) {
for (const RuleMap::value_type& kv : m_Rules) {
for (const ApplyRule& rule : kv.second) {
if (!rule.HasMatches())
Log(LogWarning, "ApplyRule")
<< "Apply rule '" << rule.GetName() << "' (" << rule.GetDebugInfo() << ") for type '" << kv.first << "' does not match anywhere!";

View File

@ -32,7 +32,6 @@
#include "base/exception.hpp"
#include <sstream>
#include <stack>
#include <boost/foreach.hpp>
#define YYLTYPE icinga::CompilerDebugInfo
#define YYERROR_VERBOSE
@ -280,9 +279,8 @@ Expression *ConfigCompiler::Compile(void)
m_IgnoreNewlines.pop();
std::vector<Expression *> dlist;
typedef std::pair<Expression *, EItemInfo> EListItem;
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
BOOST_FOREACH(const EListItem& litem, llist) {
for (const auto& litem : llist) {
if (!litem.second.SideEffect && num != llist.size() - 1) {
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
}
@ -732,7 +730,7 @@ rterm_dict: '{'
std::vector<Expression *> dlist;
typedef std::pair<Expression *, EItemInfo> EListItem;
int num = 0;
BOOST_FOREACH(const EListItem& litem, *$3) {
for (const EListItem& litem : *$3) {
if (!litem.second.SideEffect)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
dlist.push_back(litem.first);
@ -755,7 +753,7 @@ rterm_scope_require_side_effect: '{'
std::vector<Expression *> dlist;
typedef std::pair<Expression *, EItemInfo> EListItem;
int num = 0;
BOOST_FOREACH(const EListItem& litem, *$3) {
for (const EListItem& litem : *$3) {
if (!litem.second.SideEffect)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
dlist.push_back(litem.first);
@ -779,7 +777,7 @@ rterm_scope: '{'
std::vector<Expression *> dlist;
typedef std::pair<Expression *, EItemInfo> EListItem;
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
BOOST_FOREACH(const EListItem& litem, *$3) {
for (const EListItem& litem : *$3) {
if (!litem.second.SideEffect && num != $3->size() - 1)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
dlist.push_back(litem.first);
@ -1007,7 +1005,7 @@ rterm_no_side_effect_no_dict: T_STRING
std::vector<Expression *> dlist;
typedef std::pair<Expression *, EItemInfo> EListItem;
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
BOOST_FOREACH(const EListItem& litem, *$3) {
for (const EListItem& litem : *$3) {
if (!litem.second.SideEffect && num != $3->size() - 1)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
dlist.push_back(litem.first);

View File

@ -25,7 +25,6 @@
#include "base/context.hpp"
#include "base/exception.hpp"
#include <fstream>
#include <boost/foreach.hpp>
using namespace icinga;
@ -144,7 +143,7 @@ Expression *ConfigCompiler::HandleInclude(const String& relativeBase, const Stri
String includePath = upath;
if (search) {
BOOST_FOREACH(const String& dir, m_IncludeSearchDirs) {
for (const String& dir : m_IncludeSearchDirs) {
String spath = dir + "/" + path;
if (Utility::PathExists(spath)) {
@ -341,7 +340,7 @@ bool ConfigCompiler::HasZoneConfigAuthority(const String& zoneName)
if (!empty) {
std::vector<String> paths;
BOOST_FOREACH(const ZoneFragment& zf, zoneDirs) {
for (const ZoneFragment& zf : zoneDirs) {
paths.push_back(zf.Path);
}

View File

@ -22,7 +22,6 @@
#include "base/json.hpp"
#include "base/netstring.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -37,7 +37,6 @@
#include "base/function.hpp"
#include <sstream>
#include <fstream>
#include <boost/foreach.hpp>
using namespace icinga;
@ -409,8 +408,8 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
{
boost::mutex::scoped_lock lock(m_Mutex);
BOOST_FOREACH(const TypeMap::value_type& kv, m_Items) {
BOOST_FOREACH(const ItemMap::value_type& kv2, kv.second) {
for (const TypeMap::value_type& kv : m_Items) {
for (const ItemMap::value_type& kv2 : kv.second) {
if (kv2.second->m_Abstract || kv2.second->m_Object)
continue;
@ -423,7 +422,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
ItemList newUnnamedItems;
BOOST_FOREACH(const ConfigItem::Ptr& item, m_UnnamedItems) {
for (const ConfigItem::Ptr& item : m_UnnamedItems) {
if (item->m_ActivationContext != context) {
newUnnamedItems.push_back(item);
continue;
@ -441,7 +440,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
if (items.empty())
return true;
BOOST_FOREACH(const ItemPair& ip, items) {
for (const ItemPair& ip : items) {
newItems.push_back(ip.first);
upq.Enqueue(boost::bind(&ConfigItem::Commit, ip.first, ip.second));
}
@ -453,7 +452,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
std::set<String> types;
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
for (const Type::Ptr& type : Type::GetAllTypes()) {
if (ConfigObject::TypeInstance->IsAssignableFrom(type))
types.insert(type->GetName());
}
@ -461,7 +460,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
std::set<String> completed_types;
while (types.size() != completed_types.size()) {
BOOST_FOREACH(const String& type, types) {
for (const String& type : types) {
if (completed_types.find(type) != completed_types.end())
continue;
@ -469,7 +468,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
bool unresolved_dep = false;
/* skip this type (for now) if there are unresolved load dependencies */
BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) {
for (const String& loadDep : ptype->GetLoadDependencies()) {
if (types.find(loadDep) != types.end() && completed_types.find(loadDep) == completed_types.end()) {
unresolved_dep = true;
break;
@ -479,7 +478,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
if (unresolved_dep)
continue;
BOOST_FOREACH(const ItemPair& ip, items) {
for (const ItemPair& ip : items) {
const ConfigItem::Ptr& item = ip.first;
if (!item->m_Object)
@ -496,8 +495,8 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
if (upq.HasExceptions())
return false;
BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) {
BOOST_FOREACH(const ItemPair& ip, items) {
for (const String& loadDep : ptype->GetLoadDependencies()) {
for (const ItemPair& ip : items) {
const ConfigItem::Ptr& item = ip.first;
if (!item->m_Object)
@ -529,7 +528,7 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
if (!CommitNewItems(context, upq, newItems)) {
upq.ReportExceptions("config");
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
for (const ConfigItem::Ptr& item : newItems) {
item->Unregister();
}
@ -542,14 +541,14 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
/* log stats for external parsers */
typedef std::map<Type::Ptr, int> ItemCountMap;
ItemCountMap itemCounts;
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
for (const ConfigItem::Ptr& item : newItems) {
if (!item->m_Object)
continue;
itemCounts[item->m_Object->GetReflectionType()]++;
}
BOOST_FOREACH(const ItemCountMap::value_type& kv, itemCounts) {
for (const ItemCountMap::value_type& kv : itemCounts) {
Log(LogInformation, "ConfigItem")
<< "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << ".";
}
@ -566,7 +565,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
if (!silent)
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
for (const ConfigItem::Ptr& item : newItems) {
if (!item->m_Object)
continue;
@ -590,7 +589,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
}
#ifdef I2_DEBUG
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
for (const ConfigItem::Ptr& item : newItems) {
ConfigObject::Ptr object = item->m_Object;
if (!object)
@ -640,7 +639,7 @@ std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const String& type)
if (it == m_Items.end())
return items;
BOOST_FOREACH(const ItemMap::value_type& kv, it->second)
for (const ItemMap::value_type& kv : it->second)
{
items.push_back(kv.second);
}
@ -652,7 +651,7 @@ void ConfigItem::RemoveIgnoredItems(const String& allowedConfigPath)
{
boost::mutex::scoped_lock lock(m_Mutex);
BOOST_FOREACH(const String& path, m_IgnoredItems) {
for (const String& path : m_IgnoredItems) {
if (path.Find(allowedConfigPath) == String::NPos)
continue;

View File

@ -20,7 +20,6 @@
#include "config/configitembuilder.hpp"
#include "base/configtype.hpp"
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/smart_ptr/make_shared.hpp>
using namespace icinga;

View File

@ -28,7 +28,6 @@
#include "base/exception.hpp"
#include "base/scriptglobal.hpp"
#include "base/loader.hpp"
#include <boost/foreach.hpp>
#include <boost/exception_ptr.hpp>
#include <boost/exception/errinfo_nested_exception.hpp>
@ -429,7 +428,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
if (vfunc.IsObjectType<Type>()) {
std::vector<Value> arguments;
BOOST_FOREACH(Expression *arg, m_Args) {
for (Expression *arg : m_Args) {
ExpressionResult argres = arg->Evaluate(frame);
CHECK_RESULT(argres);
@ -448,7 +447,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
BOOST_THROW_EXCEPTION(ScriptError("Function is not marked as safe for sandbox mode.", m_DebugInfo));
std::vector<Value> arguments;
BOOST_FOREACH(Expression *arg, m_Args) {
for (Expression *arg : m_Args) {
ExpressionResult argres = arg->Evaluate(frame);
CHECK_RESULT(argres);
@ -462,7 +461,7 @@ ExpressionResult ArrayExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhin
{
Array::Ptr result = new Array();
BOOST_FOREACH(Expression *aexpr, m_Expressions) {
for (Expression *aexpr : m_Expressions) {
ExpressionResult element = aexpr->Evaluate(frame);
CHECK_RESULT(element);
@ -484,7 +483,7 @@ ExpressionResult DictExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint
Value result;
try {
BOOST_FOREACH(Expression *aexpr, m_Expressions) {
for (Expression *aexpr : m_Expressions) {
ExpressionResult element = aexpr->Evaluate(frame, dhint);
CHECK_RESULT(element);
result = element.GetValue();
@ -686,7 +685,7 @@ void icinga::BindToScope(Expression *& expr, ScopeSpecifier scopeSpec)
DictExpression *dexpr = dynamic_cast<DictExpression *>(expr);
if (dexpr) {
BOOST_FOREACH(Expression *& expr, dexpr->m_Expressions)
for (Expression *& expr : dexpr->m_Expressions)
BindToScope(expr, scopeSpec);
return;

View File

@ -28,7 +28,6 @@
#include "base/exception.hpp"
#include "base/scriptframe.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
#include <boost/thread/future.hpp>
#include <map>
@ -574,7 +573,7 @@ public:
{
delete m_FName;
BOOST_FOREACH(Expression *expr, m_Args)
for (Expression *expr : m_Args)
delete expr;
}
@ -595,7 +594,7 @@ public:
~ArrayExpression(void)
{
BOOST_FOREACH(Expression *expr, m_Expressions)
for (Expression *expr : m_Expressions)
delete expr;
}
@ -615,7 +614,7 @@ public:
~DictExpression(void)
{
BOOST_FOREACH(Expression *expr, m_Expressions)
for (Expression *expr : m_Expressions)
delete expr;
}
@ -806,7 +805,7 @@ public:
{
if (m_ClosedVars) {
typedef std::pair<String, Expression *> kv_pair;
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
for (const kv_pair& kv : *m_ClosedVars) {
delete kv.second;
}
}
@ -843,7 +842,7 @@ public:
if (m_ClosedVars) {
typedef std::pair<String, Expression *> kv_pair;
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
for (const kv_pair& kv : *m_ClosedVars) {
delete kv.second;
}
}
@ -885,7 +884,7 @@ public:
if (m_ClosedVars) {
typedef std::pair<String, Expression *> kv_pair;
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
for (const kv_pair& kv : *m_ClosedVars) {
delete kv.second;
}
}

View File

@ -18,7 +18,6 @@
******************************************************************************/
#include "config/objectrule.hpp"
#include <boost/foreach.hpp>
#include <set>
using namespace icinga;

View File

@ -33,7 +33,6 @@
#include "base/exception.hpp"
#include "base/convert.hpp"
#include "base/objectlock.hpp"
#include <boost/foreach.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <map>
#include <vector>
@ -49,7 +48,7 @@ public:
Array::Ptr imports = ScriptFrame::GetImports();
ObjectLock olock(imports);
BOOST_FOREACH(const Value& import, imports) {
for (const Value& import : imports) {
Object::Ptr obj = import;
if (obj->HasOwnField(name)) {
*result = import;
@ -192,12 +191,12 @@ public:
{
ObjectLock olock(dict);
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
for (const Dictionary::Pair& kv : dict) {
keys.push_back(kv.first);
}
}
BOOST_FOREACH(const String& key, keys) {
for (const String& key : keys) {
frame.Locals->Set(fkvar, key);
frame.Locals->Set(fvvar, dict->Get(key));
ExpressionResult res = expression->Evaluate(frame);
@ -256,7 +255,7 @@ private:
locals = new Dictionary();
typedef std::pair<String, Expression *> ClosedVar;
BOOST_FOREACH(const ClosedVar& cvar, *closedVars) {
for (const ClosedVar& cvar : *closedVars) {
locals->Set(cvar.first, cvar.second->Evaluate(frame));
}
}

View File

@ -24,7 +24,6 @@
#include "icinga/compatutility.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -29,7 +29,6 @@
#include "base/utility.hpp"
#include "base/logger.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -466,13 +465,13 @@ void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
void DbConnection::UpdateAllObjects(void)
{
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
for (const Type::Ptr& type : Type::GetAllTypes()) {
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype)
continue;
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
UpdateObject(object);
}
}
@ -480,7 +479,7 @@ void DbConnection::UpdateAllObjects(void)
void DbConnection::PrepareDatabase(void)
{
BOOST_FOREACH(const DbType::Ptr& type, DbType::GetAllTypes()) {
for (const DbType::Ptr& type : DbType::GetAllTypes()) {
FillIDCache(type);
}
}

View File

@ -33,7 +33,6 @@
#include "icinga/externalcommandprocessor.hpp"
#include "icinga/compatutility.hpp"
#include "icinga/icingaapplication.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
using namespace icinga;
@ -203,7 +202,7 @@ void DbEvents::ReachabilityChangedHandler(const Checkable::Ptr& checkable, const
Log(LogDebug, "DbEvents")
<< "Updating reachability for checkable '" << checkable->GetName() << "': " << (is_reachable ? "" : "not" ) << " reachable for " << children.size() << " children.";
BOOST_FOREACH(const Checkable::Ptr& child, children) {
for (const Checkable::Ptr& child : children) {
Log(LogDebug, "DbEvents")
<< "Updating reachability for checkable '" << child->GetName() << "': " << (is_reachable ? "" : "not" ) << " reachable.";
@ -305,7 +304,7 @@ void DbEvents::AddComments(const Checkable::Ptr& checkable)
std::vector<DbQuery> queries;
BOOST_FOREACH(const Comment::Ptr& comment, comments) {
for (const Comment::Ptr& comment : comments) {
AddCommentInternal(queries, comment, false);
}
@ -443,7 +442,7 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable)
std::vector<DbQuery> queries;
BOOST_FOREACH(const Downtime::Ptr& downtime, downtimes) {
for (const Downtime::Ptr& downtime : downtimes) {
AddDowntimeInternal(queries, downtime, false);
}
@ -875,7 +874,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
std::vector<DbQuery> queries;
BOOST_FOREACH(const User::Ptr& user, users) {
for (const User::Ptr& user : users) {
Log(LogDebug, "DbEvents")
<< "add contact notification history for service '" << checkable->GetName() << "' and user '" << user->GetName() << "'.";

View File

@ -37,7 +37,6 @@
#include "base/utility.hpp"
#include "base/initialize.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -92,7 +91,7 @@ String DbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) const
{
ObjectLock olock(configFieldsDup);
BOOST_FOREACH(const Dictionary::Pair& kv, configFieldsDup) {
for (const Dictionary::Pair& kv : configFieldsDup) {
if (kv.second.IsObjectType<ConfigObject>()) {
ConfigObject::Ptr obj = kv.second;
configFieldsDup->Set(kv.first, obj->GetName());
@ -235,7 +234,7 @@ void DbObject::SendVarsConfigUpdateHeavy(void)
if (vars) {
ObjectLock olock (vars);
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
for (const Dictionary::Pair& kv : vars) {
if (kv.first.IsEmpty())
continue;
@ -284,7 +283,7 @@ void DbObject::SendVarsStatusUpdate(void)
std::vector<DbQuery> queries;
ObjectLock olock (vars);
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
for (const Dictionary::Pair& kv : vars) {
if (kv.first.IsEmpty())
continue;

View File

@ -22,7 +22,6 @@
#include "base/objectlock.hpp"
#include "base/debug.hpp"
#include <boost/thread/once.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
@ -78,7 +77,7 @@ DbType::Ptr DbType::GetByID(long tid)
{
boost::mutex::scoped_lock lock(GetStaticMutex());
BOOST_FOREACH(const TypeMap::value_type& kv, GetTypes()) {
for (const TypeMap::value_type& kv : GetTypes()) {
if (kv.second->GetTypeID() == tid)
return kv.second;
}
@ -142,10 +141,11 @@ std::set<DbType::Ptr> DbType::GetAllTypes(void)
{
std::set<DbType::Ptr> result;
boost::mutex::scoped_lock lock(GetStaticMutex());
std::pair<String, DbType::Ptr> kv;
BOOST_FOREACH(kv, GetTypes()) {
result.insert(kv.second);
{
boost::mutex::scoped_lock lock(GetStaticMutex());
for (const auto& kv : GetTypes()) {
result.insert(kv.second);
}
}
return result;

View File

@ -27,7 +27,6 @@
#include "base/utility.hpp"
#include "base/convert.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -33,7 +33,6 @@
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/json.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -197,7 +196,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& groupName, groups) {
for (const String& groupName : groups) {
HostGroup::Ptr group = HostGroup::GetByName(groupName);
DbQuery query2;
@ -231,7 +230,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query2);
/* parents */
BOOST_FOREACH(const Checkable::Ptr& checkable, host->GetParents()) {
for (const Checkable::Ptr& checkable : host->GetParents()) {
Host::Ptr parent = dynamic_pointer_cast<Host>(checkable);
if (!parent)
@ -272,7 +271,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query3);
BOOST_FOREACH(const Dependency::Ptr& dep, host->GetDependencies()) {
for (const Dependency::Ptr& dep : host->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
@ -320,7 +319,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query4);
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(host)) {
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(host)) {
Log(LogDebug, "HostDbObject")
<< "host contacts: " << user->GetName();
@ -354,7 +353,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query5);
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(host)) {
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(host)) {
Log(LogDebug, "HostDbObject")
<< "host contactgroups: " << usergroup->GetName();
@ -405,7 +404,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
Array::Ptr parents = new Array();
/* parents */
BOOST_FOREACH(const Checkable::Ptr& checkable, host->GetParents()) {
for (const Checkable::Ptr& checkable : host->GetParents()) {
Host::Ptr parent = dynamic_pointer_cast<Host>(checkable);
if (!parent)
@ -421,7 +420,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
Array::Ptr dependencies = new Array();
/* dependencies */
BOOST_FOREACH(const Dependency::Ptr& dep, host->GetDependencies()) {
for (const Dependency::Ptr& dep : host->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent)
@ -441,7 +440,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
Array::Ptr users = new Array();
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(host)) {
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(host)) {
users->Add(user->GetName());
}
@ -451,7 +450,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
Array::Ptr userGroups = new Array();
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(host)) {
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(host)) {
userGroups->Add(usergroup->GetName());
}

View File

@ -23,7 +23,6 @@
#include "base/objectlock.hpp"
#include "base/initialize.hpp"
#include "base/configtype.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -29,7 +29,6 @@
#include "base/utility.hpp"
#include "base/configtype.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -37,7 +37,6 @@
#include "base/utility.hpp"
#include "base/logger.hpp"
#include "base/json.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
using namespace icinga;
@ -191,7 +190,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& groupName, groups) {
for (const String& groupName : groups) {
ServiceGroup::Ptr group = ServiceGroup::GetByName(groupName);
DbQuery query2;
@ -228,7 +227,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query2);
BOOST_FOREACH(const Dependency::Ptr& dep, service->GetDependencies()) {
for (const Dependency::Ptr& dep : service->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
@ -280,7 +279,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query3);
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(service)) {
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(service)) {
Log(LogDebug, "ServiceDbObject")
<< "service contacts: " << user->GetName();
@ -314,7 +313,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
queries.push_back(query4);
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(service)) {
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(service)) {
Log(LogDebug, "ServiceDbObject")
<< "service contactgroups: " << usergroup->GetName();
@ -365,7 +364,7 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
Array::Ptr dependencies = new Array();
/* dependencies */
BOOST_FOREACH(const Dependency::Ptr& dep, service->GetDependencies()) {
for (const Dependency::Ptr& dep : service->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent)
@ -385,7 +384,7 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
Array::Ptr users = new Array();
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(service)) {
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(service)) {
users->Add(user->GetName());
}
@ -395,7 +394,7 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
Array::Ptr userGroups = new Array();
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(service)) {
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(service)) {
userGroups->Add(usergroup->GetName());
}

View File

@ -22,7 +22,6 @@
#include "db_ido/dbvalue.hpp"
#include "base/objectlock.hpp"
#include "base/initialize.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -25,7 +25,6 @@
#include "base/utility.hpp"
#include "base/exception.hpp"
#include "base/objectlock.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -69,7 +68,7 @@ void TimePeriodDbObject::OnConfigUpdateHeavy(void)
time_t refts = Utility::GetTime();
ObjectLock olock(ranges);
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
for (const Dictionary::Pair& kv : ranges) {
int wday = LegacyTimePeriod::WeekdayFromString(kv.first);
if (wday == -1)
@ -81,7 +80,7 @@ void TimePeriodDbObject::OnConfigUpdateHeavy(void)
LegacyTimePeriod::ProcessTimeRanges(kv.second, &reference, segments);
ObjectLock olock(segments);
BOOST_FOREACH(const Value& vsegment, segments) {
for (const Value& vsegment : segments) {
Dictionary::Ptr segment = vsegment;
int begin = segment->Get("begin");
int end = segment->Get("end");

View File

@ -26,7 +26,6 @@
#include "base/convert.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -100,7 +99,7 @@ void UserDbObject::OnConfigUpdateHeavy(void)
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& groupName, groups) {
for (const String& groupName : groups) {
UserGroup::Ptr group = UserGroup::GetByName(groupName);
DbQuery query2;

View File

@ -23,7 +23,6 @@
#include "base/objectlock.hpp"
#include "base/initialize.hpp"
#include "base/configtype.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -31,7 +31,6 @@
#include "base/exception.hpp"
#include "base/statsfunction.hpp"
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
@ -53,7 +52,7 @@ void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, ConfigType::GetObjectsByType<IdoMysqlConnection>()) {
for (const IdoMysqlConnection::Ptr& idomysqlconnection : ConfigType::GetObjectsByType<IdoMysqlConnection>()) {
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
Dictionary::Ptr stats = new Dictionary();
@ -401,7 +400,7 @@ void IdoMysqlConnection::Reconnect(void)
EnableActiveChangedHandler();
BOOST_FOREACH(const DbObject::Ptr& dbobj, activeDbObjs) {
for (const DbObject::Ptr& dbobj : activeDbObjs) {
if (dbobj->GetObject())
continue;
@ -830,7 +829,7 @@ bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query)
ObjectLock olock(query.WhereCriteria);
Value value;
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
for (const Dictionary::Pair& kv : query.WhereCriteria) {
if (!FieldToEscapedString(kv.first, kv.second, &value))
return false;
}
@ -839,7 +838,7 @@ bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query)
if (query.Fields) {
ObjectLock olock(query.Fields);
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
for (const Dictionary::Pair& kv : query.Fields) {
Value value;
if (kv.second.IsEmpty() && !kv.second.IsString())
@ -860,7 +859,7 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
if (!GetConnected())
return;
BOOST_FOREACH(const DbQuery& query, queries) {
for (const DbQuery& query : queries) {
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
if (!CanExecuteQuery(query)) {
@ -869,7 +868,7 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
}
}
BOOST_FOREACH(const DbQuery& query, queries) {
for (const DbQuery& query : queries) {
InternalExecuteQuery(query);
}
}
@ -909,7 +908,7 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
Value value;
bool first = true;
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
for (const Dictionary::Pair& kv : query.WhereCriteria) {
if (!FieldToEscapedString(kv.first, kv.second, &value)) {
m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
return;
@ -976,7 +975,7 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
ObjectLock olock(query.Fields);
bool first = true;
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
for (const Dictionary::Pair& kv : query.Fields) {
Value value;
if (kv.second.IsEmpty() && !kv.second.IsString())

View File

@ -32,7 +32,6 @@
#include "base/context.hpp"
#include "base/statsfunction.hpp"
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
@ -57,7 +56,7 @@ void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P
{
Dictionary::Ptr nodes = new Dictionary();
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, ConfigType::GetObjectsByType<IdoPgsqlConnection>()) {
for (const IdoPgsqlConnection::Ptr& idopgsqlconnection : ConfigType::GetObjectsByType<IdoPgsqlConnection>()) {
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
Dictionary::Ptr stats = new Dictionary();
@ -374,7 +373,7 @@ void IdoPgsqlConnection::Reconnect(void)
EnableActiveChangedHandler();
BOOST_FOREACH(const DbObject::Ptr& dbobj, activeDbObjs) {
for (const DbObject::Ptr& dbobj : activeDbObjs) {
if (dbobj->GetObject())
continue;
@ -687,7 +686,7 @@ bool IdoPgsqlConnection::CanExecuteQuery(const DbQuery& query)
ObjectLock olock(query.WhereCriteria);
Value value;
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
for (const Dictionary::Pair& kv : query.WhereCriteria) {
if (!FieldToEscapedString(kv.first, kv.second, &value))
return false;
}
@ -696,7 +695,7 @@ bool IdoPgsqlConnection::CanExecuteQuery(const DbQuery& query)
if (query.Fields) {
ObjectLock olock(query.Fields);
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
for (const Dictionary::Pair& kv : query.Fields) {
Value value;
if (kv.second.IsEmpty() && !kv.second.IsString())
@ -717,7 +716,7 @@ void IdoPgsqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
if (!GetConnected())
return;
BOOST_FOREACH(const DbQuery& query, queries) {
for (const DbQuery& query : queries) {
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
if (!CanExecuteQuery(query)) {
@ -726,7 +725,7 @@ void IdoPgsqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
}
}
BOOST_FOREACH(const DbQuery& query, queries) {
for (const DbQuery& query : queries) {
InternalExecuteQuery(query);
}
}
@ -766,7 +765,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
Value value;
bool first = true;
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
for (const Dictionary::Pair& kv : query.WhereCriteria) {
if (!FieldToEscapedString(kv.first, kv.second, &value)) {
m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
return;
@ -834,7 +833,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
Value value;
bool first = true;
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
for (const Dictionary::Pair& kv : query.Fields) {
if (kv.second.IsEmpty() && !kv.second.IsString())
continue;

View File

@ -174,7 +174,7 @@ Dictionary::Ptr ApiActions::DelayNotification(const ConfigObject::Ptr& object,
if (!params->Contains("timestamp"))
return ApiActions::CreateResult(403, "A timestamp is required to delay notifications");
BOOST_FOREACH(const Notification::Ptr& notification, checkable->GetNotifications()) {
for (const Notification::Ptr& notification : checkable->GetNotifications()) {
notification->SetNextNotification(HttpUtility::GetLastParameter(params, "timestamp"));
}
@ -275,7 +275,7 @@ Dictionary::Ptr ApiActions::RemoveComment(const ConfigObject::Ptr& object,
if (checkable) {
std::set<Comment::Ptr> comments = checkable->GetComments();
BOOST_FOREACH(const Comment::Ptr& comment, comments) {
for (const Comment::Ptr& comment : comments) {
Comment::RemoveComment(comment->GetName());
}
@ -341,7 +341,7 @@ Dictionary::Ptr ApiActions::RemoveDowntime(const ConfigObject::Ptr& object,
if (checkable) {
std::set<Downtime::Ptr> downtimes = checkable->GetDowntimes();
BOOST_FOREACH(const Downtime::Ptr& downtime, downtimes) {
for (const Downtime::Ptr& downtime : downtimes) {
Downtime::RemoveDowntime(downtime->GetName(), true);
}

View File

@ -70,7 +70,7 @@ void ApiEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckR
result->Set("check_result", Serialize(cr));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -100,7 +100,7 @@ void ApiEvents::StateChangeHandler(const Checkable::Ptr& checkable, const CheckR
result->Set("state_type", checkable->GetStateType());
result->Set("check_result", Serialize(cr));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -130,7 +130,7 @@ void ApiEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notif
Array::Ptr userNames = new Array();
BOOST_FOREACH(const User::Ptr& user, users) {
for (const User::Ptr& user : users) {
userNames->Add(user->GetName());
}
@ -140,7 +140,7 @@ void ApiEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notif
result->Set("text", text);
result->Set("check_result", Serialize(cr));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -170,7 +170,7 @@ void ApiEvents::FlappingChangedHandler(const Checkable::Ptr& checkable, const Me
result->Set("state_type", checkable->GetStateType());
result->Set("is_flapping", checkable->IsFlapping());
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -207,7 +207,7 @@ void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
result->Set("notify", notify);
result->Set("expiry", expiry);
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -236,7 +236,7 @@ void ApiEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, c
result->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
result->Set("state_type", checkable->GetStateType());
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
@ -258,7 +258,7 @@ void ApiEvents::CommentAddedHandler(const Comment::Ptr& comment)
result->Set("comment", Serialize(comment, FAConfig | FAState));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -278,7 +278,7 @@ void ApiEvents::CommentRemovedHandler(const Comment::Ptr& comment)
result->Set("comment", Serialize(comment, FAConfig | FAState));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -298,7 +298,7 @@ void ApiEvents::DowntimeAddedHandler(const Downtime::Ptr& downtime)
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -318,7 +318,7 @@ void ApiEvents::DowntimeRemovedHandler(const Downtime::Ptr& downtime)
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}
@ -338,7 +338,7 @@ void ApiEvents::DowntimeTriggeredHandler(const Downtime::Ptr& downtime)
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
}

View File

@ -31,7 +31,6 @@
#include "base/convert.hpp"
#include "base/utility.hpp"
#include "base/context.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -240,7 +239,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
}
/* reschedule direct parents */
BOOST_FOREACH(const Checkable::Ptr& parent, GetParents()) {
for (const Checkable::Ptr& parent : GetParents()) {
if (parent.get() == this)
continue;

View File

@ -24,21 +24,20 @@
#include "base/timer.hpp"
#include "base/utility.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
void Checkable::RemoveAllComments(void)
{
BOOST_FOREACH(const Comment::Ptr& comment, GetComments()) {
for (const Comment::Ptr& comment : GetComments()) {
Comment::RemoveComment(comment->GetName());
}
}
void Checkable::RemoveCommentsByType(int type)
{
BOOST_FOREACH(const Comment::Ptr& comment, GetComments()) {
for (const Comment::Ptr& comment : GetComments()) {
if (comment->GetEntryType() == type)
Comment::RemoveComment(comment->GetName());
}

View File

@ -20,7 +20,6 @@
#include "icinga/service.hpp"
#include "icinga/dependency.hpp"
#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -69,7 +68,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
return false;
}
BOOST_FOREACH(const Checkable::Ptr& checkable, GetParents()) {
for (const Checkable::Ptr& checkable : GetParents()) {
if (!checkable->IsReachable(dt, failedDependency, rstack + 1))
return false;
}
@ -87,7 +86,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
}
}
BOOST_FOREACH(const Dependency::Ptr& dep, GetDependencies()) {
for (const Dependency::Ptr& dep : GetDependencies()) {
if (!dep->IsAvailable(dt)) {
if (failedDependency)
*failedDependency = dep;
@ -106,7 +105,7 @@ std::set<Checkable::Ptr> Checkable::GetParents(void) const
{
std::set<Checkable::Ptr> parents;
BOOST_FOREACH(const Dependency::Ptr& dep, GetDependencies()) {
for (const Dependency::Ptr& dep : GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (parent && parent.get() != this)
@ -120,7 +119,7 @@ std::set<Checkable::Ptr> Checkable::GetChildren(void) const
{
std::set<Checkable::Ptr> parents;
BOOST_FOREACH(const Dependency::Ptr& dep, GetReverseDependencies()) {
for (const Dependency::Ptr& dep : GetReverseDependencies()) {
Checkable::Ptr service = dep->GetChild();
if (service && service.get() != this)

View File

@ -23,27 +23,26 @@
#include "base/logger.hpp"
#include "base/utility.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
void Checkable::RemoveAllDowntimes(void)
{
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
for (const Downtime::Ptr& downtime : GetDowntimes()) {
Downtime::RemoveDowntime(downtime->GetName(), true, true);
}
}
void Checkable::TriggerDowntimes(void)
{
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
for (const Downtime::Ptr& downtime : GetDowntimes()) {
downtime->TriggerDowntime();
}
}
bool Checkable::IsInDowntime(void) const
{
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
for (const Downtime::Ptr& downtime : GetDowntimes()) {
if (downtime->IsInEffect())
return true;
}
@ -55,7 +54,7 @@ int Checkable::GetDowntimeDepth(void) const
{
int downtime_depth = 0;
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
for (const Downtime::Ptr& downtime : GetDowntimes()) {
if (downtime->IsInEffect())
downtime_depth++;
}

View File

@ -20,7 +20,6 @@
#include "icinga/checkable.hpp"
#include "icinga/icingaapplication.hpp"
#include "base/utility.hpp"
#include <boost/foreach.hpp>
using namespace icinga;

View File

@ -24,7 +24,6 @@
#include "base/exception.hpp"
#include "base/context.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -37,7 +36,7 @@ boost::signals2::signal<void (const Notification::Ptr&, const Checkable::Ptr&, c
void Checkable::ResetNotificationNumbers(void)
{
BOOST_FOREACH(const Notification::Ptr& notification, GetNotifications()) {
for (const Notification::Ptr& notification : GetNotifications()) {
ObjectLock olock(notification);
notification->ResetNotificationNumber();
}
@ -71,7 +70,7 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
Log(LogDebug, "Checkable")
<< "Checkable '" << GetName() << "' has " << notifications.size() << " notification(s).";
BOOST_FOREACH(const Notification::Ptr& notification, notifications) {
for (const Notification::Ptr& notification : notifications) {
try {
if (!notification->IsPaused())
notification->BeginExecuteNotification(type, cr, force, false, author, text);

View File

@ -24,7 +24,6 @@
#include "base/objectlock.hpp"
#include "base/utility.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/bind/apply.hpp>
using namespace icinga;

View File

@ -25,7 +25,6 @@
#include "base/utility.hpp"
#include "base/configtype.hpp"
#include "base/statsfunction.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@ -82,7 +81,7 @@ CheckableCheckStatistics CIB::CalculateHostCheckStats(void)
int count_execution_time = 0;
bool checkresult = false;
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
ObjectLock olock(host);
CheckResult::Ptr cr = host->GetLastCheckResult();
@ -143,7 +142,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void)
int count_execution_time = 0;
bool checkresult = false;
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
ObjectLock olock(service);
CheckResult::Ptr cr = service->GetLastCheckResult();
@ -200,7 +199,7 @@ ServiceStatistics CIB::CalculateServiceStats(void)
{
ServiceStatistics ss = {};
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
ObjectLock olock(service);
CheckResult::Ptr cr = service->GetLastCheckResult();
@ -234,7 +233,7 @@ HostStatistics CIB::CalculateHostStats(void)
{
HostStatistics hs = {};
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
ObjectLock olock(host);
if (host->IsReachable()) {
@ -269,13 +268,8 @@ std::pair<Dictionary::Ptr, Array::Ptr> CIB::GetFeatureStats(void)
Array::Ptr perfdata = new Array();
String name;
BOOST_FOREACH(tie(name, boost::tuples::ignore), StatsFunctionRegistry::GetInstance()->GetItems()) {
StatsFunction::Ptr func = StatsFunctionRegistry::GetInstance()->GetItem(name);
if (!func)
BOOST_THROW_EXCEPTION(std::invalid_argument("Function '" + name + "' does not exist."));
func->Invoke(status, perfdata);
for (const auto& kv : StatsFunctionRegistry::GetInstance()->GetItems()) {
kv.second->Invoke(status, perfdata);
}
return std::make_pair(status, perfdata);

Some files were not shown because too many files have changed in this diff Show More