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