if (localConfig->GetLength() != remoteConfig->GetLength())
configChange = true;
- String key;
- Value value;
ObjectLock olock(remoteConfig);
- BOOST_FOREACH(boost::tie(key, value), remoteConfig) {
- Dictionary::Ptr remoteFile = value;
+ BOOST_FOREACH(const Dictionary::Pair& kv, remoteConfig) {
+ Dictionary::Ptr remoteFile = kv.second;
bool writeFile = false;
- String hash = SHA256(key);
+ String hash = SHA256(kv.first);
String path = dir + "/" + hash;
if (!localConfig->Contains(hash))
olock.Unlock();
ObjectLock olock2(localConfig);
- BOOST_FOREACH(boost::tie(key, boost::tuples::ignore), localConfig) {
- String path = dir + "/" + key;
+ BOOST_FOREACH(const Dictionary::Pair& kv, localConfig) {
+ String path = dir + "/" + kv.first;
Log(LogInformation, "cluster", "Removing obsolete config file: " + path);
(void) unlink(path.CStr());
configChange = true;
ObjectLock olock(comments);
- String id;
- Comment::Ptr comment;
- BOOST_FOREACH(boost::tie(id, comment), comments) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+ Comment::Ptr comment = kv.second;
+
if (comment->IsExpired())
continue;
if (ranges) {
ObjectLock olock(ranges);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), ranges) {
- fp << "\t" << key << "\t" << value << "\n";
+ BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
+ fp << "\t" << kv.first << "\t" << kv.second << "\n";
}
}
ObjectLock olock(downtimes);
- String id;
- Downtime::Ptr downtime;
- BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ Downtime::Ptr downtime = kv.second;
+
if (downtime->IsExpired())
continue;
return;
ObjectLock olock(custom);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), custom) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, custom) {
fp << "\t";
- if (key != "notes" && key != "action_url" && key != "notes_url" &&
- key != "icon_image" && key != "icon_image_alt" && key != "statusmap_image" && "2d_coords")
+ if (kv.first != "notes" && kv.first != "action_url" && kv.first != "notes_url" &&
+ kv.first != "icon_image" && kv.first != "icon_image_alt" && kv.first != "statusmap_image" && kv.first != "2d_coords")
fp << "_";
- fp << key << "\t" << value << "\n";
+ fp << kv.first << "\t" << kv.second << "\n";
}
}
where << " WHERE ";
ObjectLock olock(query.WhereCriteria);
- String key;
Value value;
bool first = true;
- BOOST_FOREACH(boost::tie(key, value), query.WhereCriteria) {
- if (!FieldToEscapedString(key, value, &value))
+ BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
+ if (!FieldToEscapedString(kv.first, kv.second, &value))
return;
if (!first)
where << " AND ";
- where << key << " = " << value;
+ where << kv.first << " = " << value;
if (first)
first = false;
}
if (type == DbQueryInsert || type == DbQueryUpdate) {
- String cols;
- String values;
+ std::ostringstream colbuf, valbuf;
ObjectLock olock(query.Fields);
- String key;
- Value value;
bool first = true;
- BOOST_FOREACH(boost::tie(key, value), query.Fields) {
- if (!FieldToEscapedString(key, value, &value))
+ BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
+ Value value;
+
+ if (!FieldToEscapedString(kv.first, kv.second, &value))
return;
if (type == DbQueryInsert) {
if (!first) {
- cols += ", ";
- values += ", ";
+ colbuf << ", ";
+ valbuf << ", ";
}
- cols += key;
- values += value;
+ colbuf << kv.first;
+ valbuf << value;
} else {
if (!first)
qbuf << ", ";
- qbuf << " " << key << " = " << value;
+ qbuf << " " << kv.first << " = " << value;
}
if (first)
}
if (type == DbQueryInsert)
- qbuf << " (" << cols << ") VALUES (" << values << ")";
+ qbuf << " (" << colbuf.str() << ") VALUES (" << valbuf.str() << ")";
}
if (type != DbQueryInsert)
where << " WHERE ";
ObjectLock olock(query.WhereCriteria);
- String key;
Value value;
bool first = true;
- BOOST_FOREACH(boost::tie(key, value), query.WhereCriteria) {
- if (!FieldToEscapedString(key, value, &value))
+ BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
+ if (!FieldToEscapedString(kv.first, kv.second, &value))
return;
if (!first)
where << " AND ";
- where << key << " = " << value;
+ where << kv.first << " = " << value;
if (first)
first = false;
}
if (type == DbQueryInsert || type == DbQueryUpdate) {
- String cols;
- String values;
+ std::ostringstream colbuf, valbuf;
ObjectLock olock(query.Fields);
- String key;
Value value;
bool first = true;
- BOOST_FOREACH(boost::tie(key, value), query.Fields) {
- if (!FieldToEscapedString(key, value, &value))
+ BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
+ if (!FieldToEscapedString(kv.first, kv.second, &value))
return;
if (type == DbQueryInsert) {
if (!first) {
- cols += ", ";
- values += ", ";
+ colbuf << ", ";
+ valbuf << ", ";
}
- cols += key;
- values += value;
+ colbuf << kv.first;
+ valbuf << value;
} else {
if (!first)
qbuf << ", ";
- qbuf << " " << key << " = " << value;
+ qbuf << " " << kv.first << " = " << value;
}
if (first)
}
if (type == DbQueryInsert)
- qbuf << " (" << cols << ") VALUES (" << values << ")";
+ qbuf << " (" << colbuf.str() << ") VALUES (" << valbuf.str() << ")";
}
if (type != DbQueryInsert)
Dictionary::Ptr perfdata = pdv;
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), perfdata) {
+ ObjectLock olock(perfdata);
+ BOOST_FOREACH(const Dictionary::Pair& kv, perfdata) {
double valueNum;
- if (!value.IsObjectType<PerfdataValue>())
- valueNum = value;
+ if (!kv.second.IsObjectType<PerfdataValue>())
+ valueNum = kv.second;
else
- valueNum = static_cast<PerfdataValue::Ptr>(value)->GetValue();
+ valueNum = static_cast<PerfdataValue::Ptr>(kv.second)->GetValue();
- String escaped_key = key;
+ String escaped_key = kv.first;
SanitizeMetric(escaped_key);
boost::algorithm::replace_all(escaped_key, "::", ".");
#include "base/objectlock.h"
#include "base/debug.h"
#include <cJSON.h>
-#include <boost/tuple/tuple.hpp>
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
Dictionary::Ptr clone = make_shared<Dictionary>();
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), m_Data) {
- clone->Set(key, value);
+ BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
+ clone->Set(kv.first, kv.second);
}
return clone;
try {
ObjectLock olock(this);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), m_Data) {
- cJSON_AddItemToObject(json, key.CStr(), value.ToJson());
+ BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
+ cJSON_AddItemToObject(json, kv.first.CStr(), kv.second.ToJson());
}
} catch (...) {
cJSON_Delete(json);
*/
typedef std::map<String, Value>::iterator Iterator;
+ typedef std::pair<String, Value> Pair;
+
Value Get(const char *key) const;
Value Get(const String& key) const;
void Set(const String& key, const Value& value);
#include "base/logger_fwd.h"
#include "base/utility.h"
#include <boost/bind.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
if (m_ExtraEnvironment) {
ObjectLock olock(m_ExtraEnvironment);
- String key;
- Value value;
int index = envc;
- BOOST_FOREACH(boost::tie(key, value), m_ExtraEnvironment) {
- String kv = key + "=" + Convert::ToString(value);
- envp[index] = strdup(kv.CStr());
+ BOOST_FOREACH(const Dictionary::Pair& kv, m_ExtraEnvironment) {
+ String skv = kv.first + "=" + Convert::ToString(kv.second);
+ envp[index] = strdup(skv.CStr());
index++;
}
}
#include <boost/thread/mutex.hpp>
#include <boost/signals2.hpp>
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
namespace icinga
{
items = m_Items;
}
- String name;
- BOOST_FOREACH(boost::tie(name, boost::tuples::ignore), items) {
- OnUnregistered(name);
+ typedef typename std::pair<String, T> ItemMapPair;
+
+ BOOST_FOREACH(const ItemMapPair& kv, items) {
+ OnUnregistered(kv.first);
}
{
#include "base/application.h"
#include "base/objectlock.h"
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
#include <cJSON.h>
using namespace icinga;
ObjectLock olock(input);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), input) {
- result->Set(key, Serialize(value, attributeTypes));
+ BOOST_FOREACH(const Dictionary::Pair& kv, input) {
+ result->Set(kv.first, Serialize(kv.second, attributeTypes));
}
return result;
ObjectLock olock(input);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), input) {
- result->Set(key, Deserialize(value, attributeTypes));
+ BOOST_FOREACH(const Dictionary::Pair& kv, input) {
+ result->Set(kv.first, Deserialize(kv.second, attributeTypes));
}
return result;
#include "base/logger_fwd.h"
#include "base/debug.h"
#include <sstream>
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
{
ObjectLock olock(properties);
- String key;
- Value data;
- BOOST_FOREACH(boost::tie(key, data), properties) {
- attrs->Set(key, data);
+ BOOST_FOREACH(const Dictionary::Pair& kv, properties) {
+ attrs->Set(kv.first, kv.second);
}
}
Log(LogInformation, "config", "Linking config items...");
- ConfigItem::Ptr item;
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
- item->Link();
+ BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
+ kv.second->Link();
}
if (ConfigCompilerContext::GetInstance()->HasErrors())
Log(LogInformation, "config", "Validating config items (step 1)...");
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
- item->ValidateItem();
+ BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
+ kv.second->ValidateItem();
}
if (ConfigCompilerContext::GetInstance()->HasErrors())
std::vector<DynamicObject::Ptr> objects;
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
- DynamicObject::Ptr object = item->Commit();
+ BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
+ DynamicObject::Ptr object = kv.second->Commit();
if (object)
objects.push_back(object);
Log(LogInformation, "config", "Validating config items (step 2)...");
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
- item->ValidateItem();
+ BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
+ kv.second->ValidateItem();
}
if (ConfigCompilerContext::GetInstance()->HasErrors())
#include "base/objectlock.h"
#include "base/convert.h"
#include "base/scriptfunction.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
ObjectLock olock(dictionary);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), dictionary) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, dictionary) {
TypeValidationResult overallResult = ValidationUnknownField;
std::vector<TypeRuleList::Ptr> subRuleLists;
String hint;
- locations.push_back("Attribute '" + key + "'");
+ locations.push_back("Attribute '" + kv.first + "'");
BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) {
TypeRuleList::Ptr subRuleList;
- TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList, &hint);
+ TypeValidationResult result = ruleList->ValidateAttribute(kv.first, kv.second, &subRuleList, &hint);
if (subRuleList)
subRuleLists.push_back(subRuleList);
ConfigCompilerContext::GetInstance()->AddMessage(true, message);
}
- if (!subRuleLists.empty() && value.IsObjectType<Dictionary>())
- ValidateDictionary(value, subRuleLists, locations);
- else if (!subRuleLists.empty() && value.IsObjectType<Array>())
- ValidateArray(value, subRuleLists, locations);
+ if (!subRuleLists.empty() && kv.second.IsObjectType<Dictionary>())
+ ValidateDictionary(kv.second, subRuleLists, locations);
+ else if (!subRuleLists.empty() && kv.second.IsObjectType<Array>())
+ ValidateArray(kv.second, subRuleLists, locations);
locations.pop_back();
}
#include "base/debug.h"
#include "base/array.h"
#include <sstream>
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
ObjectLock olock(dict);
- String key;
- Value item;
- BOOST_FOREACH(boost::tuples::tie(key, item), dict) {
- result->Set(key, DeepClone(item));
+ BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
+ result->Set(kv.first, DeepClone(kv.second));
}
return result;
String key;
Value value;
- BOOST_FOREACH(boost::tie(key, value), valueDict) {
- dict->Set(key, DeepClone(value));
+ BOOST_FOREACH(const Dictionary::Pair& kv, valueDict) {
+ dict->Set(kv.first, DeepClone(kv.second));
}
newValue = dict;
#include "base/objectlock.h"
#include "base/debug.h"
#include <boost/thread/once.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
DbType::Ptr DbType::GetByID(long tid)
{
- String name;
- DbType::Ptr type;
- BOOST_FOREACH(boost::tie(name, type), GetTypes()) {
- if (type->GetTypeID() == tid)
- return type;
+ boost::mutex::scoped_lock lock(GetStaticMutex());
+
+ BOOST_FOREACH(const TypeMap::value_type& kv, GetTypes()) {
+ if (kv.second->GetTypeID() == tid)
+ return kv.second;
}
return DbType::Ptr();
#include "base/convert.h"
#include "base/objectlock.h"
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
using namespace icinga;
if (customvars) {
ObjectLock olock (customvars);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), customvars) {
- Log(LogDebug, "db_ido", "host customvar key: '" + key + "' value: '" + Convert::ToString(value) + "'");
+ BOOST_FOREACH(const Dictionary::Pair& kv, customvars) {
+ Log(LogDebug, "db_ido", "host customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
Dictionary::Ptr fields3 = make_shared<Dictionary>();
- fields3->Set("varname", Convert::ToString(key));
- fields3->Set("varvalue", Convert::ToString(value));
+ fields3->Set("varname", Convert::ToString(kv.first));
+ fields3->Set("varvalue", Convert::ToString(kv.second));
fields3->Set("config_type", 1);
fields3->Set("has_been_modified", 0);
fields3->Set("object_id", host);
#include "icinga/externalcommandprocessor.h"
#include "icinga/compatutility.h"
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/algorithm/string/join.hpp>
using namespace icinga;
if (customvars) {
ObjectLock olock(customvars);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), customvars) {
- Log(LogDebug, "db_ido", "service customvar key: '" + key + "' value: '" + Convert::ToString(value) + "'");
+ BOOST_FOREACH(const Dictionary::Pair& kv, customvars) {
+ Log(LogDebug, "db_ido", "service customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
Dictionary::Ptr fields2 = make_shared<Dictionary>();
- fields2->Set("varname", Convert::ToString(key));
- fields2->Set("varvalue", Convert::ToString(value));
+ fields2->Set("varname", Convert::ToString(kv.first));
+ fields2->Set("varvalue", Convert::ToString(kv.second));
fields2->Set("config_type", 1);
fields2->Set("has_been_modified", 0);
fields2->Set("object_id", service);
ObjectLock olock(comments);
- String comment_id;
- Comment::Ptr comment;
- BOOST_FOREACH(boost::tie(comment_id, comment), comments) {
- AddComment(service, comment);
+ BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+ AddComment(service, kv.second);
}
}
ObjectLock olock(downtimes);
- String downtime_id;
- Downtime::Ptr downtime;
- BOOST_FOREACH(boost::tie(downtime_id, downtime), downtimes) {
- AddDowntime(service, downtime);
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ AddDowntime(service, kv.second);
}
}
#include "base/exception.h"
#include "base/objectlock.h"
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
using namespace icinga;
time_t refts = Utility::GetTime();
ObjectLock olock(ranges);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), ranges) {
- int wday = LegacyTimePeriod::WeekdayFromString(key);
+ BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
+ int wday = LegacyTimePeriod::WeekdayFromString(kv.first);
if (wday == -1)
continue;
#endif /* _MSC_VER */
Array::Ptr segments = make_shared<Array>();
- LegacyTimePeriod::ProcessTimeRanges(value, &reference, segments);
+ LegacyTimePeriod::ProcessTimeRanges(kv.second, &reference, segments);
ObjectLock olock(segments);
BOOST_FOREACH(const Value& vsegment, segments) {
#include "base/debug.h"
#include "base/convert.h"
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
ObjectLock olock(custom);
String key;
Value value;
- BOOST_FOREACH(boost::tie(key, value), custom) {
- if (key == "notes" ||
- key == "action_url" ||
- key == "notes_url" ||
- key == "icon_image" ||
- key == "icon_image_alt" ||
- key == "statusmap_image" ||
- key == "2d_coords")
+ BOOST_FOREACH(const Dictionary::Pair& kv, custom) {
+ if (kv.first == "notes" ||
+ kv.first == "action_url" ||
+ kv.first == "notes_url" ||
+ kv.first == "icon_image" ||
+ kv.first == "icon_image_alt" ||
+ kv.first == "statusmap_image" ||
+ kv.first == "2d_coords")
continue;
customvars->Set(key, value);
#include "base/serializer.h"
#include "config/configitembuilder.h"
#include "config/configcompilercontext.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
return;
ObjectLock olock(service_descriptions);
- String svcname;
- Value svcdesc;
- BOOST_FOREACH(boost::tie(svcname, svcdesc), service_descriptions) {
- if (svcdesc.IsScalar())
- svcname = svcdesc;
-
+ BOOST_FOREACH(const Dictionary::Pair& kv, service_descriptions) {
std::ostringstream namebuf;
- namebuf << GetName() << ":" << svcname;
+ namebuf << GetName() << ":" << kv.first;
String name = namebuf.str();
std::vector<String> path;
path.push_back("services");
- path.push_back(svcname);
+ path.push_back(kv.first);
DebugInfo di;
item->GetLinkedExpressionList()->FindDebugInfoPath(path, di);
builder->SetType("Service");
builder->SetName(name);
builder->AddExpression("host", OperatorSet, GetName());
- builder->AddExpression("display_name", OperatorSet, svcname);
- builder->AddExpression("short_name", OperatorSet, svcname);
+ builder->AddExpression("display_name", OperatorSet, kv.first);
+ builder->AddExpression("short_name", OperatorSet, kv.first);
- if (!svcdesc.IsObjectType<Dictionary>())
+ if (!kv.second.IsObjectType<Dictionary>())
BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be either a string or a dictionary."));
- Dictionary::Ptr service = svcdesc;
+ Dictionary::Ptr service = kv.second;
Array::Ptr templates = service->Get("templates");
boost::mutex::scoped_lock lock(m_ServicesMutex);
std::set<Service::Ptr> services;
- Service::WeakPtr wservice;
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, wservice), m_Services) {
- Service::Ptr service = wservice.lock();
-
- if (!service)
- continue;
-
- services.insert(service);
+ typedef std::pair<String, Service::Ptr> ServicePair;
+ BOOST_FOREACH(const ServicePair& kv, m_Services) {
+ services.insert(kv.second);
}
return services;
#include "base/objectlock.h"
#include "base/logger_fwd.h"
#include "base/context.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
#include "base/utility.h"
#include "base/convert.h"
#include "base/exception.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
String PluginUtility::FormatPerfdata(const Value& perfdata)
{
- String output;
+ std::ostringstream result;
if (!perfdata.IsObjectType<Dictionary>())
return perfdata;
ObjectLock olock(dict);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), dict) {
- if (!output.IsEmpty())
- output += " ";
+ bool first = true;
+ BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
+ if (!first)
+ result << " ";
+ else
+ first = false;
- output += key + "=" + PerfdataValue::Format(value);
+ result << kv.first << "=" << PerfdataValue::Format(kv.second);
}
- return output;
+ return result.str();
}
#include "base/timer.h"
#include "base/utility.h"
#include <boost/foreach.hpp>
-#include <boost/tuple/tuple.hpp>
using namespace icinga;
Dictionary::Ptr comments = GetComments();
ObjectLock olock(comments);
- String id;
- BOOST_FOREACH(boost::tie(id, boost::tuples::ignore), comments) {
- ids.push_back(id);
+ BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+ ids.push_back(kv.first);
}
- BOOST_FOREACH(id, ids) {
+ BOOST_FOREACH(const String& id, ids) {
RemoveComment(id);
}
}
boost::mutex::scoped_lock lock(l_CommentMutex);
- String id;
- Comment::Ptr comment;
- BOOST_FOREACH(boost::tie(id, comment), comments) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+ Comment::Ptr comment = kv.second;
+
int legacy_id = comment->GetLegacyId();
if (legacy_id >= l_NextCommentID)
l_NextCommentID = legacy_id + 1;
- l_LegacyCommentsCache[legacy_id] = id;
- l_CommentsCache[id] = GetSelf();
+ l_LegacyCommentsCache[legacy_id] = kv.first;
+ l_CommentsCache[kv.first] = GetSelf();
}
}
{
ObjectLock olock(comments);
- String id;
- Comment::Ptr comment;
- BOOST_FOREACH(boost::tie(id, comment), comments) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+ Comment::Ptr comment = kv.second;
+
if (comment->GetEntryType() == type)
- removedComments.push_back(id);
+ removedComments.push_back(kv.first);
}
}
{
ObjectLock olock(comments);
- String id;
- Comment::Ptr comment;
- BOOST_FOREACH(boost::tie(id, comment), comments) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+ Comment::Ptr comment = kv.second;
+
if (comment->IsExpired())
- expiredComments.push_back(id);
+ expiredComments.push_back(kv.first);
}
}
#include "base/timer.h"
#include "base/utility.h"
#include "base/convert.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
{
ObjectLock olock(downtimes);
- String id;
- BOOST_FOREACH(boost::tie(id, boost::tuples::ignore), downtimes) {
- ids.push_back(id);
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ ids.push_back(kv.first);
}
}
Dictionary::Ptr triggers = downtime->GetTriggers();
ObjectLock olock(triggers);
- String tid;
- BOOST_FOREACH(boost::tie(tid, boost::tuples::ignore), triggers) {
- TriggerDowntime(tid);
+ BOOST_FOREACH(const Dictionary::Pair& kv, triggers) {
+ TriggerDowntime(kv.first);
}
OnDowntimeTriggered(owner, downtime);
ObjectLock olock(downtimes);
- String id;
- Downtime::Ptr downtime;
- BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ Downtime::Ptr downtime = kv.second;
+
int legacy_id = downtime->GetLegacyId();
if (legacy_id >= l_NextDowntimeID)
l_NextDowntimeID = legacy_id + 1;
- l_LegacyDowntimesCache[legacy_id] = id;
- l_DowntimesCache[id] = GetSelf();
+ l_LegacyDowntimesCache[legacy_id] = kv.first;
+ l_DowntimesCache[kv.first] = GetSelf();
}
}
{
ObjectLock olock(downtimes);
- String id;
- Downtime::Ptr downtime;
- BOOST_FOREACH(boost::tie(id, downtime), downtimes) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ Downtime::Ptr downtime = kv.second;
+
if (downtime->IsExpired())
- expiredDowntimes.push_back(id);
+ expiredDowntimes.push_back(kv.first);
}
}
ObjectLock olock(downtimes);
- Downtime::Ptr downtime;
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, downtime), downtimes) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ Downtime::Ptr downtime = kv.second;
+
if (downtime->IsActive())
return true;
}
ObjectLock olock(downtimes);
- Downtime::Ptr downtime;
- BOOST_FOREACH(boost::tie(boost::tuples::ignore, downtime), downtimes) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
+ Downtime::Ptr downtime = kv.second;
+
if (downtime->IsActive())
downtime_depth++;
}
#include "base/timer.h"
#include "base/utility.h"
#include "base/convert.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
#include "base/exception.h"
#include "base/context.h"
#include "config/configitembuilder.h"
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
ObjectLock olock(descs);
- String nfcname;
- Value nfcdesc;
- BOOST_FOREACH(boost::tie(nfcname, nfcdesc), descs) {
+ BOOST_FOREACH(const Dictionary::Pair& kv, descs) {
std::ostringstream namebuf;
- namebuf << GetName() << ":" << nfcname;
+ namebuf << GetName() << ":" << kv.first;
String name = namebuf.str();
std::vector<String> path;
path.push_back("notifications");
- path.push_back(nfcname);
+ path.push_back(kv.first);
DebugInfo di;
item->GetLinkedExpressionList()->FindDebugInfoPath(path, di);
builder->AddExpression("host", OperatorSet, GetHost()->GetName());
builder->AddExpression("service", OperatorSet, GetShortName());
- if (!nfcdesc.IsObjectType<Dictionary>())
- BOOST_THROW_EXCEPTION(std::invalid_argument("Notification description must be a dictionary."));
-
- Dictionary::Ptr notification = nfcdesc;
+ Dictionary::Ptr notification = kv.second;
Array::Ptr templates = notification->Get("templates");
#include "base/debug.h"
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
-#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
using namespace icinga;
#endif /* _MSC_VER */
ObjectLock olock(ranges);
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), ranges) {
- if (!IsInDayDefinition(key, &reference)) {
- Log(LogDebug, "icinga", "Not in day definition '" + key + "'.");
+ BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
+ if (!IsInDayDefinition(kv.first, &reference)) {
+ Log(LogDebug, "icinga", "Not in day definition '" + kv.first + "'.");
continue;
}
- Log(LogDebug, "icinga", "In day definition '" + key + "'.");
+ Log(LogDebug, "icinga", "In day definition '" + kv.first + "'.");
- ProcessTimeRanges(value, &reference, segments);
+ ProcessTimeRanges(kv.second, &reference, segments);
}
}
}
bool seen_test1 = false, seen_test2 = false;
- String key;
- Value value;
- BOOST_FOREACH(boost::tie(key, value), dictionary) {
- BOOST_CHECK(key == "test1" || key == "test2");
+ BOOST_FOREACH(const Dictionary::Pair& kv, dictionary) {
+ BOOST_CHECK(kv.first == "test1" || kv.first == "test2");
- if (key == "test1") {
+ if (kv.first == "test1") {
BOOST_CHECK(!seen_test1);
seen_test1 = true;
- BOOST_CHECK(value == 7);
+ BOOST_CHECK(kv.second == 7);
continue;
- } else if (key == "test2") {
+ } else if (kv.first == "test2") {
BOOST_CHECK(!seen_test2);
seen_test2 = true;
- BOOST_CHECK(value == "hello world");
+ BOOST_CHECK(kv.second == "hello world");
}
}