mirror of https://github.com/Icinga/icinga2.git
parent
03b593fa67
commit
5058c5d75b
|
@ -30,7 +30,7 @@ ConfigObject::Ptr ConfigType::GetObject(const String& name) const
|
|||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
ConfigType::ObjectMap::const_iterator nt = m_ObjectMap.find(name);
|
||||
auto nt = m_ObjectMap.find(name);
|
||||
|
||||
if (nt == m_ObjectMap.end())
|
||||
return ConfigObject::Ptr();
|
||||
|
|
|
@ -54,7 +54,7 @@ std::vector<Object::Ptr> DependencyGraph::GetParents(const Object::Ptr& child)
|
|||
std::vector<Object::Ptr> objects;
|
||||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
std::map<Object *, std::map<Object *, int> >::const_iterator it = m_Dependencies.find(child.get());
|
||||
auto it = m_Dependencies.find(child.get());
|
||||
|
||||
if (it != m_Dependencies.end()) {
|
||||
typedef std::pair<Object *, int> kv_pair;
|
||||
|
|
|
@ -37,7 +37,7 @@ Value Dictionary::Get(const String& key) const
|
|||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
std::map<String, Value>::const_iterator it = m_Data.find(key);
|
||||
auto it = m_Data.find(key);
|
||||
|
||||
if (it == m_Data.end())
|
||||
return Empty;
|
||||
|
@ -56,7 +56,7 @@ bool Dictionary::Get(const String& key, Value *result) const
|
|||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
std::map<String, Value>::const_iterator it = m_Data.find(key);
|
||||
auto it = m_Data.find(key);
|
||||
|
||||
if (it == m_Data.end())
|
||||
return false;
|
||||
|
|
|
@ -93,8 +93,7 @@ public:
|
|||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
typename ItemMap::const_iterator it;
|
||||
it = m_Items.find(name);
|
||||
auto it = m_Items.find(name);
|
||||
|
||||
if (it == m_Items.end())
|
||||
return T();
|
||||
|
|
|
@ -121,7 +121,7 @@ CLICommand::Ptr CLICommand::GetByName(const std::vector<String>& name)
|
|||
{
|
||||
boost::mutex::scoped_lock lock(GetRegistryMutex());
|
||||
|
||||
std::map<std::vector<String>, CLICommand::Ptr>::const_iterator it = GetRegistry().find(name);
|
||||
auto it = GetRegistry().find(name);
|
||||
|
||||
if (it == GetRegistry().end())
|
||||
return CLICommand::Ptr();
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "icinga/service.hpp"
|
||||
#include "icinga/command.hpp"
|
||||
#include "icinga/compatutility.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/timer.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
@ -65,31 +64,28 @@ private:
|
|||
template<typename T>
|
||||
void DumpNameList(std::ostream& fp, const T& list)
|
||||
{
|
||||
typename T::const_iterator it;
|
||||
bool first = true;
|
||||
for (it = list.begin(); it != list.end(); it++) {
|
||||
for (const auto& obj : list) {
|
||||
if (!first)
|
||||
fp << ",";
|
||||
else
|
||||
first = false;
|
||||
|
||||
ObjectLock olock(*it);
|
||||
fp << (*it)->GetName();
|
||||
fp << obj->GetName();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void DumpStringList(std::ostream& fp, const T& list)
|
||||
{
|
||||
typename T::const_iterator it;
|
||||
bool first = true;
|
||||
for (it = list.begin(); it != list.end(); it++) {
|
||||
for (const auto& str : list) {
|
||||
if (!first)
|
||||
fp << ",";
|
||||
else
|
||||
first = false;
|
||||
|
||||
fp << *it;
|
||||
fp << str;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ bool ApplyRule::IsValidSourceType(const String& sourceType)
|
|||
|
||||
bool ApplyRule::IsValidTargetType(const String& sourceType, const String& targetType)
|
||||
{
|
||||
TypeMap::const_iterator it = m_Types.find(sourceType);
|
||||
auto it = m_Types.find(sourceType);
|
||||
|
||||
if (it == m_Types.end())
|
||||
return false;
|
||||
|
@ -130,7 +130,7 @@ bool ApplyRule::IsValidTargetType(const String& sourceType, const String& target
|
|||
|
||||
std::vector<String> ApplyRule::GetTargetTypes(const String& sourceType)
|
||||
{
|
||||
TypeMap::const_iterator it = m_Types.find(sourceType);
|
||||
auto it = m_Types.find(sourceType);
|
||||
|
||||
if (it == m_Types.end())
|
||||
return std::vector<String>();
|
||||
|
|
|
@ -315,7 +315,7 @@ void ConfigCompiler::AddIncludeSearchDir(const String& dir)
|
|||
std::vector<ZoneFragment> ConfigCompiler::GetZoneDirs(const String& zone)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ZoneDirsMutex);
|
||||
std::map<String, std::vector<ZoneFragment> >::const_iterator it = m_ZoneDirs.find(zone);
|
||||
auto it = m_ZoneDirs.find(zone);
|
||||
if (it == m_ZoneDirs.end())
|
||||
return std::vector<ZoneFragment>();
|
||||
else
|
||||
|
|
|
@ -318,9 +318,11 @@ void ConfigItem::Register(void)
|
|||
if (!m_Abstract && dynamic_cast<NameComposer *>(type.get()))
|
||||
m_UnnamedItems.push_back(this);
|
||||
else {
|
||||
ItemMap::const_iterator it = m_Items[m_Type].find(m_Name);
|
||||
auto& items = m_Items[m_Type];
|
||||
|
||||
if (it != m_Items[m_Type].end()) {
|
||||
auto it = items.find(m_Name);
|
||||
|
||||
if (it != items.end()) {
|
||||
std::ostringstream msgbuf;
|
||||
msgbuf << "A configuration item of type '" << GetType()
|
||||
<< "' and name '" << GetName() << "' already exists ("
|
||||
|
@ -358,12 +360,12 @@ ConfigItem::Ptr ConfigItem::GetByTypeAndName(const String& type, const String& n
|
|||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
ConfigItem::TypeMap::const_iterator it = m_Items.find(type);
|
||||
auto it = m_Items.find(type);
|
||||
|
||||
if (it == m_Items.end())
|
||||
return ConfigItem::Ptr();
|
||||
|
||||
ConfigItem::ItemMap::const_iterator it2 = it->second.find(name);
|
||||
auto it2 = it->second.find(name);
|
||||
|
||||
if (it2 == it->second.end())
|
||||
return ConfigItem::Ptr();
|
||||
|
@ -634,7 +636,7 @@ std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const String& type)
|
|||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
TypeMap::const_iterator it = m_Items.find(type);
|
||||
auto it = m_Items.find(type);
|
||||
|
||||
if (it == m_Items.end())
|
||||
return items;
|
||||
|
|
|
@ -310,9 +310,7 @@ String DbConnection::GetConfigHash(const DbType::Ptr& type, const DbReference& o
|
|||
if (!objid.IsValid())
|
||||
return String();
|
||||
|
||||
std::map<std::pair<DbType::Ptr, DbReference>, String>::const_iterator it;
|
||||
|
||||
it = m_ConfigHashes.find(std::make_pair(type, objid));
|
||||
auto it = m_ConfigHashes.find(std::make_pair(type, objid));
|
||||
|
||||
if (it == m_ConfigHashes.end())
|
||||
return String();
|
||||
|
@ -330,9 +328,7 @@ void DbConnection::SetObjectID(const DbObject::Ptr& dbobj, const DbReference& db
|
|||
|
||||
DbReference DbConnection::GetObjectID(const DbObject::Ptr& dbobj) const
|
||||
{
|
||||
std::map<DbObject::Ptr, DbReference>::const_iterator it;
|
||||
|
||||
it = m_ObjectIDs.find(dbobj);
|
||||
auto it = m_ObjectIDs.find(dbobj);
|
||||
|
||||
if (it == m_ObjectIDs.end())
|
||||
return DbReference();
|
||||
|
@ -366,9 +362,7 @@ DbReference DbConnection::GetInsertID(const DbType::Ptr& type, const DbReference
|
|||
if (!objid.IsValid())
|
||||
return DbReference();
|
||||
|
||||
std::map<std::pair<DbType::Ptr, DbReference>, DbReference>::const_iterator it;
|
||||
|
||||
it = m_InsertIDs.find(std::make_pair(type, objid));
|
||||
auto it = m_InsertIDs.find(std::make_pair(type, objid));
|
||||
|
||||
if (it == m_InsertIDs.end())
|
||||
return DbReference();
|
||||
|
|
|
@ -65,7 +65,7 @@ DbType::Ptr DbType::GetByName(const String& name)
|
|||
typeName = name;
|
||||
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
DbType::TypeMap::const_iterator it = GetTypes().find(typeName);
|
||||
auto it = GetTypes().find(typeName);
|
||||
|
||||
if (it == GetTypes().end())
|
||||
return DbType::Ptr();
|
||||
|
@ -89,7 +89,7 @@ DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String&
|
|||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
DbType::ObjectMap::const_iterator it = m_Objects.find(std::make_pair(name1, name2));
|
||||
auto it = m_Objects.find(std::make_pair(name1, name2));
|
||||
|
||||
if (it != m_Objects.end())
|
||||
return it->second;
|
||||
|
|
|
@ -53,7 +53,7 @@ int icinga::FilterArrayToInt(const Array::Ptr& typeFilters, const std::map<Strin
|
|||
if (!typeFilter.IsString())
|
||||
return -1;
|
||||
|
||||
std::map<String, int>::const_iterator it = filterMap.find(typeFilter);
|
||||
auto it = filterMap.find(typeFilter);
|
||||
|
||||
if (it == filterMap.end())
|
||||
return -1;
|
||||
|
|
|
@ -138,7 +138,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name)
|
|||
{
|
||||
boost::mutex::scoped_lock lock(m_ServicesMutex);
|
||||
|
||||
std::map<String, Service::Ptr>::const_iterator it = m_Services.find(name);
|
||||
auto it = m_Services.find(name);
|
||||
|
||||
if (it != m_Services.end())
|
||||
return it->second;
|
||||
|
|
|
@ -106,7 +106,7 @@ Column Table::GetColumn(const String& name) const
|
|||
if (dname.Find(prefix) == 0)
|
||||
dname = dname.SubStr(prefix.GetLength());
|
||||
|
||||
std::map<String, Column>::const_iterator it = m_Columns.find(dname);
|
||||
auto it = m_Columns.find(dname);
|
||||
|
||||
if (it == m_Columns.end())
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Column '" + dname + "' does not exist in table '" + GetName() + "'."));
|
||||
|
|
|
@ -146,7 +146,7 @@ const std::map<String, std::vector<String> >& Url::GetQuery(void) const
|
|||
|
||||
String Url::GetQueryElement(const String& name) const
|
||||
{
|
||||
std::map<String, std::vector<String> >::const_iterator it = m_Query.find(name);
|
||||
auto it = m_Query.find(name);
|
||||
|
||||
if (it == m_Query.end())
|
||||
return String();
|
||||
|
@ -156,7 +156,7 @@ String Url::GetQueryElement(const String& name) const
|
|||
|
||||
const std::vector<String>& Url::GetQueryElements(const String& name) const
|
||||
{
|
||||
std::map<String, std::vector<String> >::const_iterator it = m_Query.find(name);
|
||||
auto it = m_Query.find(name);
|
||||
|
||||
if (it == m_Query.end()) {
|
||||
static std::vector<String> emptyVector;
|
||||
|
|
Loading…
Reference in New Issue