~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to contrib/ldapc++/src/LDAPModification.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2008-07-10 14:45:49 UTC
  • Revision ID: james.westby@ubuntu.com-20080710144549-wck73med0e72gfyo
Tags: upstream-2.4.10
ImportĀ upstreamĀ versionĀ 2.4.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $OpenLDAP: pkg/ldap/contrib/ldapc++/src/LDAPModification.cpp,v 1.4.10.1 2008/04/14 23:09:26 quanah Exp $
 
2
/*
 
3
 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
 
4
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 
5
 */
 
6
 
 
7
 
 
8
#include "LDAPModification.h"
 
9
#include "debug.h"
 
10
 
 
11
using namespace std;
 
12
 
 
13
LDAPModification::LDAPModification(const LDAPAttribute& attr, mod_op op){
 
14
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModification::LDAPModification()" << endl);
 
15
    DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
 
16
            "   attr:" << attr << endl);
 
17
    m_attr = attr;
 
18
    m_mod_op = op;
 
19
}
 
20
 
 
21
LDAPMod* LDAPModification::toLDAPMod() const  {
 
22
    DEBUG(LDAP_DEBUG_TRACE,"LDAPModification::toLDAPMod()" << endl);
 
23
    LDAPMod* ret=m_attr.toLDAPMod();
 
24
 
 
25
    //The mod_op value of the LDAPMod-struct needs to be ORed with the right
 
26
    // LDAP_MOD_* constant to preserve the BIN-flag (see CAPI-draft for 
 
27
    // explanation of the LDAPMod struct)
 
28
    switch (m_mod_op){
 
29
        case OP_ADD :
 
30
            ret->mod_op |= LDAP_MOD_ADD;
 
31
        break;
 
32
        case OP_DELETE :
 
33
            ret->mod_op |= LDAP_MOD_DELETE;
 
34
        break;
 
35
        case OP_REPLACE :
 
36
            ret->mod_op |= LDAP_MOD_REPLACE;
 
37
        break;
 
38
    }
 
39
    return ret;
 
40
}