]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPSchema.h
Added utility classes for Schema parsing
[openldap] / contrib / ldapc++ / src / LDAPSchema.h
1 /*
2  * Copyright 2003, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6 #ifndef LDAP_SCHEMA_H
7 #define LDAP_SCHEMA_H
8
9 #include <ldap.h>
10 #include <string>
11 #include <map>
12
13 #include "LDAPObjClass.h"
14 #include "LDAPAttrType.h"
15
16 /**
17  * Represents the LDAP schema
18  */
19 class LDAPSchema{
20     private :
21         /**
22          * map of object classes: index is name, value is LDAPObjClass object
23          */
24         map <string, LDAPObjClass> object_classes;
25         
26         /**
27          * map of attribute types: index is name, value is LDAPAttrType object
28          */
29         map <string, LDAPAttrType> attr_types;
30
31     public :
32
33         /**
34          * Constructs an empty object
35          */   
36         LDAPSchema();
37
38         /**
39          * Destructor
40          */
41         virtual ~LDAPSchema();
42         
43         /**
44          * Fill the object_classes map
45          * @param oc description of one objectclass (string returned by search
46          * command), in form:
47          * "( SuSE.YaST.OC:5 NAME 'userTemplate' SUP objectTemplate STRUCTURAL
48          *    DESC 'User object template' MUST ( cn ) MAY ( secondaryGroup ))"
49          */
50         void setObjectClasses (const StringList &oc);
51
52          /**
53          * Fill the attr_types map
54          * @param at description of one attribute type
55          *  (string returned by search command), in form:
56          * "( SuSE.YaST.Attr:19 NAME ( 'skelDir' ) DESC ''
57          *    EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
58          */
59         void setAttributeTypes (const StringList &at);
60
61         /**
62          * Returns object class object with given name
63          */
64         LDAPObjClass getObjectClassByName (std::string name);
65         
66         /**
67          * Returns attribute type object with given name
68          */
69         LDAPAttrType getAttributeTypeByName (string name);
70
71 };
72
73 #endif // LDAP_SCHEMA_H