Skip to content
Snippets Groups Projects
Commit 2941993d authored by Ralf Haferkamp's avatar Ralf Haferkamp
Browse files

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

Gohman)
parent 6bf69cbf
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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.
*/
......
......@@ -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];
......
......@@ -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.
*/
......
......@@ -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();
}
......
......@@ -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.
*/
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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.
*/
......
......@@ -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();
}
......
......@@ -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.
*/
......
......@@ -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();
}
......
......@@ -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.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment