X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fsrc%2FLDAPEntry.h;h=c61022f28a20b9714983ed95c4af4fbf2c2379a1;hb=b905811d3c800b6f4031d541e424e5de871aa0c7;hp=918f533e8c014fe876db1d7be246d9740545aed6;hpb=11fbe2a45c64036a08e601270b0d1049f2c57009;p=openldap diff --git a/contrib/ldapc++/src/LDAPEntry.h b/contrib/ldapc++/src/LDAPEntry.h index 918f533e8c..c61022f28a 100644 --- a/contrib/ldapc++/src/LDAPEntry.h +++ b/contrib/ldapc++/src/LDAPEntry.h @@ -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 */ @@ -8,25 +9,108 @@ #define LDAP_ENTRY_H #include -#include "LDAPAsynConnection.h" -#include "LDAPAttributeList.h" +#include +class LDAPAsynConnection; + +/** + * This class is used to store every kind of LDAP Entry. + */ class LDAPEntry{ - public : - LDAPEntry(const LDAPEntry& entry); - LDAPEntry(const string& dn=string(), - const LDAPAttributeList *attrs=new LDAPAttributeList()); - LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg); - ~LDAPEntry(); - void setDN(const string& dn); - void setAttributes(LDAPAttributeList *attrs); - const string getDN() const ; - const LDAPAttributeList* getAttributes() const; - friend ostream& operator << (ostream& s, const LDAPEntry& le); + public : + /** + * Copy-constructor + */ + LDAPEntry(const LDAPEntry& entry); + + /** + * Constructs a new entry (also used as standard constructor). + * + * @param dn The Distinguished Name for the new entry. + * @param attrs The attributes for the new entry. + */ + LDAPEntry(const std::string& dn=std::string(), + const LDAPAttributeList *attrs=0); + + /** + * Used internally only. + * + * The constructor is used internally to create a LDAPEntry from + * the C-API's data structurs. + */ + LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg); + + /** + * Destructor + */ + ~LDAPEntry(); + + /** + * Assignment operator + */ + LDAPEntry& operator=(const LDAPEntry& from); + + /** + * Sets the DN-attribute. + * @param dn: The new DN for the entry. + */ + void setDN(const std::string& dn); + + /** + * Sets the attributes of the entry. + * @param attr: A pointer to a std::list of the new attributes. + */ + void setAttributes(LDAPAttributeList *attrs); + + /** + * Get an Attribute by its AttributeType (simple wrapper around + * LDAPAttributeList::getAttributeByName() ) + * @param name The name of the Attribute to look for + * @return a pointer to the LDAPAttribute with the AttributeType + * "name" or 0, if there is no Attribute of that Type + */ + const LDAPAttribute* getAttributeByName(const std::string& name) const; + + /** + * Adds one Attribute to the List of Attributes (simple wrapper around + * LDAPAttributeList::addAttribute() ). + * @param attr The attribute to add to the list. + */ + void addAttribute(const LDAPAttribute& attr); + + /** + * Deletes all values of an Attribute from the list of Attributes + * (simple wrapper around LDAPAttributeList::delAttribute() ). + * @param type The attribute to delete. + */ + void delAttribute(const std::string& type); + + /** + * Replace an Attribute in the List of Attributes (simple wrapper + * around LDAPAttributeList::replaceAttribute() ). + * @param attr The attribute to add to the list. + */ + void replaceAttribute(const LDAPAttribute& attr); + + /** + * @returns The current DN of the entry. + */ + const std::string& getDN() const ; + + /** + * @returns A const pointer to the attributes of the entry. + */ + const LDAPAttributeList* getAttributes() const; + + /** + * This method can be used to dump the data of a LDAPResult-Object. + * It is only useful for debugging purposes at the moment + */ + friend std::ostream& operator << (std::ostream& s, const LDAPEntry& le); private : - LDAPAttributeList *m_attrs; - string m_dn; + LDAPAttributeList *m_attrs; + std::string m_dn; }; #endif //LDAP_ENTRY_H