xref: /netbsd-src/external/bsd/openldap/dist/contrib/ldapc++/src/LDAPEntryList.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: LDAPEntryList.h,v 1.3 2021/08/14 16:14:49 christos Exp $	*/
2 
3 // $OpenLDAP$
4 /*
5  * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved.
6  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7  */
8 
9 #ifndef LDAP_ENTRY_LIST_H
10 #define LDAP_ENTRY_LIST_H
11 
12 #include <cstdio>
13 #include <list>
14 
15 class LDAPEntry;
16 
17 /**
18  * For internal use only.
19  *
20  * This class is used by LDAPSearchResults to store a std::list of
21  * LDAPEntry-Objects
22  */
23 class LDAPEntryList{
24     typedef std::list<LDAPEntry> ListType;
25 
26     public:
27 	typedef ListType::const_iterator const_iterator;
28 
29         /**
30          * Copy-Constructor
31          */
32         LDAPEntryList(const LDAPEntryList& el);
33 
34         /**
35          * Default-Constructor
36          */
37         LDAPEntryList();
38 
39         /**
40          * Destructor
41          */
42         ~LDAPEntryList();
43 
44         /**
45          * @return The number of entries currently stored in the list.
46          */
47         size_t size() const;
48 
49         /**
50          * @return true if there are zero entries currently stored in the list.
51          */
52         bool empty() const;
53 
54         /**
55          * @return An iterator pointing to the first element of the list.
56          */
57         const_iterator begin() const;
58 
59         /**
60          * @return An iterator pointing to the end of the list
61          */
62         const_iterator end() const;
63 
64         /**
65          * Adds an Entry to the end of the list.
66          */
67         void addEntry(const LDAPEntry& e);
68 
69     private:
70         ListType m_entries;
71 };
72 #endif // LDAP_ENTRY_LIST_H
73