]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPUrlList.h
Added ldif_countlines()
[openldap] / contrib / ldapc++ / src / LDAPUrlList.h
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6 #ifndef LDAP_URL_LIST_H
7 #define LDAP_URL_LIST_H
8
9 #include <list>
10 #include <LDAPUrl.h>
11
12 /**
13  * This container class is used to store multiple LDAPUrl-objects.
14  */
15 class LDAPUrlList{
16     typedef std::list<LDAPUrl> ListType;
17
18     public:
19         typedef ListType::const_iterator const_iterator;
20
21         /**
22          * Constructs an empty list.
23          */   
24         LDAPUrlList();
25
26         /**
27          * Copy-constructor
28          */
29         LDAPUrlList(const LDAPUrlList& urls);
30
31         /**
32          * For internal use only
33          *
34          * This constructor is used by the library internally to create a
35          * std::list of URLs from a array of C-strings that was return by
36          * the C-API
37          */
38         LDAPUrlList(char** urls);
39
40         /**
41          * Destructor
42          */
43         ~LDAPUrlList();
44
45         /**
46          * @return The number of LDAPUrl-objects that are currently
47          * stored in this list.
48          */
49         size_t size() const;
50
51         /**
52          * @return true if there are zero LDAPUrl-objects currently
53          * stored in this list.
54          */
55         bool empty() const;
56
57         /**
58          * @return A iterator that points to the first element of the list.
59          */
60         const_iterator begin() const;
61         
62         /**
63          * @return A iterator that points to the element after the last
64          * element of the list.
65          */
66         const_iterator end() const;
67
68         /**
69          * Adds one element to the end of the list.
70          * @param attr The attribute to add to the list.
71          */
72         void add(const LDAPUrl& url);
73
74     private :
75         ListType m_urls;
76 };
77 #endif //LDAP_URL_LIST_H