3 * Copyright 2000-2014 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
8 #ifndef LDAP_ATTRIBUTE_LIST_H
9 #define LDAP_ATTRIBUTE_LIST_H
16 class LDAPAsynConnection;
20 * This container class is used to store multiple LDAPAttribute-objects.
22 class LDAPAttributeList{
23 typedef std::list<LDAPAttribute> ListType;
29 typedef ListType::const_iterator const_iterator;
30 typedef ListType::iterator iterator;
36 LDAPAttributeList(const LDAPAttributeList& al);
39 * For internal use only
41 * This constructor is used by the library internally to create a
42 * list of attributes from a LDAPMessage-struct that was return by
45 LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
48 * Constructs an empty list.
55 virtual ~LDAPAttributeList();
58 * @return The number of LDAPAttribute-objects that are currently
59 * stored in this list.
64 * @return true if there are zero LDAPAttribute-objects currently
65 * stored in this list.
70 * @return A iterator that points to the first element of the list.
72 const_iterator begin() const;
75 * @return A iterator that points to the element after the last
76 * element of the list.
78 const_iterator end() const;
81 * Get an Attribute by its AttributeType
82 * @param name The name of the Attribute to look for
83 * @return a pointer to the LDAPAttribute with the AttributeType
84 * "name" or 0, if there is no Attribute of that Type
86 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 * Deletes all values of an Attribute for the list
96 * @param type The attribute type to be deleted.
98 void delAttribute(const std::string& type);
101 * Replace an Attribute in the List
102 * @param attr The attribute to add to the list.
104 void replaceAttribute(const LDAPAttribute& attr);
107 * Translates the list of Attributes to a 0-terminated array of
108 * LDAPMod-structures as needed by the C-API
110 LDAPMod** toLDAPModArray() const;
113 * This method can be used to dump the data of a LDAPResult-Object.
114 * It is only useful for debugging purposes at the moment
116 friend std::ostream& operator << (std::ostream& s,
117 const LDAPAttributeList& al);
120 #endif // LDAP_ATTRIBUTE_LIST_H