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