]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPModList.cpp
Added ldif_countlines()
[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 using namespace std;
11
12 LDAPModList::LDAPModList(){
13     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList()" << endl);
14 }
15
16 LDAPModList::LDAPModList(const LDAPModList& ml){
17     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList(&)" << endl);
18     m_modList=ml.m_modList;
19 }
20
21 void LDAPModList::addModification(const LDAPModification &mod){
22     DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::addModification()" << endl);
23         m_modList.push_back(mod);
24 }
25
26 LDAPMod** LDAPModList::toLDAPModArray(){
27     DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::toLDAPModArray()" << endl);
28     LDAPMod **ret = (LDAPMod**) malloc(
29                     (m_modList.size()+1) * sizeof(LDAPMod*));
30     ret[m_modList.size()]=0;
31     LDAPModList::ListType::const_iterator i;
32     int j=0;
33     for (i=m_modList.begin(); i != m_modList.end(); i++ , j++){
34             ret[j]=i->toLDAPMod();
35     }
36     return ret;
37 }