]> git.sur5r.net Git - openldap/blobdiff - contrib/ldapc++/src/LDAPAttributeList.cpp
Merge remote branch 'origin/mdb.master'
[openldap] / contrib / ldapc++ / src / LDAPAttributeList.cpp
index ebb41e37f33d0ac1f3c6c7d1ed1e8788779da598..6e5f66e7f2aa863711cdf1b0f2b4754feee71934 100644 (file)
@@ -1,5 +1,6 @@
+// $OpenLDAP$
 /*
- * Copyright 2000-2007, OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -139,22 +140,30 @@ void LDAPAttributeList::addAttribute(const LDAPAttribute& attr){
     }
 }
 
-void LDAPAttributeList::replaceAttribute(const LDAPAttribute& attr)
+void LDAPAttributeList::delAttribute(const std::string& type)
 {
     DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::replaceAttribute()" << endl);
-    DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
-            "   attr:" << attr << 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(attr.getName().size() == i->getName().size()){
-           if(equal(attr.getName().begin(), attr.getName().end(), i->getName().begin(),
+       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);
 }