Back to index

openldap  2.4.31
Public Member Functions | Private Attributes | Friends
LDAPEntry Class Reference

This class is used to store every kind of LDAP Entry. More...

#include <LDAPEntry.h>

Collaboration diagram for LDAPEntry:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LDAPEntry (const LDAPEntry &entry)
 Copy-constructor.
 LDAPEntry (const std::string &dn=std::string(), const LDAPAttributeList *attrs=0)
 Constructs a new entry (also used as standard constructor).
 LDAPEntry (const LDAPAsynConnection *ld, LDAPMessage *msg)
 Used internally only.
 ~LDAPEntry ()
 Destructor.
LDAPEntryoperator= (const LDAPEntry &from)
 Assignment operator.
void setDN (const std::string &dn)
 Sets the DN-attribute.
void setAttributes (LDAPAttributeList *attrs)
 Sets the attributes of the entry.
const LDAPAttributegetAttributeByName (const std::string &name) const
 Get an Attribute by its AttributeType (simple wrapper around LDAPAttributeList::getAttributeByName() )
void addAttribute (const LDAPAttribute &attr)
 Adds one Attribute to the List of Attributes (simple wrapper around LDAPAttributeList::addAttribute() ).
void delAttribute (const std::string &type)
 Deletes all values of an Attribute from the list of Attributes (simple wrapper around LDAPAttributeList::delAttribute() ).
void replaceAttribute (const LDAPAttribute &attr)
 Replace an Attribute in the List of Attributes (simple wrapper around LDAPAttributeList::replaceAttribute() ).
const std::string & getDN () const
const LDAPAttributeListgetAttributes () const

Private Attributes

LDAPAttributeListm_attrs
std::string m_dn

Friends

std::ostream & operator<< (std::ostream &s, const LDAPEntry &le)
 This method can be used to dump the data of a LDAPResult-Object.

Detailed Description

This class is used to store every kind of LDAP Entry.

Definition at line 19 of file LDAPEntry.h.


Constructor & Destructor Documentation

Copy-constructor.

Definition at line 16 of file LDAPEntry.cpp.

                                          {
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry(&)" << endl);
    m_dn=entry.m_dn;
    m_attrs=new LDAPAttributeList( *(entry.m_attrs));
}
LDAPEntry::LDAPEntry ( const std::string &  dn = std::string(),
const LDAPAttributeList attrs = 0 
)

Constructs a new entry (also used as standard constructor).

Parameters:
dnThe Distinguished Name for the new entry.
attrsThe attributes for the new entry.

Definition at line 23 of file LDAPEntry.cpp.

                                                                    {
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
    DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
            "   dn:" << dn << endl);
    if ( attrs )
        m_attrs=new LDAPAttributeList(*attrs);
    else
        m_attrs=new LDAPAttributeList();
    m_dn=dn;
}
LDAPEntry::LDAPEntry ( const LDAPAsynConnection ld,
LDAPMessage *  msg 
)

Used internally only.

The constructor is used internally to create a LDAPEntry from the C-API's data structurs.

Definition at line 34 of file LDAPEntry.cpp.

                                                                  {
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
    char* tmp=ldap_get_dn(ld->getSessionHandle(),msg);
    m_dn=string(tmp);
    ldap_memfree(tmp);
    m_attrs = new LDAPAttributeList(ld, msg);
}

Here is the call graph for this function:

Destructor.

Definition at line 42 of file LDAPEntry.cpp.

                     {
    DEBUG(LDAP_DEBUG_DESTROY,"LDAPEntry::~LDAPEntry()" << endl);
    delete m_attrs;
}

Member Function Documentation

Adds one Attribute to the List of Attributes (simple wrapper around LDAPAttributeList::addAttribute() ).

Parameters:
attrThe attribute to add to the list.

Definition at line 86 of file LDAPEntry.cpp.

{
    m_attrs->addAttribute(attr);
}
void LDAPEntry::delAttribute ( const std::string &  type)

Deletes all values of an Attribute from the list of Attributes (simple wrapper around LDAPAttributeList::delAttribute() ).

Parameters:
typeThe attribute to delete.

Definition at line 91 of file LDAPEntry.cpp.

const LDAPAttribute * LDAPEntry::getAttributeByName ( const std::string &  name) const

Get an Attribute by its AttributeType (simple wrapper around LDAPAttributeList::getAttributeByName() )

Parameters:
nameThe name of the Attribute to look for
Returns:
a pointer to the LDAPAttribute with the AttributeType "name" or 0, if there is no Attribute of that Type

Definition at line 81 of file LDAPEntry.cpp.

Returns:
A const pointer to the attributes of the entry.

Definition at line 76 of file LDAPEntry.cpp.

                                                       {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getAttributes()" << endl);
    return m_attrs;
}

Here is the caller graph for this function:

const string & LDAPEntry::getDN ( ) const
Returns:
The current DN of the entry.

Definition at line 71 of file LDAPEntry.cpp.

                                    {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getDN()" << endl);
    return m_dn;
}

Here is the caller graph for this function:

LDAPEntry & LDAPEntry::operator= ( const LDAPEntry from)

Assignment operator.

Definition at line 47 of file LDAPEntry.cpp.

                                                    {
    m_dn = from.m_dn;
    delete m_attrs;
    m_attrs = new LDAPAttributeList( *(from.m_attrs));
    return *this;
}

Replace an Attribute in the List of Attributes (simple wrapper around LDAPAttributeList::replaceAttribute() ).

Parameters:
attrThe attribute to add to the list.

Definition at line 96 of file LDAPEntry.cpp.

Sets the attributes of the entry.

Parameters:
attr,:A pointer to a std::list of the new attributes.

Definition at line 61 of file LDAPEntry.cpp.

                                                     {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setAttributes()" << endl);
    DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
            "   attrs:" << *attrs << endl);
    if (m_attrs != 0){
        delete m_attrs;
    }
    m_attrs=attrs;
}

Here is the caller graph for this function:

void LDAPEntry::setDN ( const std::string &  dn)

Sets the DN-attribute.

Parameters:
dn,:The new DN for the entry.

Definition at line 54 of file LDAPEntry.cpp.

                                     {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
    DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
            "   dn:" << dn << endl);
    m_dn=dn;
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const LDAPEntry le 
) [friend]

This method can be used to dump the data of a LDAPResult-Object.

It is only useful for debugging purposes at the moment

Definition at line 101 of file LDAPEntry.cpp.

                                                      {
    s << "DN: " << le.m_dn << ": " << *(le.m_attrs); 
    return s;
}

Member Data Documentation

Definition at line 113 of file LDAPEntry.h.

std::string LDAPEntry::m_dn [private]

Definition at line 114 of file LDAPEntry.h.


The documentation for this class was generated from the following files: