"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/base/namespace.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

namespace.cpp  (icinga2-2.11.5):namespace.cpp  (icinga2-2.12.0)
skipping to change at line 78 skipping to change at line 78
Namespace::Iterator it; Namespace::Iterator it;
it = m_Data.find(field); it = m_Data.find(field);
if (it == m_Data.end()) if (it == m_Data.end())
return; return;
m_Data.erase(it); m_Data.erase(it);
} }
std::shared_ptr<NamespaceValue> Namespace::GetAttribute(const String& key) const NamespaceValue::Ptr Namespace::GetAttribute(const String& key) const
{ {
ObjectLock olock(this); ObjectLock olock(this);
auto it = m_Data.find(key); auto it = m_Data.find(key);
if (it == m_Data.end()) if (it == m_Data.end())
return nullptr; return nullptr;
return it->second; return it->second;
} }
void Namespace::SetAttribute(const String& key, const std::shared_ptr<NamespaceV alue>& nsVal) void Namespace::SetAttribute(const String& key, const NamespaceValue::Ptr& nsVal )
{ {
ObjectLock olock(this); ObjectLock olock(this);
m_Data[key] = nsVal; m_Data[key] = nsVal;
} }
Value Namespace::GetFieldByName(const String& field, bool, const DebugInfo& debu gInfo) const Value Namespace::GetFieldByName(const String& field, bool, const DebugInfo& debu gInfo) const
{ {
ObjectLock olock(this); ObjectLock olock(this);
skipping to change at line 165 skipping to change at line 165
void ConstEmbeddedNamespaceValue::Set(const Value& value, bool overrideFrozen, c onst DebugInfo& debugInfo) void ConstEmbeddedNamespaceValue::Set(const Value& value, bool overrideFrozen, c onst DebugInfo& debugInfo)
{ {
if (!overrideFrozen) if (!overrideFrozen)
BOOST_THROW_EXCEPTION(ScriptError("Constant must not be modified. ", debugInfo)); BOOST_THROW_EXCEPTION(ScriptError("Constant must not be modified. ", debugInfo));
EmbeddedNamespaceValue::Set(value, overrideFrozen, debugInfo); EmbeddedNamespaceValue::Set(value, overrideFrozen, debugInfo);
} }
void NamespaceBehavior::Register(const Namespace::Ptr& ns, const String& field, const Value& value, bool overrideFrozen, const DebugInfo& debugInfo) const void NamespaceBehavior::Register(const Namespace::Ptr& ns, const String& field, const Value& value, bool overrideFrozen, const DebugInfo& debugInfo) const
{ {
ns->SetAttribute(field, std::make_shared<EmbeddedNamespaceValue>(value)); ns->SetAttribute(field, new EmbeddedNamespaceValue(value));
} }
void NamespaceBehavior::Remove(const Namespace::Ptr& ns, const String& field, bo ol overrideFrozen) void NamespaceBehavior::Remove(const Namespace::Ptr& ns, const String& field, bo ol overrideFrozen)
{ {
if (!overrideFrozen) { if (!overrideFrozen) {
auto attr = ns->GetAttribute(field); auto attr = ns->GetAttribute(field);
if (dynamic_pointer_cast<ConstEmbeddedNamespaceValue>(attr)) if (dynamic_pointer_cast<ConstEmbeddedNamespaceValue>(attr))
BOOST_THROW_EXCEPTION(ScriptError("Constants must not be removed.")); BOOST_THROW_EXCEPTION(ScriptError("Constants must not be removed."));
} }
ns->RemoveAttribute(field); ns->RemoveAttribute(field);
} }
void ConstNamespaceBehavior::Register(const Namespace::Ptr& ns, const String& fi eld, const Value& value, bool overrideFrozen, const DebugInfo& debugInfo) const void ConstNamespaceBehavior::Register(const Namespace::Ptr& ns, const String& fi eld, const Value& value, bool overrideFrozen, const DebugInfo& debugInfo) const
{ {
if (m_Frozen && !overrideFrozen) if (m_Frozen && !overrideFrozen)
BOOST_THROW_EXCEPTION(ScriptError("Namespace is read-only and mus t not be modified.", debugInfo)); BOOST_THROW_EXCEPTION(ScriptError("Namespace is read-only and mus t not be modified.", debugInfo));
ns->SetAttribute(field, std::make_shared<ConstEmbeddedNamespaceValue>(val ue)); ns->SetAttribute(field, new ConstEmbeddedNamespaceValue(value));
} }
void ConstNamespaceBehavior::Remove(const Namespace::Ptr& ns, const String& fiel d, bool overrideFrozen) void ConstNamespaceBehavior::Remove(const Namespace::Ptr& ns, const String& fiel d, bool overrideFrozen)
{ {
if (m_Frozen && !overrideFrozen) if (m_Frozen && !overrideFrozen)
BOOST_THROW_EXCEPTION(ScriptError("Namespace is read-only and mus t not be modified.")); BOOST_THROW_EXCEPTION(ScriptError("Namespace is read-only and mus t not be modified."));
NamespaceBehavior::Remove(ns, field, overrideFrozen); NamespaceBehavior::Remove(ns, field, overrideFrozen);
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)