ldapsdk
0.0.1
|
Represents the name an value(s) of an Attribute. More...
#include <LDAPAttribute.h>
Public Member Functions | |
LDAPAttribute () | |
Default constructor. More... | |
LDAPAttribute (const LDAPAttribute &attr) | |
Copy constructor. More... | |
LDAPAttribute (const std::string &name, const std::string &value="") | |
Construct an Attribute with a single string value. More... | |
LDAPAttribute (const char *name, char **values) | |
Construct an attribute with multiple string values. More... | |
LDAPAttribute (const std::string &name, const StringList &values) | |
Construct an attribute with multiple string values. More... | |
LDAPAttribute (const char *name, BerValue **values) | |
Construct an attribute with multiple binary coded values. More... | |
~LDAPAttribute () | |
Destructor. More... | |
void | addValue (const std::string &value) |
Add a single string value(bin/char) to the Attribute. More... | |
int | addValue (const BerValue *value) |
Add a single binary value to the Attribute. More... | |
int | setValues (char **values) |
Set the values of the attribute. More... | |
int | setValues (BerValue **values) |
Set the values of the attribute. More... | |
void | setValues (const StringList &values) |
Set the values of the attribute. More... | |
BerValue ** | getBerValues () const |
For interal use only. More... | |
const StringList & | getValues () const |
int | getNumValues () const |
const std::string & | getName () const |
void | setName (const std::string &name) |
Sets the Attribute's name (type) More... | |
LDAPMod * | toLDAPMod () const |
For internal use only. More... | |
bool | isNotPrintable () const |
Friends | |
std::ostream & | operator<< (std::ostream &s, const LDAPAttribute &attr) |
This method can be used to dump the data of a LDAPResult-Object. More... | |
Represents the name an value(s) of an Attribute.
LDAPAttribute::LDAPAttribute | ( | ) |
LDAPAttribute::LDAPAttribute | ( | const LDAPAttribute & | attr | ) |
Copy constructor.
Copies all values of an Attribute to a new one
attr | The Attribute that should be copied |
References DEBUG, LDAP_DEBUG_CONSTRUCT, and LDAP_DEBUG_PARAMETER.
LDAPAttribute::LDAPAttribute | ( | const std::string & | name, |
const std::string & | value = "" |
||
) |
Construct an Attribute with a single string value.
name | The attribute's name (type) |
value | The string value of the attribute, if "" the attribute will have no values, for LDAPv3 this values must be UTF-8 encoded |
LDAPAttribute::LDAPAttribute | ( | const char * | name, |
char ** | values | ||
) |
Construct an attribute with multiple string values.
name | The attribute's name (type) |
values | A 0-terminated array of char*. Each char* specifies one value of the attribute (UTF-8 encoded) |
References DEBUG, LDAP_DEBUG_CONSTRUCT, and LDAP_DEBUG_PARAMETER.
LDAPAttribute::LDAPAttribute | ( | const std::string & | name, |
const StringList & | values | ||
) |
Construct an attribute with multiple string values.
name | The attribute's name (type) |
values | A list of strings. Each element specifies one value of the attribute (UTF-8 or binary encoded) |
LDAPAttribute::LDAPAttribute | ( | const char * | name, |
BerValue ** | values | ||
) |
Construct an attribute with multiple binary coded values.
name | The attribute's name (type) |
values | 0-terminated array of binary attribute values The BerValue struct is declared as: struct berval{ unsigned long bv_len; char *bv_val; } BerValue; |
References DEBUG, LDAP_DEBUG_CONSTRUCT, and LDAP_DEBUG_PARAMETER.
LDAPAttribute::~LDAPAttribute | ( | ) |
Destructor.
References DEBUG, and LDAP_DEBUG_DESTROY.
void LDAPAttribute::addValue | ( | const std::string & | value | ) |
Add a single string value(bin/char) to the Attribute.
value | Value that should be added, it is copied inside the object |
Referenced by LdifReader::getEntryRecord().
int LDAPAttribute::addValue | ( | const BerValue * | value | ) |
Add a single binary value to the Attribute.
value | The binary coded value that should be added to the Attribute. |
References DEBUG, and LDAP_DEBUG_TRACE.
BerValue ** LDAPAttribute::getBerValues | ( | ) | const |
For interal use only.
This method is used to translate the values of the Attribute to 0-terminated Array of BerValue-structs as used by the C-API
References DEBUG, and LDAP_DEBUG_TRACE.
Referenced by LDAPCompareRequest::sendRequest().
const string & LDAPAttribute::getName | ( | ) | const |
References DEBUG, and LDAP_DEBUG_TRACE.
Referenced by LDAPAttributeList::addAttribute(), LdifReader::getEntryRecord(), LDAPAttributeList::replaceAttribute(), and LDAPCompareRequest::sendRequest().
int LDAPAttribute::getNumValues | ( | ) | const |
References DEBUG, and LDAP_DEBUG_TRACE.
const StringList & LDAPAttribute::getValues | ( | ) | const |
References DEBUG, and LDAP_DEBUG_TRACE.
Referenced by LDAPAttributeList::addAttribute().
bool LDAPAttribute::isNotPrintable | ( | ) | const |
Referenced by operator<<().
void LDAPAttribute::setName | ( | const std::string & | name | ) |
Sets the Attribute's name (type)
the | new name of the object |
References DEBUG, LDAP_DEBUG_PARAMETER, and LDAP_DEBUG_TRACE.
int LDAPAttribute::setValues | ( | char ** | values | ) |
Set the values of the attribute.
If the object contains some values already, they are deleted
values | 0-terminated array of char*, each char* representing a string value to add to the entry |
References DEBUG, and LDAP_DEBUG_TRACE.
int LDAPAttribute::setValues | ( | BerValue ** | values | ) |
Set the values of the attribute.
If the object does already contain some values, they will be deleted
values | 0-terminated array of BerValue*, each BerValue representing a binary value to add to the entry |
References DEBUG, and LDAP_DEBUG_TRACE.
void LDAPAttribute::setValues | ( | const StringList & | values | ) |
Set the values of the attribute.
If the object does already contain some values, they will be deleted
values | A list of string-Objects. Each string is representing a string or binary value to add to the entry |
References DEBUG, and LDAP_DEBUG_TRACE.
LDAPMod * LDAPAttribute::toLDAPMod | ( | ) | const |
For internal use only.
This method translate the attribute of the object into a LDAPMod-Structure as used by the C-API
References DEBUG, and LDAP_DEBUG_TRACE.
|
friend |
This method can be used to dump the data of a LDAPResult-Object.
It is only useful for debugging purposes at the moment