2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
10 #include "LDAPAsynConnection.h"
11 #include "LDAPException.h"
15 LDAPEntry::LDAPEntry(const LDAPEntry& entry){
16 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry(&)" << endl);
18 m_attrs=new LDAPAttributeList( *(entry.m_attrs));
22 LDAPEntry::LDAPEntry(const string& dn, const LDAPAttributeList *attrs){
23 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
24 DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
25 " dn:" << dn << endl);
27 m_attrs=new LDAPAttributeList(*attrs);
29 m_attrs=new LDAPAttributeList();
33 LDAPEntry::LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg){
34 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
35 char* tmp=ldap_get_dn(ld->getSessionHandle(),msg);
38 m_attrs = new LDAPAttributeList(ld, msg);
41 LDAPEntry::~LDAPEntry(){
42 DEBUG(LDAP_DEBUG_DESTROY,"LDAPEntry::~LDAPEntry()" << endl);
46 LDAPEntry& LDAPEntry::operator=(const LDAPEntry& from){
49 m_attrs = new LDAPAttributeList( *(from.m_attrs));
53 void LDAPEntry::setDN(const string& dn){
54 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
55 DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
56 " dn:" << dn << endl);
60 void LDAPEntry::setAttributes(LDAPAttributeList *attrs){
61 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setAttributes()" << endl);
62 DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
63 " attrs:" << *attrs << endl);
70 const string& LDAPEntry::getDN() const{
71 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getDN()" << endl);
75 const LDAPAttributeList* LDAPEntry::getAttributes() const{
76 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getAttributes()" << endl);
80 const LDAPAttribute* LDAPEntry::getAttributeByName(const std::string& name) const
82 return m_attrs->getAttributeByName(name);
85 void LDAPEntry::addAttribute(const LDAPAttribute& attr)
87 m_attrs->addAttribute(attr);
90 void LDAPEntry::replaceAttribute(const LDAPAttribute& attr)
92 m_attrs->replaceAttribute(attr);
95 ostream& operator << (ostream& s, const LDAPEntry& le){
96 s << "DN: " << le.m_dn << ": " << *(le.m_attrs);