1d11b170bStron // $OpenLDAP$ 22de962bdSlukem /* 3*e670fd5cSchristos * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved. 42de962bdSlukem * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 52de962bdSlukem */ 62de962bdSlukem 72de962bdSlukem 82de962bdSlukem #include "LDAPModification.h" 92de962bdSlukem #include "debug.h" 102de962bdSlukem 112de962bdSlukem using namespace std; 122de962bdSlukem LDAPModification(const LDAPAttribute & attr,mod_op op)132de962bdSlukemLDAPModification::LDAPModification(const LDAPAttribute& attr, mod_op op){ 142de962bdSlukem DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModification::LDAPModification()" << endl); 152de962bdSlukem DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER, 162de962bdSlukem " attr:" << attr << endl); 172de962bdSlukem m_attr = attr; 182de962bdSlukem m_mod_op = op; 192de962bdSlukem } 202de962bdSlukem toLDAPMod() const212de962bdSlukemLDAPMod* LDAPModification::toLDAPMod() const { 222de962bdSlukem DEBUG(LDAP_DEBUG_TRACE,"LDAPModification::toLDAPMod()" << endl); 232de962bdSlukem LDAPMod* ret=m_attr.toLDAPMod(); 242de962bdSlukem 252de962bdSlukem //The mod_op value of the LDAPMod-struct needs to be ORed with the right 262de962bdSlukem // LDAP_MOD_* constant to preserve the BIN-flag (see CAPI-draft for 272de962bdSlukem // explanation of the LDAPMod struct) 282de962bdSlukem switch (m_mod_op){ 292de962bdSlukem case OP_ADD : 302de962bdSlukem ret->mod_op |= LDAP_MOD_ADD; 312de962bdSlukem break; 322de962bdSlukem case OP_DELETE : 332de962bdSlukem ret->mod_op |= LDAP_MOD_DELETE; 342de962bdSlukem break; 352de962bdSlukem case OP_REPLACE : 362de962bdSlukem ret->mod_op |= LDAP_MOD_REPLACE; 372de962bdSlukem break; 382de962bdSlukem } 392de962bdSlukem return ret; 402de962bdSlukem } 41d11b170bStron getAttribute() const42d11b170bStronconst LDAPAttribute* LDAPModification::getAttribute() const { 43d11b170bStron return &m_attr; 44d11b170bStron } 45d11b170bStron getOperation() const46d11b170bStronLDAPModification::mod_op LDAPModification::getOperation() const { 47d11b170bStron return m_mod_op; 48d11b170bStron } 49