X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fsrc%2FLDAPEntry.cpp;h=1d97a4d06554747c804c8c6624fcc9b0acdfcc1e;hb=b905811d3c800b6f4031d541e424e5de871aa0c7;hp=a4dbb79a3b64b23ad6bd02764cea0e4c75918e6b;hpb=ca7bf18fe8a0f7d10d3a92a39130e1c99fa14290;p=openldap diff --git a/contrib/ldapc++/src/LDAPEntry.cpp b/contrib/ldapc++/src/LDAPEntry.cpp index a4dbb79a3b..1d97a4d065 100644 --- a/contrib/ldapc++/src/LDAPEntry.cpp +++ b/contrib/ldapc++/src/LDAPEntry.cpp @@ -1,5 +1,6 @@ +// $OpenLDAP$ /* - * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. + * Copyright 2000-2011 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -22,8 +23,11 @@ LDAPEntry::LDAPEntry(const LDAPEntry& entry){ 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; } @@ -40,6 +44,13 @@ LDAPEntry::~LDAPEntry(){ 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, @@ -67,6 +78,26 @@ const LDAPAttributeList* LDAPEntry::getAttributes() const{ 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;