X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fsrc%2FLDAPAttributeList.cpp;h=263b35963b6558822e7a179ed188889a018a6fd1;hb=5249a1ed7ab917bac05fbae3982eba4903385d7b;hp=25fee71a96d6f55ef341f2f9f44e4fbc085c8165;hpb=d63b735e7faf557e36cf09151f65829db0745165;p=openldap diff --git a/contrib/ldapc++/src/LDAPAttributeList.cpp b/contrib/ldapc++/src/LDAPAttributeList.cpp index 25fee71a96..263b35963b 100644 --- a/contrib/ldapc++/src/LDAPAttributeList.cpp +++ b/contrib/ldapc++/src/LDAPAttributeList.cpp @@ -1,5 +1,6 @@ +// $OpenLDAP$ /* - * Copyright 2000-2007, OpenLDAP Foundation, All Rights Reserved. + * Copyright 2000-2013 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -139,6 +140,32 @@ void LDAPAttributeList::addAttribute(const LDAPAttribute& attr){ } } +void LDAPAttributeList::delAttribute(const std::string& type) +{ + DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::replaceAttribute()" << endl); + DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER, " type: " << type << endl); + LDAPAttributeList::iterator i; + for( i = m_attrs.begin(); i != m_attrs.end(); i++){ + if(type.size() == i->getName().size()){ + if(equal(type.begin(), type.end(), i->getName().begin(), + nocase_compare)){ + m_attrs.erase(i); + break; + } + } + } +} + +void LDAPAttributeList::replaceAttribute(const LDAPAttribute& attr) +{ + DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::replaceAttribute()" << endl); + DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER, + " attr:" << attr << endl); + + LDAPAttributeList::iterator i; + this->delAttribute( attr.getName() ); + m_attrs.push_back(attr); +} LDAPMod** LDAPAttributeList::toLDAPModArray() const{ DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::toLDAPModArray()" << endl);