Bug 468618 - Drop array extensions in nsMsgSearchArray.h, replace nsVoidArray by nsTArray; Part 1 - drop nsMsgSearchValueArray and nsMsgResultArray. r=bienvenu sr=neil
authorMark Banner <bugzilla@standard8.plus.com>
Wed, 29 Sep 2010 14:10:48 +0100
changeset 6446 656a8a39341cd132f41a5aef580959163dc0a805
parent 6445 74ab84b7da92cfb2351fa28d60b577a66ecf2fd7
child 6447 e19b069946a4822a586258fe9f38daffc5c1d439
push idunknown
push userunknown
push dateunknown
reviewersbienvenu, neil
bugs468618
Bug 468618 - Drop array extensions in nsMsgSearchArray.h, replace nsVoidArray by nsTArray; Part 1 - drop nsMsgSearchValueArray and nsMsgResultArray. r=bienvenu sr=neil
mailnews/base/search/public/Makefile.in
mailnews/base/search/public/nsIMsgSearchSession.idl
mailnews/base/search/public/nsMsgResultElement.h
mailnews/base/search/public/nsMsgSearchAdapter.h
mailnews/base/search/public/nsMsgSearchArray.h
mailnews/base/search/public/nsMsgSearchScopeTerm.h
mailnews/base/search/src/nsMsgFilter.h
mailnews/base/search/src/nsMsgSearchSession.cpp
mailnews/base/search/src/nsMsgSearchSession.h
--- a/mailnews/base/search/public/Makefile.in
+++ b/mailnews/base/search/public/Makefile.in
@@ -43,17 +43,16 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgbase
 XPIDL_MODULE	= msgsearch
 
 EXPORTS		= \
 		nsMsgBodyHandler.h \
 		nsMsgResultElement.h \
-		nsMsgSearchArray.h \
 		nsMsgSearchBoolExpression.h \
 		nsMsgSearchScopeTerm.h \
 		nsMsgSearchTerm.h \
 		nsMsgSearchAdapter.h \
 		$(NULL)
 
 XPIDLSRCS	= \
 		nsIMsgFilter.idl \
--- a/mailnews/base/search/public/nsIMsgSearchSession.idl
+++ b/mailnews/base/search/public/nsIMsgSearchSession.idl
@@ -47,17 +47,17 @@ interface nsIMsgHdr;
 interface nsIMsgDatabase;
 
 //////////////////////////////////////////////////////////////////////////////
 // The Msg Search Session is an interface designed to make constructing
 // searches easier. Clients typically build up search terms, and then run
 // the search
 //////////////////////////////////////////////////////////////////////////////
 
-[scriptable, uuid(86c508e5-bf38-44d5-9af9-87a84754321f)]
+[scriptable, uuid(1ed69bbf-7983-4602-9a9b-2f2263a78878)]
 interface nsIMsgSearchSession :  nsISupports {
 
 /**
  * add a search term to the search session
  *
  * @param   attrib        search attribute (e.g. nsMsgSearchAttrib::Subject)
  * @param   op            search operator (e.g. nsMsgSearchOp::Contains)
  * @param   value         search value (e.g. "Dogbert", see nsIMsgSearchValue)
@@ -152,17 +152,16 @@ interface nsIMsgSearchSession :  nsISupp
   void resumeSearch();
 
   [noscript] readonly attribute voidPtr searchParam;
   readonly attribute nsMsgSearchType searchType;
 
   [noscript] nsMsgSearchType SetSearchParam(in nsMsgSearchType type,
                                             in voidPtr param);
 
-  [noscript] void AddResultElement(in nsMsgResultElement element);
   boolean MatchHdr(in nsIMsgDBHdr aMsgHdr, in nsIMsgDatabase aDatabase);
 
   void addSearchHit(in nsIMsgDBHdr header, in nsIMsgFolder folder);
 
   readonly attribute long numResults;
   attribute nsIMsgWindow window;
 
   /* these longs are all actually of type nsMsgSearchBooleanOp */
--- a/mailnews/base/search/public/nsMsgResultElement.h
+++ b/mailnews/base/search/public/nsMsgResultElement.h
@@ -35,17 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef __nsMsgResultElement_h
 #define __nsMsgResultElement_h
 
 #include "nsMsgSearchCore.h"
 #include "nsIMsgSearchAdapter.h"
-#include "nsMsgSearchArray.h"
 
 // nsMsgResultElement specifies a single search hit.
 
 //---------------------------------------------------------------------------
 // nsMsgResultElement is a list of attribute/value pairs which are used to
 // represent a search hit without requiring a message header or server connection
 //---------------------------------------------------------------------------
 
--- a/mailnews/base/search/public/nsMsgSearchAdapter.h
+++ b/mailnews/base/search/public/nsMsgSearchAdapter.h
@@ -39,17 +39,16 @@
 #define _nsMsgSearchAdapter_H_
 
 #include "nsMsgSearchCore.h"
 
 #include "nsIMsgSearchAdapter.h"
 #include "nsIMsgSearchValidityTable.h"
 #include "nsIMsgSearchValidityManager.h"
 #include "nsIMsgSearchTerm.h"
-#include "nsMsgSearchArray.h"
 #include "nsINntpIncomingServer.h"
 
 class nsIMsgSearchScopeTerm;
 
 //-----------------------------------------------------------------------------
 // These Adapter classes contain the smarts to convert search criteria from
 // the canonical structures in msg_srch.h into whatever format is required
 // by their protocol.
deleted file mode 100644
--- a/mailnews/base/search/public/nsMsgSearchArray.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __nsMsgSearchArray_h
-#define __nsMsgSearchArray_h
-
-#include "nsVoidArray.h"
-
-class nsMsgResultElement;
-class nsMsgSearchTerm;
-class nsMsgSearchScopeTerm;
-struct nsMsgSearchValue;
-
-class nsMsgSearchValueArray : public nsVoidArray
-{
-public:
-  nsMsgSearchValue *ElementAt(PRUint32 i) const { return (nsMsgSearchValue*) nsVoidArray::SafeElementAt(i); }
-};
-
-class nsMsgSearchScopeTermArray : public nsVoidArray
-{
-public:
-  nsMsgSearchScopeTerm *ElementAt(PRUint32 i) const { return (nsMsgSearchScopeTerm*) nsVoidArray::SafeElementAt(i); }
-};
-
-class nsMsgResultArray : public nsVoidArray
-{
-public:
-  nsMsgResultElement *ElementAt(PRUint32 i) const { return (nsMsgResultElement *) nsVoidArray::SafeElementAt(i); }
-};
-
-#endif
-
--- a/mailnews/base/search/public/nsMsgSearchScopeTerm.h
+++ b/mailnews/base/search/public/nsMsgSearchScopeTerm.h
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef __nsMsgSearchScopeTerm_h
 #define __nsMsgSearchScopeTerm_h
 
 #include "nsMsgSearchCore.h"
-#include "nsMsgSearchArray.h"
 #include "nsMsgSearchScopeTerm.h"
 #include "nsIMsgSearchAdapter.h"
 #include "nsIMsgFolder.h"
 #include "nsIMsgSearchAdapter.h"
 #include "nsIMsgSearchSession.h"
 #include "nsCOMPtr.h"
 #include "nsIWeakReference.h"
 #include "nsIWeakReferenceUtils.h"
--- a/mailnews/base/search/src/nsMsgFilter.h
+++ b/mailnews/base/search/src/nsMsgFilter.h
@@ -38,17 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsMsgFilter_H_
 #define _nsMsgFilter_H_
 
 #include "nscore.h"
 #include "nsISupports.h"
 #include "nsIMsgFilter.h"
-#include "nsMsgSearchArray.h"
 #include "nsIMsgSearchScopeTerm.h"
 #include "nsMsgSearchBoolExpression.h"
 #include "nsIDateTimeFormat.h"
 #include "nsIMsgFilterCustomAction.h"
 
 class nsMsgRuleAction : public nsIMsgRuleAction
 {
 public:
--- a/mailnews/base/search/src/nsMsgSearchSession.cpp
+++ b/mailnews/base/search/src/nsMsgSearchSession.cpp
@@ -67,17 +67,16 @@ nsMsgSearchSession::nsMsgSearchSession()
   m_searchPaused = PR_FALSE;
   NS_NewISupportsArray(getter_AddRefs(m_termList));
 }
 
 nsMsgSearchSession::~nsMsgSearchSession()
 {
   InterruptSearch();
   delete m_expressionTree;
-  DestroyResultList ();
   DestroyScopeList ();
   DestroyTermList ();
 }
 
 /* [noscript] void AddSearchTerm (in nsMsgSearchAttribute attrib, in nsMsgSearchOperator op, in nsMsgSearchValue value, in boolean BooleanAND, in string customString); */
 NS_IMETHODIMP
 nsMsgSearchSession::AddSearchTerm(nsMsgSearchAttribValue attrib,
                                   nsMsgSearchOpValue op,
@@ -618,40 +617,16 @@ nsresult nsMsgSearchSession::NotifyListe
     PRInt32 listenerFlags = m_listenerFlagList[m_iListener++];
     if (!listenerFlags || (listenerFlags & nsIMsgSearchSession::onSearchDone))
       listener->OnSearchDone(aStatus);
   }
   m_iListener = -1;
   return NS_OK;
 }
 
-
-NS_IMETHODIMP nsMsgSearchSession::AddResultElement (nsMsgResultElement *element)
-{
-  NS_ASSERTION(element, "no null elements");
-
-  m_resultList.AppendElement (element);
-
-  return NS_OK;
-}
-
-
-void nsMsgSearchSession::DestroyResultList ()
-{
-  nsMsgResultElement *result = nsnull;
-  for (int i = 0; i < m_resultList.Count(); i++)
-  {
-    result = m_resultList.ElementAt(i);
-    //    NS_ASSERTION (result->IsValid(), "invalid search result");
-    delete result;
-  }
-  m_resultList.Clear();
-}
-
-
 void nsMsgSearchSession::DestroyScopeList()
 {
   nsMsgSearchScopeTerm *scope = NULL;
   PRInt32 count = m_scopeList.Count();
 
   for (PRInt32 i = count-1; i >= 0; i--)
   {
     scope = m_scopeList.ElementAt(i);
--- a/mailnews/base/search/src/nsMsgSearchSession.h
+++ b/mailnews/base/search/src/nsMsgSearchSession.h
@@ -39,25 +39,31 @@
 #define nsMsgSearchSession_h___
 
 #include "nscore.h"
 #include "nsMsgSearchCore.h"
 #include "nsIMsgSearchSession.h"
 #include "nsIUrlListener.h"
 #include "nsIMsgWindow.h"
 #include "nsITimer.h"
-#include "nsMsgSearchArray.h"
 #include "nsISupportsArray.h"
 #include "nsCOMArray.h"
 #include "nsWeakReference.h"
 #include "nsTObserverArray.h"
+#include "nsMsgSearchScopeTerm.h"
 
 class nsMsgSearchAdapter;
 class nsMsgSearchBoolExpression;
 
+class nsMsgSearchScopeTermArray : public nsVoidArray
+{
+public:
+  nsMsgSearchScopeTerm *ElementAt(PRUint32 i) const { return (nsMsgSearchScopeTerm*) nsVoidArray::SafeElementAt(i); }
+};
+
 class nsMsgSearchSession : public nsIMsgSearchSession, public nsIUrlListener, public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGSEARCHSESSION
   NS_DECL_NSIURLLISTENER
 
   nsMsgSearchSession();
@@ -98,21 +104,18 @@ protected:
    *
    * This value is defined to be the index of the next listener we will process.
    * This allows us to use the sentinel value of -1 to convey that no iteration
    * is in progress (and the iteration process to abort if the value transitions
    * to -1, which we always set on conclusion of our loop).
    */
   PRInt32 m_iListener;
 
-  nsMsgResultArray m_resultList;
-
   void DestroyTermList ();
   void DestroyScopeList ();
-  void DestroyResultList ();
 
   static void TimerCallback(nsITimer *aTimer, void *aClosure);
   // support for searching multiple scopes in serial
   nsresult TimeSliceSerial (PRBool *aDone);
   nsresult TimeSliceParallel ();
 
   nsMsgSearchAttribValue m_sortAttribute;
   PRInt32 m_idxRunningScope;