+// $OpenLDAP$
/*
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include "debug.h"
#include "LDAPEntry.h"
+#include "LDAPAsynConnection.h"
#include "LDAPException.h"
using namespace std;
LDAPEntry::LDAPEntry(const string& dn, const LDAPAttributeList *attrs){
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
- " dn:" << dn << endl << " attrs:" << *attrs << endl);
- m_attrs=new LDAPAttributeList(*attrs);
+ " dn:" << dn << endl);
+ if ( attrs )
+ m_attrs=new LDAPAttributeList(*attrs);
+ else
+ m_attrs=new LDAPAttributeList();
m_dn=dn;
}
delete m_attrs;
}
+LDAPEntry& LDAPEntry::operator=(const LDAPEntry& from){
+ m_dn = from.m_dn;
+ delete m_attrs;
+ m_attrs = new LDAPAttributeList( *(from.m_attrs));
+ return *this;
+}
+
void LDAPEntry::setDN(const string& dn){
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
return m_attrs;
}
+const LDAPAttribute* LDAPEntry::getAttributeByName(const std::string& name) const
+{
+ return m_attrs->getAttributeByName(name);
+}
+
+void LDAPEntry::addAttribute(const LDAPAttribute& attr)
+{
+ m_attrs->addAttribute(attr);
+}
+
+void LDAPEntry::delAttribute(const std::string& type)
+{
+ m_attrs->delAttribute(type);
+}
+
+void LDAPEntry::replaceAttribute(const LDAPAttribute& attr)
+{
+ m_attrs->replaceAttribute(attr);
+}
+
ostream& operator << (ostream& s, const LDAPEntry& le){
s << "DN: " << le.m_dn << ": " << *(le.m_attrs);
return s;