2 * Copyright 2000-2002, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 #ifndef LDAP_ATTRIBUTE_LIST_H
8 #define LDAP_ATTRIBUTE_LIST_H
15 class LDAPAsynConnection;
18 typedef std::list<LDAPAttribute> AttrList;
21 * This container class is used to store multiple LDAPAttribute-objects.
23 class LDAPAttributeList{
28 typedef AttrList::const_iterator const_iterator;
29 typedef AttrList::iterator iterator;
35 LDAPAttributeList(const LDAPAttributeList& al);
38 * For internal use only
40 * This constructor is used by the library internally to create a
41 * list of attributes from a LDAPMessage-struct that was return by
44 LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
47 * Constructs an empty list.
54 virtual ~LDAPAttributeList();
57 * @return The number of LDAPAttribute-objects that are currently
58 * stored in this list.
63 * @return true if there are zero LDAPAttribute-objects currently
64 * stored in this list.
69 * @return A iterator that points to the first element of the list.
71 const_iterator begin() const;
74 * @return A iterator that points to the element after the last
75 * element of the list.
77 const_iterator end() const;
80 * Get an Attribute by its AttributeType
81 * @param name The name of the Attribute to look for
82 * @return a pointer to the LDAPAttribute with the AttributeType
83 * "name" or 0, if there is no Attribute of that Type
85 const LDAPAttribute* getAttributeByName(const std::string& name) const;
89 * Adds one element to the end of the list.
90 * @param attr The attribute to add to the list.
92 void addAttribute(const LDAPAttribute& attr);
95 * Translates the list of Attributes to a 0-terminated array of
96 * LDAPMod-structures as needed by the C-API
98 LDAPMod** toLDAPModArray() const;
101 * This method can be used to dump the data of a LDAPResult-Object.
102 * It is only useful for debugging purposes at the moment
104 friend std::ostream& operator << (std::ostream& s,
105 const LDAPAttributeList& al);
108 #endif // LDAP_ATTRIBUTE_LIST_H