2000-09-01 14:46:32 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
|
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LDAP_ATTRIBUTE_LIST_H
|
|
|
|
|
#define LDAP_ATTRIBUTE_LIST_H
|
|
|
|
|
|
2001-09-28 12:39:58 -04:00
|
|
|
#include <ldap.h>
|
2000-09-01 14:46:32 -04:00
|
|
|
#include <list>
|
2000-10-03 14:25:34 -04:00
|
|
|
class LDAPAttribute;
|
|
|
|
|
class LDAPAsynConnection;
|
|
|
|
|
class LDAPMsg;
|
2000-09-01 14:46:32 -04:00
|
|
|
|
2001-09-28 12:39:58 -04:00
|
|
|
typedef std::list<LDAPAttribute> AttrList;
|
2000-09-01 14:46:32 -04:00
|
|
|
|
2001-02-19 06:34:28 -05:00
|
|
|
/**
|
|
|
|
|
* This container class is used to store multiple LDAPAttribute-objects.
|
|
|
|
|
*/
|
2000-09-01 14:46:32 -04:00
|
|
|
class LDAPAttributeList{
|
2001-05-04 10:38:13 -04:00
|
|
|
private :
|
|
|
|
|
AttrList m_attrs;
|
2000-09-01 14:46:32 -04:00
|
|
|
|
2001-05-04 10:38:13 -04:00
|
|
|
public :
|
|
|
|
|
typedef AttrList::const_iterator const_iterator;
|
2001-03-15 06:07:58 -05:00
|
|
|
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copy-constructor
|
|
|
|
|
*/
|
2001-05-04 10:38:13 -04:00
|
|
|
LDAPAttributeList(const LDAPAttributeList& al);
|
2000-10-03 14:25:34 -04:00
|
|
|
|
2001-02-19 06:34:28 -05:00
|
|
|
/**
|
|
|
|
|
* For internal use only
|
|
|
|
|
*
|
|
|
|
|
* This constructor is used by the library internally to create a
|
|
|
|
|
* list of attributes from a LDAPMessage-struct that was return by
|
|
|
|
|
* the C-API
|
2000-10-03 14:25:34 -04:00
|
|
|
*/
|
2001-05-04 10:38:13 -04:00
|
|
|
LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an empty list.
|
|
|
|
|
*/
|
2001-05-04 10:38:13 -04:00
|
|
|
LDAPAttributeList();
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor
|
|
|
|
|
*/
|
2000-10-03 14:25:34 -04:00
|
|
|
virtual ~LDAPAttributeList();
|
|
|
|
|
|
2001-02-19 06:34:28 -05:00
|
|
|
/**
|
|
|
|
|
* @return The number of LDAPAttribute-objects that are currently
|
|
|
|
|
* stored in this list.
|
|
|
|
|
*/
|
2000-10-03 14:25:34 -04:00
|
|
|
size_t size() const;
|
2001-02-19 06:34:28 -05:00
|
|
|
|
2001-09-07 13:43:55 -04:00
|
|
|
/**
|
|
|
|
|
* @return true if there are zero LDAPAttribute-objects currently
|
|
|
|
|
* stored in this list.
|
|
|
|
|
*/
|
|
|
|
|
bool empty() const;
|
|
|
|
|
|
2001-02-19 06:34:28 -05:00
|
|
|
/**
|
|
|
|
|
* @return A iterator that points to the first element of the list.
|
|
|
|
|
*/
|
2000-10-03 14:25:34 -04:00
|
|
|
const_iterator begin() const;
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return A iterator that points to the element after the last
|
|
|
|
|
* element of the list.
|
|
|
|
|
*/
|
2000-10-03 14:25:34 -04:00
|
|
|
const_iterator end() const;
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds one element to the end of the list.
|
|
|
|
|
* @param attr The attribute to add to the list.
|
|
|
|
|
*/
|
2001-05-04 10:38:13 -04:00
|
|
|
void addAttribute(const LDAPAttribute& attr);
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Translates the list of Attributes to a 0-terminated array of
|
|
|
|
|
* LDAPMod-structures as needed by the C-API
|
|
|
|
|
*/
|
2001-05-04 10:38:13 -04:00
|
|
|
LDAPMod** toLDAPModArray() const;
|
|
|
|
|
|
2001-02-19 06:34:28 -05:00
|
|
|
/**
|
|
|
|
|
* This method can be used to dump the data of a LDAPResult-Object.
|
|
|
|
|
* It is only useful for debugging purposes at the moment
|
|
|
|
|
*/
|
2001-09-28 12:39:58 -04:00
|
|
|
friend std::ostream& operator << (std::ostream& s,
|
|
|
|
|
const LDAPAttributeList& al);
|
2000-09-01 14:46:32 -04:00
|
|
|
};
|
|
|
|
|
#endif // LDAP_ATTRIBUTE_LIST_H
|
|
|
|
|
|