openldap/contrib/ldapc++/src/LDAPModification.cpp
Kurt Zeilenga 84d0e26234 Initial check of the LDAP C++ SDK written by Ralf Haferkamp <rhafer@suse.de>
Copyright notices have been adjusted per on-file OpenLDAP Contributor
Assignment Agreement.
2000-09-01 18:46:32 +00:00

33 lines
816 B
C++

/*
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
// $Id: LDAPModification.cpp,v 1.3 2000/08/31 17:43:49 rhafer Exp $
#include "LDAPModification.h"
LDAPModification::LDAPModification(const LDAPAttribute& attr, mod_op op){
m_attr = attr;
m_mod_op = op;
}
LDAPMod *LDAPModification::toLDAPMod() const {
LDAPMod* ret=m_attr.toLDAPMod();
//The mod_op value of the LDAPMod-struct needs to be ORed with the right
// LDAP_MOD_* constant to preserve the BIN-flag (see CAPI-draft for explanation of
// the LDAPMod struct)
switch (m_mod_op){
case OP_ADD :
ret->mod_op |= LDAP_MOD_ADD;
break;
case OP_DELETE :
ret->mod_op |= LDAP_MOD_DELETE;
break;
case OP_REPLACE :
ret->mod_op |= LDAP_MOD_REPLACE;
break;
}
return ret;
}