]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPAttrType.h
d2cb7d5fe8a6af3ceaaf0a84deff13b87d00c68b
[openldap] / contrib / ldapc++ / src / LDAPAttrType.h
1 // $OpenLDAP$
2 /*
3  * Copyright 2003-2017 The 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 using namespace std;
16
17 /**
18  * Represents the Attribute Type (from LDAP schema)
19  */
20 class LDAPAttrType{
21     private :
22         StringList names;
23         std::string desc, oid, superiorOid, equalityOid;
24         std::string orderingOid, substringOid, syntaxOid;
25         bool single;
26         int usage;
27
28     public :
29
30         /**
31          * Constructor
32          */   
33         LDAPAttrType();
34
35         /**
36          * Constructs new object and fills the data structure by parsing the
37          * argument.
38          * @param at_item description of attribute type is string returned
39          *  by the search command. It is in the form:
40          * "( SuSE.YaST.Attr:19 NAME ( 'skelDir' ) DESC ''
41          *    EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
42          */   
43         LDAPAttrType (string at_item, int flags = LDAP_SCHEMA_ALLOW_NO_OID | 
44                       LDAP_SCHEMA_ALLOW_QUOTED );
45
46         /**
47          * Destructor
48          */
49         virtual ~LDAPAttrType();
50         
51         
52         /**
53          * Returns attribute description
54          */
55         string getDesc() const;
56         
57         /**
58          * Returns attribute oid
59          */
60         string getOid() const;
61
62         /**
63          * Returns attribute name (first one if there are more of them)
64          */
65         string getName() const;
66
67         /**
68          * Returns all attribute names
69          */
70         StringList getNames() const;
71         
72         /**
73          * Returns true if attribute type allows only single value
74          */
75         bool isSingle() const;
76         
77         /**
78          * Return the 'usage' value:
79          * (0=userApplications, 1=directoryOperation, 2=distributedOperation, 
80          *  3=dSAOperation)
81          */
82         int getUsage () const;
83         std::string getSuperiorOid() const;
84         std::string getEqualityOid() const;
85         std::string getOrderingOid() const;
86         std::string getSubstringOid() const;
87         std::string getSyntaxOid() const;
88
89         void setNames( char **at_names);
90         void setDesc(const char *at_desc);
91         void setOid(const char *at_oid);
92         void setSingle(int at_single_value);
93         void setUsage(int at_usage );
94         void setSuperiorOid( const char *oid );
95         void setEqualityOid( const char *oid );
96         void setOrderingOid( const char *oid );
97         void setSubstringOid( const char *oid );
98         void setSyntaxOid( const char *oid );
99 };
100
101 #endif // LDAP_ATTRTYPE_H