X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=shibsp%2Futil%2FDOMPropertySet.cpp;h=3f45ad6caa9c32a7e4f1e10b353dc7882823f800;hb=5d254f0abe039780dde02efc07f4002394af35b4;hp=58632cbc624a44d26f20d6640376b7086f5b6827;hpb=1f9cffb1b006d9f96b8109ed2089c890cbbfdabc;p=shibboleth%2Fsp.git diff --git a/shibsp/util/DOMPropertySet.cpp b/shibsp/util/DOMPropertySet.cpp index 58632cb..3f45ad6 100644 --- a/shibsp/util/DOMPropertySet.cpp +++ b/shibsp/util/DOMPropertySet.cpp @@ -127,7 +127,6 @@ void DOMPropertySet::load( pair DOMPropertySet::getBool(const char* name, const char* ns) const { - pair ret(false,false); map >::const_iterator i; if (ns) @@ -135,11 +134,11 @@ pair DOMPropertySet::getBool(const char* name, const char* ns) const else i=m_map.find(name); - if (i!=m_map.end()) { - ret.first=true; - ret.second=(!strcmp(i->second.first,"true") || !strcmp(i->second.first,"1")); - } - return ret; + if (i!=m_map.end()) + return make_pair(true,(!strcmp(i->second.first,"true") || !strcmp(i->second.first,"1"))); + else if (m_parent) + return m_parent->getBool(name,ns); + return make_pair(false,false); } pair DOMPropertySet::getString(const char* name, const char* ns) const @@ -152,16 +151,15 @@ pair DOMPropertySet::getString(const char* name, const char* n else i=m_map.find(name); - if (i!=m_map.end()) { - ret.first=true; - ret.second=i->second.first; - } - return ret; + if (i!=m_map.end()) + return make_pair(true,i->second.first); + else if (m_parent) + return m_parent->getString(name,ns); + return pair(false,NULL); } pair DOMPropertySet::getXMLString(const char* name, const char* ns) const { - pair ret(false,NULL); map >::const_iterator i; if (ns) @@ -169,16 +167,15 @@ pair DOMPropertySet::getXMLString(const char* name, const cha else i=m_map.find(name); - if (i!=m_map.end()) { - ret.first=true; - ret.second=i->second.second; - } - return ret; + if (i!=m_map.end()) + return make_pair(true,i->second.second); + else if (m_parent) + return m_parent->getXMLString(name,ns); + return pair(false,NULL); } pair DOMPropertySet::getUnsignedInt(const char* name, const char* ns) const { - pair ret(false,0); map >::const_iterator i; if (ns) @@ -186,16 +183,15 @@ pair DOMPropertySet::getUnsignedInt(const char* name, const c else i=m_map.find(name); - if (i!=m_map.end()) { - ret.first=true; - ret.second=strtol(i->second.first,NULL,10); - } - return ret; + if (i!=m_map.end()) + return pair(true,strtol(i->second.first,NULL,10)); + else if (m_parent) + return m_parent->getUnsignedInt(name,ns); + return pair(false,0); } pair DOMPropertySet::getInt(const char* name, const char* ns) const { - pair ret(false,0); map >::const_iterator i; if (ns) @@ -203,11 +199,11 @@ pair DOMPropertySet::getInt(const char* name, const char* ns) const else i=m_map.find(name); - if (i!=m_map.end()) { - ret.first=true; - ret.second=atoi(i->second.first); - } - return ret; + if (i!=m_map.end()) + return pair(true,atoi(i->second.first)); + else if (m_parent) + return m_parent->getInt(name,ns); + return pair(false,0); } const PropertySet* DOMPropertySet::getPropertySet(const char* name, const char* ns) const @@ -219,5 +215,5 @@ const PropertySet* DOMPropertySet::getPropertySet(const char* name, const char* else i=m_nested.find(name); - return (i!=m_nested.end()) ? i->second : NULL; + return (i!=m_nested.end()) ? i->second : (m_parent ? m_parent->getPropertySet(name,ns) : NULL); }