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