3 * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include "LDAPAsynConnection.h"
12 #include "LDAPException.h"
16 LDAPEntry::LDAPEntry(const LDAPEntry& entry){
17 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry(&)" << endl);
19 m_attrs=new LDAPAttributeList( *(entry.m_attrs));
23 LDAPEntry::LDAPEntry(const string& dn, const LDAPAttributeList *attrs){
24 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
25 DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
26 " dn:" << dn << endl);
28 m_attrs=new LDAPAttributeList(*attrs);
30 m_attrs=new LDAPAttributeList();
34 LDAPEntry::LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg){
35 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
36 char* tmp=ldap_get_dn(ld->getSessionHandle(),msg);
39 m_attrs = new LDAPAttributeList(ld, msg);
42 LDAPEntry::~LDAPEntry(){
43 DEBUG(LDAP_DEBUG_DESTROY,"LDAPEntry::~LDAPEntry()" << endl);
47 LDAPEntry& LDAPEntry::operator=(const LDAPEntry& from){
50 m_attrs = new LDAPAttributeList( *(from.m_attrs));
54 void LDAPEntry::setDN(const string& dn){
55 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
56 DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
57 " dn:" << dn << endl);
61 void LDAPEntry::setAttributes(LDAPAttributeList *attrs){
62 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setAttributes()" << endl);
63 DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
64 " attrs:" << *attrs << endl);
71 const string& LDAPEntry::getDN() const{
72 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getDN()" << endl);
76 const LDAPAttributeList* LDAPEntry::getAttributes() const{
77 DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getAttributes()" << endl);
81 const LDAPAttribute* LDAPEntry::getAttributeByName(const std::string& name) const
83 return m_attrs->getAttributeByName(name);
86 void LDAPEntry::addAttribute(const LDAPAttribute& attr)
88 m_attrs->addAttribute(attr);
91 void LDAPEntry::delAttribute(const std::string& type)
93 m_attrs->delAttribute(type);
96 void LDAPEntry::replaceAttribute(const LDAPAttribute& attr)
98 m_attrs->replaceAttribute(attr);
101 ostream& operator << (ostream& s, const LDAPEntry& le){
102 s << "DN: " << le.m_dn << ": " << *(le.m_attrs);