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