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;
19 * This container class is used to store multiple LDAPAttribute-objects.
21 class LDAPAttributeList{
22 typedef std::list<LDAPAttribute> ListType;
28 typedef ListType::const_iterator const_iterator;
29 typedef ListType::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;
88 * Adds one element to the end of the list.
89 * @param attr The attribute to add to the list.
91 void addAttribute(const LDAPAttribute& attr);
94 * Replace an Attribute in the List
95 * @param attr The attribute to add to the list.
97 void replaceAttribute(const LDAPAttribute& attr);
100 * Translates the list of Attributes to a 0-terminated array of
101 * LDAPMod-structures as needed by the C-API
103 LDAPMod** toLDAPModArray() const;
106 * This method can be used to dump the data of a LDAPResult-Object.
107 * It is only useful for debugging purposes at the moment
109 friend std::ostream& operator << (std::ostream& s,
110 const LDAPAttributeList& al);
113 #endif // LDAP_ATTRIBUTE_LIST_H