2 * Copyright 2003, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 #include "StringList.h"
8 #include "LDAPSchema.h"
14 LDAPSchema::LDAPSchema(){
15 DEBUG(LDAP_DEBUG_CONSTRUCT,
16 "LDAPSchema::LDAPSchema( )" << endl);
19 LDAPSchema::~LDAPSchema() {
20 DEBUG(LDAP_DEBUG_DESTROY,"LDAPSchema::~LDAPSchema()" << endl);
23 void LDAPSchema::setObjectClasses (const StringList &ocs) {
24 DEBUG(LDAP_DEBUG_TRACE,"LDAPSchema::setObjectClasses()" << endl);
26 // parse the stringlist and save it to global map...
27 StringList::const_iterator i,j;
28 for (i = ocs.begin(); i != ocs.end(); i++) {
29 LDAPObjClass oc ( (*i) );
30 StringList names = oc.getNames();
31 // there could be more names for one object...
32 for (j = names.begin(); j != names.end(); j++) {
35 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
38 object_classes [lc_name] = LDAPObjClass (oc);
43 void LDAPSchema::setAttributeTypes (const StringList &ats) {
44 DEBUG(LDAP_DEBUG_TRACE,"LDAPSchema::setAttributeTypes()" << endl);
46 // parse the stringlist and save it to global map...
47 StringList::const_iterator i,j;
48 for (i = ats.begin(); i != ats.end(); i++) {
49 LDAPAttrType at ( (*i) );
50 StringList names = at.getNames();
51 // there could be more names for one object...
52 for (j = names.begin(); j != names.end(); j++) {
55 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
58 attr_types [lc_name] = LDAPAttrType (at);
63 LDAPObjClass LDAPSchema::getObjectClassByName (string name) {
64 string lc_name = name;
66 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
69 return object_classes [lc_name];
72 LDAPAttrType LDAPSchema::getAttributeTypeByName (string name) {
73 string lc_name = name;
75 for ( k = lc_name.begin(); k != lc_name.end(); k++ ) {
79 return attr_types [lc_name];