Source Code (Use browser search to find items of interest.)

Class Index

kioslave'Attribute (./kdebase/kioslave/ldap/kldap.h:221)

  class Attribute : public LDAPBase
  {
  public:

    /**
     * Constructor. Initializes an attribute.
     *
     * The constructor sets up the data structures 
     * necessary to retrieve an attributes values.
     *
     * @param h The LDAP handle.
     * @param msg The LDAP message record.
     * @param n The name of the attribute.
     *
     */
    Attribute(LDAP *h, LDAPMessage *msg, const char *n);

    /// Returns the name of the attribute.
    QString name() { return _name; };
    
    /**
     * Returns the attributes values.
     *
     * Returns a list of strings containing the values
     * of the attributes.
     *
     * Note that this method only works with non-binary,
     * string value attributes.
     *
     * @param list The list that will store the values.
     *
     */     
    void getValues(QStrList &list);


    /**
     * Returns the attributes binary values.
     *
     * Returns an array of binary attribute values.
     * The caller is responsible to free these values
     * via the freeBinaryValues method.
     *
     * @return array of values.
     *
     */
    struct berval **getBinaryValues();

    /**
     * Frees value array.
     *
     * This method must be called to free the binary
     * values returnd by getBinaryValues.
     *
     * @param vals The value array.
     *
     */
    void freeBinaryValues(struct berval **vals);

  private:

    LDAPMessage *message;
    char        *_name;

  };

  /**
   * A LDAP entry.
   *
   * This class encapsulates an entry in the result of a LDAP
   * query. Each entry can have a number of attributes.
   *
   * @short A LDAP entry.
   * @author Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
   * @version $Id: kldap.h,v 1.1.1.1 1999/08/09 16:07:21 hoelzer Exp $
   *
   */

kioslave'Attribute::Attribute() (./kdebase/kioslave/ldap/kldap.cpp:335)

Attribute::Attribute(LDAP *h, LDAPMessage *msg, const char *n)
  : LDAPBase()
{
  _handle = h;
  message = msg;
  _name = const_cast<char*>(n);
}



kioslave'Attribute::getValues() (./kdebase/kioslave/ldap/kldap.cpp:344)

void Attribute::getValues(QStrList &list)
{
  char **vals;
  
  list.clear();
  
  vals = ldap_get_values(handle(), message, _name);
  if (vals) 
    for (int i=0; vals[i] != 0; i++)
      list.append(vals[i]);
  ldap_value_free(vals);
}


struct berval **Attribute::getBinaryValues()
{
  return ldap_get_values_len(handle(), message, _name);
}



kioslave'Attribute::freeBinaryValues() (./kdebase/kioslave/ldap/kldap.cpp:364)

void Attribute::freeBinaryValues(struct berval **vals)
{
  ldap_value_free_len(vals);
}