mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
added support for deleting attribute type from the list of attributes
This commit is contained in:
parent
b3b2aa70f3
commit
31780c2add
@ -140,6 +140,22 @@ 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)
|
void LDAPAttributeList::replaceAttribute(const LDAPAttribute& attr)
|
||||||
{
|
{
|
||||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::replaceAttribute()" << endl);
|
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::replaceAttribute()" << endl);
|
||||||
@ -147,15 +163,7 @@ void LDAPAttributeList::replaceAttribute(const LDAPAttribute& attr)
|
|||||||
" attr:" << attr << endl);
|
" attr:" << attr << endl);
|
||||||
|
|
||||||
LDAPAttributeList::iterator i;
|
LDAPAttributeList::iterator i;
|
||||||
for( i = m_attrs.begin(); i != m_attrs.end(); i++){
|
this->delAttribute( attr.getName() );
|
||||||
if(attr.getName().size() == i->getName().size()){
|
|
||||||
if(equal(attr.getName().begin(), attr.getName().end(), i->getName().begin(),
|
|
||||||
nocase_compare)){
|
|
||||||
m_attrs.erase(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_attrs.push_back(attr);
|
m_attrs.push_back(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,12 @@ class LDAPAttributeList{
|
|||||||
*/
|
*/
|
||||||
void addAttribute(const LDAPAttribute& attr);
|
void addAttribute(const LDAPAttribute& attr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all values of an Attribute for the list
|
||||||
|
* @param type The attribute type to be deleted.
|
||||||
|
*/
|
||||||
|
void delAttribute(const std::string& type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace an Attribute in the List
|
* Replace an Attribute in the List
|
||||||
* @param attr The attribute to add to the list.
|
* @param attr The attribute to add to the list.
|
||||||
|
@ -88,6 +88,11 @@ void LDAPEntry::addAttribute(const LDAPAttribute& attr)
|
|||||||
m_attrs->addAttribute(attr);
|
m_attrs->addAttribute(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LDAPEntry::delAttribute(const std::string& type)
|
||||||
|
{
|
||||||
|
m_attrs->delAttribute(type);
|
||||||
|
}
|
||||||
|
|
||||||
void LDAPEntry::replaceAttribute(const LDAPAttribute& attr)
|
void LDAPEntry::replaceAttribute(const LDAPAttribute& attr)
|
||||||
{
|
{
|
||||||
m_attrs->replaceAttribute(attr);
|
m_attrs->replaceAttribute(attr);
|
||||||
|
@ -79,6 +79,13 @@ class LDAPEntry{
|
|||||||
*/
|
*/
|
||||||
void addAttribute(const LDAPAttribute& attr);
|
void addAttribute(const LDAPAttribute& attr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all values of an Attribute from the list of Attributes
|
||||||
|
* (simple wrapper around LDAPAttributeList::delAttribute() ).
|
||||||
|
* @param type The attribute to delete.
|
||||||
|
*/
|
||||||
|
void delAttribute(const std::string& type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace an Attribute in the List of Attributes (simple wrapper
|
* Replace an Attribute in the List of Attributes (simple wrapper
|
||||||
* around LDAPAttributeList::replaceAttribute() ).
|
* around LDAPAttributeList::replaceAttribute() ).
|
||||||
|
Loading…
Reference in New Issue
Block a user