]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPEntry.h
use URIs instead of hostname/port
[openldap] / contrib / ldapc++ / src / LDAPEntry.h
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6
7 #ifndef LDAP_ENTRY_H
8 #define LDAP_ENTRY_H
9 #include <ldap.h>
10
11 #include <LDAPAttributeList.h>
12
13 class LDAPAsynConnection;
14
15 /**
16  * This class is used to store every kind of LDAP Entry.
17  */
18 class LDAPEntry{
19
20         public :
21         /**
22          * Copy-constructor
23          */
24                 LDAPEntry(const LDAPEntry& entry);
25
26         /**
27          * Constructs a new entry (also used as standard constructor).
28          *
29          * @param dn    The Distinguished Name for the new entry.
30          * @param attrs The attributes for the new entry.
31          */
32                 LDAPEntry(const std::string& dn=std::string(), 
33                 const LDAPAttributeList *attrs=new LDAPAttributeList());
34
35         /**
36          * Used internally only.
37          *
38          * The constructor is used internally to create a LDAPEntry from
39          * the C-API's data structurs.
40          */ 
41                 LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg);
42
43         /**
44          * Destructor
45          */
46                 ~LDAPEntry();
47         
48         /**
49          * Sets the DN-attribute.
50          * @param dn: The new DN for the entry.
51          */
52                 void setDN(const std::string& dn);
53
54         /**
55          * Sets the attributes of the entry.
56          * @param attr: A pointer to a std::list of the new attributes.
57          */
58                 void setAttributes(LDAPAttributeList *attrs);
59
60         /**
61          * @returns The current DN of the entry.
62          */
63                 const std::string& getDN() const ;
64
65         /**
66          * @returns A const pointer to the attributes of the entry.  
67          */
68                 const LDAPAttributeList* getAttributes() const;
69
70         /**
71          * This method can be used to dump the data of a LDAPResult-Object.
72          * It is only useful for debugging purposes at the moment
73          */
74                 friend std::ostream& operator << (std::ostream& s, const LDAPEntry& le);
75         
76     private :
77
78                 LDAPAttributeList *m_attrs;
79                 std::string m_dn;
80 };
81 #endif  //LDAP_ENTRY_H