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
|
|
|
|
|
|
|
|
|
|
#include <list>
|
2000-10-03 14:25:34 -04:00
|
|
|
class LDAPAttribute;
|
|
|
|
|
class LDAPAsynConnection;
|
|
|
|
|
class LDAPMsg;
|
2000-09-01 14:46:32 -04:00
|
|
|
|
|
|
|
|
typedef list<LDAPAttribute> AttrList;
|
|
|
|
|
|
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{
|
2000-10-03 14:25:34 -04:00
|
|
|
typedef AttrList::const_iterator const_iterator;
|
|
|
|
|
|
2000-09-01 14:46:32 -04:00
|
|
|
private :
|
|
|
|
|
AttrList m_attrs;
|
|
|
|
|
|
|
|
|
|
public :
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copy-constructor
|
|
|
|
|
*/
|
2000-09-01 14:46:32 -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
|
|
|
*/
|
|
|
|
|
LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
|
2001-02-19 06:34:28 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an empty list.
|
|
|
|
|
*/
|
2000-09-01 14:46:32 -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
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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.
|
|
|
|
|
*/
|
2000-09-01 14:46:32 -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
|
|
|
|
|
*/
|
2000-10-03 14:25:34 -04:00
|
|
|
LDAPMod** toLDAPModArray() const;
|
2000-09-01 14:46:32 -04:00
|
|
|
|
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
|
|
|
|
|
*/
|
2000-09-01 14:46:32 -04:00
|
|
|
friend ostream& operator << (ostream& s, const LDAPAttributeList& al);
|
|
|
|
|
};
|
|
|
|
|
#endif // LDAP_ATTRIBUTE_LIST_H
|
|
|
|
|
|