]> granicus.if.org Git - icinga2/blobdiff - lib/livestatus/contactgroupstable.cpp
Remove more redundant wrappers from CompatUtility class
[icinga2] / lib / livestatus / contactgroupstable.cpp
index 604aa73b7bdff30443e0d004b61184a887ce4430..93587674a2796dd2416cf2cc3478b3993135f744 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)    *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)  *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
 
 #include "livestatus/contactgroupstable.hpp"
 #include "icinga/usergroup.hpp"
-#include "base/dynamictype.hpp"
-#include <boost/foreach.hpp>
+#include "base/configtype.hpp"
 
 using namespace icinga;
 
-ContactGroupsTable::ContactGroupsTable(void)
+ContactGroupsTable::ContactGroupsTable()
 {
        AddColumns(this);
 }
 
 void ContactGroupsTable::AddColumns(Table *table, const String& prefix,
-    const Column::ObjectAccessor& objectAccessor)
+       const Column::ObjectAccessor& objectAccessor)
 {
        table->AddColumn(prefix + "name", Column(&ContactGroupsTable::NameAccessor, objectAccessor));
        table->AddColumn(prefix + "alias", Column(&ContactGroupsTable::AliasAccessor, objectAccessor));
        table->AddColumn(prefix + "members", Column(&ContactGroupsTable::MembersAccessor, objectAccessor));
 }
 
-String ContactGroupsTable::GetName(void) const
+String ContactGroupsTable::GetName() const
 {
        return "contactgroups";
 }
 
-String ContactGroupsTable::GetPrefix(void) const
+String ContactGroupsTable::GetPrefix() const
 {
        return "contactgroup";
 }
 
 void ContactGroupsTable::FetchRows(const AddRowFunction& addRowFn)
 {
-       BOOST_FOREACH(const UserGroup::Ptr& ug, DynamicType::GetObjectsByType<UserGroup>()) {
-               addRowFn(ug, LivestatusGroupByNone, Empty);
+       for (const UserGroup::Ptr& ug : ConfigType::GetObjectsByType<UserGroup>()) {
+               if (!addRowFn(ug, LivestatusGroupByNone, Empty))
+                       return;
        }
 }
 
@@ -83,7 +83,7 @@ Value ContactGroupsTable::MembersAccessor(const Value& row)
 
        Array::Ptr members = new Array();
 
-       BOOST_FOREACH(const User::Ptr& user, user_group->GetMembers()) {
+       for (const User::Ptr& user : user_group->GetMembers()) {
                members->Add(user->GetName());
        }