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