1 // OpenLDAP: pkg/ldap/contrib/ldapc++/src/LDAPModList.cpp,v 1.5.6.3 2008/04/14 23:29:26 quanah Exp 2 /* 3 * Copyright 2000, 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 15 LDAPModList::LDAPModList(){ 16 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList()" << endl); 17 } 18 19 LDAPModList::LDAPModList(const LDAPModList& ml){ 20 DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList(&)" << endl); 21 m_modList=ml.m_modList; 22 } 23 24 void LDAPModList::addModification(const LDAPModification &mod){ 25 DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::addModification()" << endl); 26 m_modList.push_back(mod); 27 } 28 29 LDAPMod** 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 42 bool LDAPModList::empty() const { 43 return m_modList.empty(); 44 } 45 46 unsigned int LDAPModList::size() const { 47 return m_modList.size(); 48 } 49