[haiku-commits] Re: haiku: hrev43506 - src/kits/mail headers/os/add-ons/mail_daemon src/add-ons/mail_daemon/inbound_protocols/pop3 src/kits/support headers/os/support

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 15 Dec 2011 10:24:22 +0100

Hi,

On 15.12.2011 07:46, clemens.zeidler@xxxxxxxxxxxxxx wrote:
@@ -25,6 +26,8 @@ public:

                        bool                            Remove(const BString&  
string,
                                                                        bool 
ignoreCase = false);
+                       void                            Remove(const 
BStringList&  list,
+                                                                       bool 
ignoreCase = false);

Additionally to what Ingo said, the added version of Remove() could also return bool for consistency, see below...

@@ -126,6 +127,14 @@ BStringList::Remove(const BString&  string, bool 
ignoreCase)
  }


+void
+BStringList::Remove(const BStringList&  list, bool ignoreCase)
+{
+       for (int32 i = 0; i<  list.CountStrings(); i++)
+               Remove(list.StringAt(i), ignoreCase);
+}

An implementation which returns bool could look like this:

bool removedAnything = false;
for (int32 i = list.CountStrings() - 1; i >= 0; i--) {
    removedAnything = Remove(list.StringAt(i), ignoreCase)
        || removedAnything;
}
return removedAnything;

Best regards,
-Stephan

Other related posts: