summaryrefslogtreecommitdiffstats
path: root/contrib/ldapc++/src/LDAPObjClass.h
blob: e9c7b4211e6153266303dee01c12e63cbd36c172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// $OpenLDAP$
/*
 * Copyright 2003-2022 The OpenLDAP Foundation, All Rights Reserved.
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 */

#ifndef LDAP_OBJCLASS_H
#define LDAP_OBJCLASS_H

#include <ldap_schema.h>
#include <string>

#include "StringList.h"

using namespace std;

/**
 * Represents the Object Class (from LDAP schema)
 */
class LDAPObjClass{
    private :
	StringList names, must, may, sup;
	string desc, oid;
	int kind;
	
    public :

        /**
         * Constructs an empty object.
         */   
        LDAPObjClass();

        /**
         * Copy constructor
	 */   
	LDAPObjClass( const LDAPObjClass& oc );

        /**
	 * Constructs new object and fills the data structure by parsing the
	 * argument.
	 * @param oc_item description of object class is string returned
	 * by the search command. It is in the form:
	 * "( SuSE.YaST.OC:5 NAME 'userTemplate' SUP objectTemplate STRUCTURAL
	 *    DESC 'User object template' MUST ( cn ) MAY ( secondaryGroup ))"
         */   
        LDAPObjClass (string oc_item, int flags = LDAP_SCHEMA_ALLOW_NO_OID |
                      LDAP_SCHEMA_ALLOW_QUOTED);

        /**
         * Destructor
         */
        virtual ~LDAPObjClass();
	
	/**
	 * Returns object class description
	 */
	string getDesc() const;
	
	/**
	 * Returns object class oid
	 */
	string getOid() const;

	/**
	 * Returns object class name (first one if there are more of them)
	 */
	string getName() const;

	/**
	 * Returns object class kind: 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY
	 */
	int getKind() const;

	/**
	 * Returns all object class names
	 */
	StringList getNames() const;
	
	/**
	 * Returns list of required attributes
	 */
	StringList getMust() const;
	
	/**
	 * Returns list of allowed (and not required) attributes
	 */
	StringList getMay() const;
	
        /**
	 * Returns list of the OIDs of the superior ObjectClasses
	 */
	StringList getSup() const;

	void setNames (char **oc_names);
	void setMay (char **oc_may);
	void setMust (char **oc_must);
	void setDesc (char *oc_desc);
	void setOid (char *oc_oid);
	void setKind (int oc_kind);
	void setSup (char **oc_sup);
	
};

#endif // LDAP_OBJCLASS_H