Bug 489617 - Update mozStorageResultSet.* to follow style guidelines
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Fri, 08 May 2009 20:29:56 -0400
changeset 28141 5293c44639243bf3f111efb1ee4bc31a65a2f559
parent 28140 4d9fc3354fbc77470bc4db3ac65c8bf3a2a6f0aa
child 28142 c9b6ca7c431f15f2da557647b02c86530790f4bb
push idunknown
push userunknown
push dateunknown
bugs489617
milestone1.9.2a1pre
Bug 489617 - Update mozStorageResultSet.* to follow style guidelines Consistent spacing, consistent naming, and namespaces - OH MY! r=asuth
storage/src/mozStorageAsyncStatementExecution.cpp
storage/src/mozStorageAsyncStatementExecution.h
storage/src/mozStorageResultSet.cpp
storage/src/mozStorageResultSet.h
--- a/storage/src/mozStorageAsyncStatementExecution.cpp
+++ b/storage/src/mozStorageAsyncStatementExecution.cpp
@@ -337,17 +337,17 @@ AsyncExecuteStatements::buildAndNotifyRe
 
   // At this point, it is safe to not hold the mutex and allow for cancelation.
   // We may add an event to the calling thread, but that thread will not end
   // up running when it checks back with us to see if it should run.
   nsAutoUnlock cancelationScope(mLock);
 
   // Build result object if we need it.
   if (!mResultSet)
-    mResultSet = new mozStorageResultSet();
+    mResultSet = new ResultSet();
   NS_ENSURE_TRUE(mResultSet, NS_ERROR_OUT_OF_MEMORY);
 
   nsRefPtr<mozStorageRow> row(new mozStorageRow());
   NS_ENSURE_TRUE(row, NS_ERROR_OUT_OF_MEMORY);
 
   nsresult rv = row->initialize(aStatement);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/storage/src/mozStorageAsyncStatementExecution.h
+++ b/storage/src/mozStorageAsyncStatementExecution.h
@@ -45,22 +45,22 @@
 #include "nsAutoPtr.h"
 #include "nsThreadUtils.h"
 
 #include "mozIStoragePendingStatement.h"
 #include "mozIStorageStatementCallback.h"
 
 struct sqlite3_stmt;
 class mozStorageTransaction;
-class mozStorageResultSet;
 
 namespace mozilla {
 namespace storage {
 
 class Connection;
+class ResultSet;
 
 class AsyncExecuteStatements : public nsIRunnable
                              , public mozIStoragePendingStatement
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
   NS_DECL_MOZISTORAGEPENDINGSTATEMENT
@@ -170,17 +170,17 @@ private:
    */
   nsresult notifyResults();
 
   sqlite3_stmt_array mStatements;
   mozIStorageConnection *mConnection;
   mozStorageTransaction *mTransactionManager;
   mozIStorageStatementCallback *mCallback;
   nsCOMPtr<nsIThread> mCallingThread;
-  nsRefPtr<mozStorageResultSet> mResultSet;
+  nsRefPtr<ResultSet> mResultSet;
 
   /**
    * The maximum amount of time we want to wait between results.  Defined by
    * MAX_MILLISECONDS_BETWEEN_RESULTS and set at construction.
    */
   const PRIntervalTime mMaxIntervalWait;
 
   /**
--- a/storage/src/mozStorageResultSet.cpp
+++ b/storage/src/mozStorageResultSet.cpp
@@ -35,47 +35,56 @@
  * 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 ***** */
 
 #include "mozStorageRow.h"
 #include "mozStorageResultSet.h"
 
+namespace mozilla {
+namespace storage {
+
 ////////////////////////////////////////////////////////////////////////////////
-//// mozStorageResultSet
+//// ResultSet
+
+ResultSet::ResultSet()
+: mCurrentIndex(0)
+{
+}
+
+ResultSet::~ResultSet()
+{
+  mData.Clear();
+}
+
+nsresult
+ResultSet::add(mozIStorageRow *aRow)
+{
+  return mData.AppendObject(aRow) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /**
  * Note:  This object is only ever accessed on one thread at a time.  It it not
  *        threadsafe, but it does need threadsafe AddRef and Release.
  */
-NS_IMPL_THREADSAFE_ISUPPORTS1(mozStorageResultSet, mozIStorageResultSet)
-
-mozStorageResultSet::mozStorageResultSet() :
-    mCurrentIndex(0)
-{
-}
-
-mozStorageResultSet::~mozStorageResultSet()
-{
-  mData.Clear();
-}
-
-nsresult
-mozStorageResultSet::add(mozIStorageRow *aRow)
-{
-  return mData.AppendObject(aRow) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}
+NS_IMPL_THREADSAFE_ISUPPORTS1(
+  ResultSet,
+  mozIStorageResultSet
+)
 
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIStorageResultSet
 
 NS_IMETHODIMP
-mozStorageResultSet::GetNextRow(mozIStorageRow **_row)
+ResultSet::GetNextRow(mozIStorageRow **_row)
 {
   if (mCurrentIndex >= mData.Count()) {
     // Just return null here
     return NS_OK;
   }
 
   NS_ADDREF(*_row = mData.ObjectAt(mCurrentIndex++));
   return NS_OK;
 }
+
+} // namespace storage
+} // namespace mozilla
--- a/storage/src/mozStorageResultSet.h
+++ b/storage/src/mozStorageResultSet.h
@@ -39,39 +39,46 @@
 
 #ifndef __mozStorageResultSet_h__
 #define __mozStorageResultSet_h__
 
 #include "mozIStorageResultSet.h"
 #include "nsCOMArray.h"
 class mozIStorageRow;
 
-class mozStorageResultSet : public mozIStorageResultSet
+namespace mozilla {
+namespace storage {
+
+class ResultSet : public mozIStorageResultSet
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGERESULTSET
 
-  mozStorageResultSet();
-  ~mozStorageResultSet();
+  ResultSet();
+  ~ResultSet();
 
   /**
    * Adds a tuple to this result set.
    */
   nsresult add(mozIStorageRow *aTuple);
 
   /**
    * @returns the number of rows this result set holds.
    */
   PRInt32 rows() const { return mData.Count(); }
 
 private:
   /**
    * Stores the current index of the active result set.
    */
   PRInt32 mCurrentIndex;
+
   /**
    * Stores the tuples.
    */
   nsCOMArray<mozIStorageRow> mData;
 };
 
+} // namespace storage
+} // namespace mozilla
+
 #endif // __mozStorageResultSet_h__