added empty() method to the list classes. (Patch was provided by Dan

Gohman)
This commit is contained in:
Ralf Haferkamp 2001-09-07 17:43:55 +00:00
parent 6bf69cbf39
commit 2941993d8f
13 changed files with 64 additions and 3 deletions

View file

@ -66,6 +66,11 @@ size_t LDAPAttributeList::size() const{
return m_attrs.size();
}
bool LDAPAttributeList::empty() const{
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::empty()" << endl);
return m_attrs.empty();
}
LDAPAttributeList::const_iterator LDAPAttributeList::begin() const{
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::begin()" << endl);
return m_attrs.begin();

View file

@ -55,6 +55,12 @@ class LDAPAttributeList{
*/
size_t size() const;
/**
* @return true if there are zero LDAPAttribute-objects currently
* stored in this list.
*/
bool empty() const;
/**
* @return A iterator that points to the first element of the list.
*/

View file

@ -33,6 +33,11 @@ size_t LDAPControlSet::size() const {
return data.size();
}
bool LDAPControlSet::empty() const {
DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::empty()" << endl);
return data.empty();
}
LDAPControlSet::const_iterator LDAPControlSet::begin() const{
DEBUG(LDAP_DEBUG_TRACE,"LDAPControlSet::begin()" << endl);
return data.begin();
@ -51,7 +56,7 @@ void LDAPControlSet::add(const LDAPCtrl& ctrl){
LDAPControl** LDAPControlSet::toLDAPControlArray() const{
DEBUG(LDAP_DEBUG_TRACE, "LDAPControlSet::toLDAPControlArray()" << endl);
if(data.size() == 0){
if(data.empty()){
return 0;
}else{
LDAPControl** ret= new LDAPControl*[data.size()+1];

View file

@ -53,6 +53,12 @@ class LDAPControlSet {
*/
size_t size() const ;
/**
* @return true if there are zero LDAPCtrl-objects currently
* stored in this list.
*/
bool empty() const;
/**
* @return A iterator that points to the first element of the list.
*/

View file

@ -21,6 +21,10 @@ size_t LDAPEntryList::size() const{
return m_entries.size();
}
bool LDAPEntryList::empty() const{
return m_entries.empty();
}
LDAPEntryList::const_iterator LDAPEntryList::begin() const{
return m_entries.begin();
}

View file

@ -42,6 +42,11 @@ class LDAPEntryList{
*/
size_t size() const;
/**
* @return true if there are zero entries currently stored in the list.
*/
bool empty() const;
/**
* @return An iterator pointing to the first element of the list.
*/

View file

@ -46,7 +46,7 @@ const string& LDAPException::getServerMsg() const{
ostream& operator << (ostream& s, LDAPException e){
s << "Error " << e.m_res_code << ": " << e.m_res_string;
if (e.m_err_string.size() > 0) {
if (!e.m_err_string.empty()) {
s << endl << "additional info: " << e.m_err_string ;
}
return s;

View file

@ -21,6 +21,10 @@ size_t LDAPReferenceList::size() const{
return m_refs.size();
}
bool LDAPReferenceList::empty() const{
return m_refs.empty();
}
LDAPReferenceList::const_iterator LDAPReferenceList::begin() const{
return m_refs.begin();
}

View file

@ -42,6 +42,12 @@ class LDAPReferenceList{
*/
size_t size() const;
/**
* @return true if there are zero LDAPSearchReference-objects
* currently stored in this list.
*/
bool empty() const;
/**
* @return A iterator that points to the first element of the list.
*/

View file

@ -35,6 +35,10 @@ size_t LDAPUrlList::size() const{
return m_urls.size();
}
bool LDAPUrlList::empty() const{
return m_urls.empty();
}
LDAPUrlList::const_iterator LDAPUrlList::begin() const{
return m_urls.begin();
}

View file

@ -48,6 +48,12 @@ class LDAPUrlList{
*/
size_t size() const;
/**
* @return true if there are zero LDAPUrl-objects currently
* stored in this list.
*/
bool empty() const;
/**
* @return A iterator that points to the first element of the list.
*/

View file

@ -29,7 +29,7 @@ StringList::~StringList(){
}
char** StringList::toCharArray() const{
if(size() > 0){
if(!empty()){
char** ret = new char*[size()+1];
StringList::const_iterator i;
int j=0;
@ -53,6 +53,10 @@ size_t StringList::size() const{
return m_data.size();
}
bool StringList::empty() const{
return m_data.empty();
}
StringList::const_iterator StringList::begin() const{
return m_data.begin();
}

View file

@ -62,6 +62,12 @@ class StringList{
*/
size_t size() const;
/**
* @return true if there are zero strings currently
* stored in this list.
*/
bool empty() const;
/**
* @return A iterator that points to the first element of the list.
*/