]> git.sur5r.net Git - openldap/commitdiff
added empty() method to the list classes. (Patch was provided by Dan
authorRalf Haferkamp <ralf@openldap.org>
Fri, 7 Sep 2001 17:43:55 +0000 (17:43 +0000)
committerRalf Haferkamp <ralf@openldap.org>
Fri, 7 Sep 2001 17:43:55 +0000 (17:43 +0000)
Gohman)

13 files changed:
contrib/ldapc++/src/LDAPAttributeList.cpp
contrib/ldapc++/src/LDAPAttributeList.h
contrib/ldapc++/src/LDAPControlSet.cpp
contrib/ldapc++/src/LDAPControlSet.h
contrib/ldapc++/src/LDAPEntryList.cpp
contrib/ldapc++/src/LDAPEntryList.h
contrib/ldapc++/src/LDAPException.cpp
contrib/ldapc++/src/LDAPReferenceList.cpp
contrib/ldapc++/src/LDAPReferenceList.h
contrib/ldapc++/src/LDAPUrlList.cpp
contrib/ldapc++/src/LDAPUrlList.h
contrib/ldapc++/src/StringList.cpp
contrib/ldapc++/src/StringList.h

index 8eec6f72f0af233c554071b6e2405db1db3598c0..b2b0a4208c7cb4cf6524279f9e8c0bc6e6fa65ef 100644 (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();
index a2f3dd655df710f28db66b5b83a2c56243e557a3..3b80b4b76540476cd9578b16d287c0cc17d41ba1 100644 (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.
          */
index 08cdddc938c3bfc4a252a7dab89a76827b129dae..004c69eae98e70aa24359ff34851c79b195367b7 100644 (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];
index 8538294e01c56c1899b0e4e287f4a414848f904b..081c5373dd0e488c338bc40519091526b30e9caa 100644 (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.
          */
index 7cf8aa23a73da5c56a167706cd6b2510787eba89..9d8d859ccc4bfa6c4e52c896c2d129f1f065b285 100644 (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();
 }
index 4b459642b7334d4c76de753ee84a22c8176b3354..275818bccf67d963dbb29b615b01b3a88bddf878 100644 (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.
          */
index f3022d06eb7c34c543035b5478d9133b844f35fe..2b4d417e494d8160578c03c0dfa0b5b6cb14a333 100644 (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;
index 572c96a45d282a52f6a4cd231178afeaaed81184..dc4f49ea2e8f290b796f97fcdb5fab800bae8b67 100644 (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();
 }
index 4d26fdc54f84cbaffed12ef9c6211ce535a883f3..4891e7a9be6df916d86f80e9f07917714026cc6b 100644 (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.
          */
index 6e61fa0bcb625de131e2170e5114c63b8a309cf7..38e2c7da0d6b24b9cd3d33c31e429fc58b6a3759 100644 (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();
 }
index 848c4f6c770c5cdf38d4a701fffeef1d239b5dd5..f5cd3e4505870e663de0effcad2a1206d5bda195 100644 (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.
          */
index 4189c392007b209db87e2239a1321477f9b4aaa9..287547218ff25f13e1ec5029eaf0de1cbb3be1bd 100644 (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();
 }
index dc3d678213abc1010aea75a49f7476cf168708fa..cb0ac0bfd5fceb47874e57644a433ab7db8c4718 100644 (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.
          */