]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPObjClass.h
added $OpenLDAP$ CVS Keyword
[openldap] / contrib / ldapc++ / src / LDAPObjClass.h
1 // $OpenLDAP$
2 /*
3  * Copyright 2003, OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #ifndef LDAP_OBJCLASS_H
8 #define LDAP_OBJCLASS_H
9
10 #include <ldap_schema.h>
11 #include <string>
12
13 #include "StringList.h"
14
15 #define SCHEMA_PARSE_FLAG    0x03
16
17
18 using namespace std;
19
20 /**
21  * Represents the Object Class (from LDAP schema)
22  */
23 class LDAPObjClass{
24     private :
25         StringList names, must, may, sup;
26         string desc, oid;
27         int kind;
28         
29     public :
30
31         /**
32          * Constructs an empty object.
33          */   
34         LDAPObjClass();
35
36         /**
37          * Copy constructor
38          */   
39         LDAPObjClass (const LDAPObjClass& oc);
40
41         /**
42          * Constructs new object and fills the data structure by parsing the
43          * argument.
44          * @param oc_item description of object class is string returned
45          * by the search command. It is in the form:
46          * "( SuSE.YaST.OC:5 NAME 'userTemplate' SUP objectTemplate STRUCTURAL
47          *    DESC 'User object template' MUST ( cn ) MAY ( secondaryGroup ))"
48          */   
49         LDAPObjClass (string oc_item);
50
51         /**
52          * Destructor
53          */
54         virtual ~LDAPObjClass();
55         
56         /**
57          * Returns object class description
58          */
59         string getDesc ();
60         
61         /**
62          * Returns object class oid
63          */
64         string getOid ();
65
66         /**
67          * Returns object class name (first one if there are more of them)
68          */
69         string getName ();
70
71         /**
72          * Returns object class kind: 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY
73          */
74         int getKind ();
75
76         /**
77          * Returns all object class names
78          */
79         StringList getNames();
80         
81         /**
82          * Returns list of required attributes
83          */
84         StringList getMust();
85         
86         /**
87          * Returns list of allowed (and not required) attributes
88          */
89         StringList getMay();
90         
91         /**
92          * Returns list of the OIDs of the superior ObjectClasses
93          */
94         StringList getSup();
95
96         void setNames (char **oc_names);
97         void setMay (char **oc_may);
98         void setMust (char **oc_must);
99         void setDesc (char *oc_desc);
100         void setOid (char *oc_oid);
101         void setKind (int oc_kind);
102         void setSup (char **oc_sup);
103         
104 };
105
106 #endif // LDAP_OBJCLASS_H