Back to index

openldap  2.4.31
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
LDAPControlSet Class Reference

This container class is used to store multiple LDAPCtrl-objects. More...

#include <LDAPControlSet.h>

Collaboration diagram for LDAPControlSet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LDAPControlSet ()
 Constructs an empty std::list.
 LDAPControlSet (const LDAPControlSet &cs)
 Copy-constructor.
 LDAPControlSet (LDAPControl **controls)
 For internal use only.
 ~LDAPControlSet ()
 Destructor.
size_t size () const
bool empty () const
const_iterator begin () const
const_iterator end () const
void add (const LDAPCtrl &ctrl)
 Adds one element to the end of the list.
LDAPControl ** toLDAPControlArray () const
 Translates the list to a 0-terminated array of pointers to LDAPControl-structures as needed by the C-API.

Static Public Member Functions

static void freeLDAPControlArray (LDAPControl **ctrl)

Private Types

typedef CtrlList::const_iterator const_iterator

Private Attributes

CtrlList data

Detailed Description

This container class is used to store multiple LDAPCtrl-objects.

Definition at line 19 of file LDAPControlSet.h.


Member Typedef Documentation

typedef CtrlList::const_iterator LDAPControlSet::const_iterator [private]

Definition at line 20 of file LDAPControlSet.h.


Constructor & Destructor Documentation

Constructs an empty std::list.

Definition at line 12 of file LDAPControlSet.cpp.

                              {
}

Copy-constructor.

Definition at line 15 of file LDAPControlSet.cpp.

                                                      {
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPControlSet::LDAPControlSet(&)" << endl);
    data=cs.data;
}

For internal use only.

This constructor creates a new LDAPControlSet for a 0-terminiated array of LDAPControl-structures as used by the C-API

Parameters:
controls,:pointer to a 0-terminated array of pointers to LDAPControll-structures
Note:
: untested til now. Due to lack of server that return Controls

Definition at line 20 of file LDAPControlSet.cpp.

                                                    {
    DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPControlSet::LDAPControlSet()" << endl);
    if(controls != 0){
        LDAPControl** i;
        for( i=controls; *i!=0;i++) {
            add(LDAPCtrl(*i));
        }
    }
}

Destructor.

Definition at line 30 of file LDAPControlSet.cpp.

                               {
    DEBUG(LDAP_DEBUG_DESTROY,"LDAPControlSet::~LDAPControlSet()" << endl);
}

Member Function Documentation

Adds one element to the end of the list.

Parameters:
ctrlThe Control to add to the list.

Definition at line 55 of file LDAPControlSet.cpp.

                                            {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::add()" << endl);
    data.push_back(ctrl);
}

Here is the caller graph for this function:

Returns:
A iterator that points to the first element of the list.

Definition at line 44 of file LDAPControlSet.cpp.

                                                        {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::begin()" << endl);
    return data.begin();
}
bool LDAPControlSet::empty ( ) const
Returns:
true if there are zero LDAPCtrl-objects currently stored in this list.

Definition at line 39 of file LDAPControlSet.cpp.

                                 {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::empty()" << endl);
    return data.empty();
}
Returns:
A iterator that points to the element after the last element of the list.

Definition at line 50 of file LDAPControlSet.cpp.

                                                      {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::end()" << endl);
    return data.end ();
}

Definition at line 76 of file LDAPControlSet.cpp.

                                                           {
    DEBUG(LDAP_DEBUG_TRACE, "LDAPControlSet::freeLDAPControlArray()" << endl);
    if( ctrl ){
        for( LDAPControl **i = ctrl; *i != 0; ++i ){
           LDAPCtrl::freeLDAPControlStruct(*i);
       }
    }
    delete[] ctrl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

size_t LDAPControlSet::size ( ) const
Returns:
The number of LDAPCtrl-objects that are currently stored in this list.

Definition at line 34 of file LDAPControlSet.cpp.

                                  {
    DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::size()" << endl);
    return data.size();
}

Translates the list to a 0-terminated array of pointers to LDAPControl-structures as needed by the C-API.

Definition at line 60 of file LDAPControlSet.cpp.

                                                      {
    DEBUG(LDAP_DEBUG_TRACE, "LDAPControlSet::toLDAPControlArray()" << endl);
    if(data.empty()){
        return 0;
    }else{
        LDAPControl** ret= new LDAPControl*[data.size()+1];
        CtrlList::const_iterator i;
        int j=0;
        for(i=data.begin(); i!=data.end(); i++,j++){
            ret[j] = i->getControlStruct();
        }
        ret[data.size()]=0;
        return ret;
    }
}

Member Data Documentation

Definition at line 87 of file LDAPControlSet.h.


The documentation for this class was generated from the following files: