]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPModification.cpp
Initial check of the LDAP C++ SDK written by Ralf Haferkamp <rhafer@suse.de>
[openldap] / contrib / ldapc++ / src / LDAPModification.cpp
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6 // $Id: LDAPModification.cpp,v 1.3 2000/08/31 17:43:49 rhafer Exp $
7
8 #include "LDAPModification.h"
9
10 LDAPModification::LDAPModification(const LDAPAttribute& attr, mod_op op){
11         m_attr = attr;
12         m_mod_op = op;
13 }
14
15 LDAPMod *LDAPModification::toLDAPMod() const  {
16         LDAPMod* ret=m_attr.toLDAPMod();
17
18         //The mod_op value of the LDAPMod-struct needs to be ORed with the right
19         // LDAP_MOD_* constant to preserve the BIN-flag (see CAPI-draft for explanation of
20         // the LDAPMod struct)
21         switch (m_mod_op){
22                 case OP_ADD :
23                         ret->mod_op |= LDAP_MOD_ADD;
24                 break;
25                 case OP_DELETE :
26                         ret->mod_op |= LDAP_MOD_DELETE;
27                 break;
28                 case OP_REPLACE :
29                         ret->mod_op |= LDAP_MOD_REPLACE;
30                 break;
31         }
32         return ret;
33 }