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