openldap/contrib/ldapc++/src/LDAPObjClass.cpp

131 lines
2.5 KiB
C++
Raw Normal View History

2008-03-28 07:05:10 -04:00
// $OpenLDAP$
/*
2017-01-03 15:36:47 -05:00
* Copyright 2003-2017 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "debug.h"
#include "LDAPObjClass.h"
LDAPObjClass::LDAPObjClass(){
DEBUG(LDAP_DEBUG_CONSTRUCT,
"LDAPObjClass::LDAPObjClass( )" << endl);
oid = string ();
desc = string ();
names = StringList ();
must = StringList();
may = StringList();
2003-06-25 14:12:06 -04:00
sup = StringList();
}
LDAPObjClass::LDAPObjClass (const LDAPObjClass &oc){
DEBUG(LDAP_DEBUG_CONSTRUCT,
"LDAPObjClass::LDAPObjClass( )" << endl);
oid = oc.oid;
desc = oc.desc;
names = oc.names;
must = oc.must;
may = oc.may;
kind = oc.kind;
2003-06-25 14:12:06 -04:00
sup = oc.sup;
}
2008-08-08 07:14:58 -04:00
LDAPObjClass::LDAPObjClass (string oc_item, int flags ) {
DEBUG(LDAP_DEBUG_CONSTRUCT,
"LDAPObjClass::LDAPObjClass( )" << endl);
LDAPObjectClass *o;
int ret;
const char *errp;
2008-08-08 07:14:58 -04:00
o = ldap_str2objectclass ( oc_item.c_str(), &ret, &errp, flags );
if (o) {
this->setNames (o->oc_names);
this->setDesc (o->oc_desc);
this->setOid (o->oc_oid);
this->setKind (o->oc_kind);
this->setMust (o->oc_at_oids_must);
this->setMay (o->oc_at_oids_may);
2003-06-25 14:12:06 -04:00
this->setSup (o->oc_sup_oids);
}
// else? -> error
}
LDAPObjClass::~LDAPObjClass() {
DEBUG(LDAP_DEBUG_DESTROY,"LDAPObjClass::~LDAPObjClass()" << endl);
}
void LDAPObjClass::setKind (int oc_kind) {
kind = oc_kind;
}
void LDAPObjClass::setNames (char **oc_names) {
names = StringList (oc_names);
}
void LDAPObjClass::setMust (char **oc_must) {
must = StringList (oc_must);
}
void LDAPObjClass::setMay (char **oc_may) {
may = StringList (oc_may);
}
2003-06-25 14:12:06 -04:00
void LDAPObjClass::setSup (char **oc_sup) {
sup = StringList (oc_sup);
}
void LDAPObjClass::setDesc (char *oc_desc) {
desc = string ();
if (oc_desc)
desc = oc_desc;
}
void LDAPObjClass::setOid (char *oc_oid) {
oid = string ();
if (oc_oid)
oid = oc_oid;
}
2008-04-30 11:18:28 -04:00
string LDAPObjClass::getOid() const {
return oid;
}
2008-04-30 11:18:28 -04:00
string LDAPObjClass::getDesc() const {
return desc;
}
2008-04-30 11:18:28 -04:00
StringList LDAPObjClass::getNames() const {
return names;
}
2008-04-30 11:18:28 -04:00
StringList LDAPObjClass::getMust() const {
return must;
}
2008-04-30 11:18:28 -04:00
StringList LDAPObjClass::getMay() const {
return may;
}
2008-04-30 11:18:28 -04:00
StringList LDAPObjClass::getSup() const {
2003-06-25 14:12:06 -04:00
return sup;
}
2008-04-30 11:18:28 -04:00
string LDAPObjClass::getName() const {
if (names.empty())
return "";
else
return *(names.begin());
}
2004-01-22 11:26:38 -05:00
2008-04-30 11:18:28 -04:00
int LDAPObjClass::getKind() const {
2004-01-22 11:26:38 -05:00
return kind;
}