xref: /netbsd-src/external/bsd/openldap/dist/contrib/ldapc++/src/LDAPReferenceList.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: LDAPReferenceList.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_REFERENCE_LIST_H
10 #define LDAP_REFERENCE_LIST_H
11 
12 #include <cstdio>
13 #include <list>
14 
15 class LDAPSearchReference;
16 
17 /**
18  * Container class for storing a list of Search References
19  *
20  * Used internally only by LDAPSearchResults
21  */
22 class LDAPReferenceList{
23     typedef std::list<LDAPSearchReference> ListType;
24 
25     public:
26 	typedef ListType::const_iterator const_iterator;
27 
28         /**
29          * Constructs an empty list.
30          */
31         LDAPReferenceList();
32 
33         /**
34          * Copy-constructor
35          */
36         LDAPReferenceList(const LDAPReferenceList& rl);
37 
38         /**
39          * Destructor
40          */
41         ~LDAPReferenceList();
42 
43         /**
44          * @return The number of LDAPSearchReference-objects that are
45          * currently stored in this list.
46          */
47         size_t size() const;
48 
49         /**
50          * @return true if there are zero LDAPSearchReference-objects
51          * currently stored in this list.
52          */
53         bool empty() const;
54 
55         /**
56          * @return A iterator that points to the first element of the list.
57          */
58         const_iterator begin() const;
59 
60         /**
61          * @return A iterator that points to the element after the last
62          * element of the list.
63          */
64         const_iterator end() const;
65 
66         /**
67          * Adds one element to the end of the list.
68          * @param e The LDAPSearchReference to add to the list.
69          */
70         void addReference(const LDAPSearchReference& e);
71 
72     private:
73         ListType m_refs;
74 };
75 #endif // LDAP_REFERENCE_LIST_H
76 
77