]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPAttrType.h
6b2b3b62bfdd7d39bbe6b8d8874b92988aa75445
[openldap] / contrib / ldapc++ / src / LDAPAttrType.h
1 // $OpenLDAP$
2 /*
3  * Copyright 2003, OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #ifndef LDAP_ATTRTYPE_H
8 #define LDAP_ATTRTYPE_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 Attribute Type (from LDAP schema)
22  */
23 class LDAPAttrType{
24     private :
25         StringList names;
26         string desc, oid;
27         bool single;
28         int usage;
29         
30     public :
31
32         /**
33          * Constructor
34          */   
35         LDAPAttrType();
36
37         /**
38          * Copy constructor
39          */   
40         LDAPAttrType (const LDAPAttrType& oc);
41
42         /**
43          * Constructs new object and fills the data structure by parsing the
44          * argument.
45          * @param at_item description of attribute type is string returned
46          *  by the search command. It is in the form:
47          * "( SuSE.YaST.Attr:19 NAME ( 'skelDir' ) DESC ''
48          *    EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
49          */   
50         LDAPAttrType (string at_item);
51
52         /**
53          * Destructor
54          */
55         virtual ~LDAPAttrType();
56         
57         
58         /**
59          * Returns attribute description
60          */
61         string getDesc() const;
62         
63         /**
64          * Returns attribute oid
65          */
66         string getOid() const;
67
68         /**
69          * Returns attribute name (first one if there are more of them)
70          */
71         string getName() const;
72
73         /**
74          * Returns all attribute names
75          */
76         StringList getNames() const;
77         
78         /**
79          * Returns true if attribute type allows only single value
80          */
81         bool isSingle() const;
82         
83         /**
84          * Return the 'usage' value:
85          * (0=userApplications, 1=directoryOperation, 2=distributedOperation, 
86          *  3=dSAOperation)
87          */
88         int getUsage () const;
89
90         void setNames (char **at_names);
91         void setDesc (char *at_desc);
92         void setOid (char *at_oid);
93         void setSingle (int at_single_value);
94         void setUsage (int at_usage );
95 };
96
97 #endif // LDAP_ATTRTYPE_H