]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPModList.cpp
initial support for SASL
[openldap] / contrib / ldapc++ / src / LDAPModList.cpp
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6
7 #include "LDAPModList.h"
8 #include "debug.h"
9
10 #include <cstdlib>
11
12 using namespace std;
13
14 LDAPModList::LDAPModList(){
15     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList()" << endl);
16 }
17
18 LDAPModList::LDAPModList(const LDAPModList& ml){
19     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList(&)" << endl);
20     m_modList=ml.m_modList;
21 }
22
23 void LDAPModList::addModification(const LDAPModification &mod){
24     DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::addModification()" << endl);
25         m_modList.push_back(mod);
26 }
27
28 LDAPMod** LDAPModList::toLDAPModArray(){
29     DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::toLDAPModArray()" << endl);
30     LDAPMod **ret = (LDAPMod**) malloc(
31                     (m_modList.size()+1) * sizeof(LDAPMod*));
32     ret[m_modList.size()]=0;
33     LDAPModList::ListType::const_iterator i;
34     int j=0;
35     for (i=m_modList.begin(); i != m_modList.end(); i++ , j++){
36             ret[j]=i->toLDAPMod();
37     }
38     return ret;
39 }