3 * Copyright 2003-2011 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 #include "LDAPSchema.h"
13 #include "StringList.h"
18 LDAPSchema::LDAPSchema(){
19 DEBUG(LDAP_DEBUG_CONSTRUCT,
20 "LDAPSchema::LDAPSchema( )" << endl);
23 LDAPSchema::~LDAPSchema() {
24 DEBUG(LDAP_DEBUG_DESTROY,"LDAPSchema::~LDAPSchema()" << endl);
27 void LDAPSchema::setObjectClasses (const StringList &ocs) {
28 DEBUG(LDAP_DEBUG_TRACE,"LDAPSchema::setObjectClasses()" << endl);
30 // parse the stringlist and save it to global map...
31 StringList::const_iterator i,j;
32 for (i = ocs.begin(); i != ocs.end(); i++) {
33 LDAPObjClass oc ( (*i) );
34 StringList names = oc.getNames();
35 // there could be more names for one object...
36 for (j = names.begin(); j != names.end(); j++) {
39 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
42 object_classes [lc_name] = LDAPObjClass (oc);
47 void LDAPSchema::setAttributeTypes (const StringList &ats) {
48 DEBUG(LDAP_DEBUG_TRACE,"LDAPSchema::setAttributeTypes()" << endl);
50 // parse the stringlist and save it to global map...
51 StringList::const_iterator i,j;
52 for (i = ats.begin(); i != ats.end(); i++) {
53 LDAPAttrType at ( (*i) );
54 StringList names = at.getNames();
55 // there could be more names for one object...
56 for (j = names.begin(); j != names.end(); j++) {
59 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
62 attr_types [lc_name] = LDAPAttrType (at);
67 LDAPObjClass LDAPSchema::getObjectClassByName (string name) {
68 string lc_name = name;
70 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
73 return object_classes [lc_name];
76 LDAPAttrType LDAPSchema::getAttributeTypeByName (string name) {
77 string lc_name = name;
79 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
83 return attr_types [lc_name];