xref: /netbsd-src/external/bsd/openldap/dist/contrib/ldapc++/src/LDAPModList.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: LDAPModList.h,v 1.3 2021/08/14 16:14:49 christos Exp $	*/
2 
3 // $OpenLDAP$
4 /*
5  * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved.
6  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7  */
8 
9 
10 #ifndef LDAP_MOD_LIST_H
11 #define LDAP_MOD_LIST_H
12 
13 #include <ldap.h>
14 #include <list>
15 #include <LDAPModification.h>
16 
17 /**
18  * This container class is used to store multiple LDAPModification-objects.
19  */
20 class LDAPModList{
21     typedef std::list<LDAPModification> ListType;
22 
23     public :
24         /**
25          * Constructs an empty list.
26          */
27         LDAPModList();
28 
29         /**
30          * Copy-constructor
31          */
32         LDAPModList(const LDAPModList&);
33 
34         /**
35          * Adds one element to the end of the list.
36          * @param mod The LDAPModification to add to the std::list.
37          */
38         void addModification(const LDAPModification &mod);
39 
40         /**
41          * Translates the list to a 0-terminated array of
42          * LDAPMod-structures as needed by the C-API
43          */
44         LDAPMod** toLDAPModArray();
45 
46         /**
47          * @returns true, if the ModList contains no Operations
48          */
49         bool empty() const;
50 
51         /**
52          * @returns number of Modifications in the ModList
53          */
54         unsigned int size() const;
55 
56     private :
57         ListType m_modList;
58 };
59 #endif //LDAP_MOD_LIST_H
60 
61 
62