summaryrefslogtreecommitdiffstats
path: root/contrib/ldapc++/src/LDAPModList.cpp
blob: 1ce248ae6c1b65603d8a1e86289081fba5826d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// $OpenLDAP$
/*
 * Copyright 2000-2022 The OpenLDAP Foundation, All Rights Reserved.
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 */


#include "LDAPModList.h"
#include "debug.h"

#include <cstdlib>

using namespace std;

LDAPModList::LDAPModList(){
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList()" << endl);
}

LDAPModList::LDAPModList(const LDAPModList& ml){
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList(&)" << endl);
    m_modList=ml.m_modList;
}

void LDAPModList::addModification(const LDAPModification &mod){
    DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::addModification()" << endl);
	m_modList.push_back(mod);
}

LDAPMod** LDAPModList::toLDAPModArray(){
    DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::toLDAPModArray()" << endl);
    LDAPMod **ret = (LDAPMod**) malloc(
		    (m_modList.size()+1) * sizeof(LDAPMod*));
    ret[m_modList.size()]=0;
    LDAPModList::ListType::const_iterator i;
    int j=0;
    for (i=m_modList.begin(); i != m_modList.end(); i++ , j++){
	    ret[j]=i->toLDAPMod();
    }
    return ret;
}

bool LDAPModList::empty() const {
    return m_modList.empty();
}

unsigned int LDAPModList::size() const {
    return m_modList.size();
}