3 * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <LDAPAttributeList.h>
14 class LDAPAsynConnection;
17 * This class is used to store every kind of LDAP Entry.
25 LDAPEntry(const LDAPEntry& entry);
28 * Constructs a new entry (also used as standard constructor).
30 * @param dn The Distinguished Name for the new entry.
31 * @param attrs The attributes for the new entry.
33 LDAPEntry(const std::string& dn=std::string(),
34 const LDAPAttributeList *attrs=0);
37 * Used internally only.
39 * The constructor is used internally to create a LDAPEntry from
40 * the C-API's data structurs.
42 LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg);
52 LDAPEntry& operator=(const LDAPEntry& from);
55 * Sets the DN-attribute.
56 * @param dn: The new DN for the entry.
58 void setDN(const std::string& dn);
61 * Sets the attributes of the entry.
62 * @param attr: A pointer to a std::list of the new attributes.
64 void setAttributes(LDAPAttributeList *attrs);
67 * Get an Attribute by its AttributeType (simple wrapper around
68 * LDAPAttributeList::getAttributeByName() )
69 * @param name The name of the Attribute to look for
70 * @return a pointer to the LDAPAttribute with the AttributeType
71 * "name" or 0, if there is no Attribute of that Type
73 const LDAPAttribute* getAttributeByName(const std::string& name) const;
76 * Adds one Attribute to the List of Attributes (simple wrapper around
77 * LDAPAttributeList::addAttribute() ).
78 * @param attr The attribute to add to the list.
80 void addAttribute(const LDAPAttribute& attr);
83 * Deletes all values of an Attribute from the list of Attributes
84 * (simple wrapper around LDAPAttributeList::delAttribute() ).
85 * @param type The attribute to delete.
87 void delAttribute(const std::string& type);
90 * Replace an Attribute in the List of Attributes (simple wrapper
91 * around LDAPAttributeList::replaceAttribute() ).
92 * @param attr The attribute to add to the list.
94 void replaceAttribute(const LDAPAttribute& attr);
97 * @returns The current DN of the entry.
99 const std::string& getDN() const ;
102 * @returns A const pointer to the attributes of the entry.
104 const LDAPAttributeList* getAttributes() const;
107 * This method can be used to dump the data of a LDAPResult-Object.
108 * It is only useful for debugging purposes at the moment
110 friend std::ostream& operator << (std::ostream& s, const LDAPEntry& le);
113 LDAPAttributeList *m_attrs;
116 #endif //LDAP_ENTRY_H