00001 /* 00002 * Copyright 2000-2002, OpenLDAP Foundation, All Rights Reserved. 00003 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 00004 */ 00005 00006 00007 #ifndef LDAP_ATTRIBUTE_H 00008 #define LDAP_ATTRIBUTE_H 00009 00010 #include<iostream> 00011 #include<string> 00012 #include<ldap.h> 00013 #include<lber.h> 00014 00015 #include <StringList.h> 00016 00020 class LDAPAttribute{ 00021 public : 00026 LDAPAttribute(); 00027 00033 LDAPAttribute(const LDAPAttribute& attr); 00034 00042 LDAPAttribute(const std::string& name, const std::string& value=""); 00043 00050 LDAPAttribute(const char* name, char **values); 00051 00059 LDAPAttribute(const std::string& name, const StringList& values); 00060 00071 LDAPAttribute(const char* name, BerValue **values); 00072 00076 ~LDAPAttribute(); 00077 00083 void addValue(const std::string& value); 00084 00092 int addValue(const BerValue *value); 00093 00103 int setValues(char** values); 00104 00114 int setValues(BerValue** values); 00115 00123 void setValues(const StringList& values); 00124 00134 BerValue** getBerValues() const; 00135 00139 const StringList& getValues() const; 00140 00144 int getNumValues() const; 00145 00149 const std::string& getName() const ; 00150 00155 void setName(const std::string& name); 00156 00163 LDAPMod* toLDAPMod() const ; 00164 00168 bool isNotPrintable() const ; 00169 00170 private : 00171 std::string m_name; 00172 StringList m_values; 00173 00178 friend std::ostream& operator << (std::ostream& s, const LDAPAttribute& attr); 00179 }; 00180 #endif //#ifndef LDAP_ATTRIBUTE_H