Bug 489661 - Update mozStorageStatementWrapper.* to follow style guidelines
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Fri, 08 May 2009 20:29:56 -0400
changeset 28143 1d27d30234e251dd090ef5e523080929a174fd1b
parent 28142 c9b6ca7c431f15f2da557647b02c86530790f4bb
child 28144 16e1a256b772d0c618f5bbb641b79c1d7ffdc0a2
push id6912
push usersdwilsh@shawnwilsher.com
push dateSat, 09 May 2009 00:34:46 +0000
treeherdermozilla-central@b6f09258a505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs489661
milestone1.9.2a1pre
Bug 489661 - Update mozStorageStatementWrapper.* to follow style guidelines Consistent spacing, consistent naming, and namespaces - OH MY! r=asuth
storage/build/mozStorageModule.cpp
storage/src/mozStorageStatementWrapper.cpp
storage/src/mozStorageStatementWrapper.h
--- a/storage/build/mozStorageModule.cpp
+++ b/storage/build/mozStorageModule.cpp
@@ -47,30 +47,30 @@
 
 #include "mozStorageCID.h"
 
 namespace mozilla {
 namespace storage {
 
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Service,
                                          Service::getSingleton)
+NS_GENERIC_FACTORY_CONSTRUCTOR(StatementWrapper)
+
 
 } // namespace storage
 } // namespace mozilla
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(mozStorageStatementWrapper)
-
 static const nsModuleComponentInfo components[] =
 {
     { "Unified Data Store Service",
       MOZ_STORAGE_SERVICE_CID,
       MOZ_STORAGE_SERVICE_CONTRACTID,
       mozilla::storage::ServiceConstructor
     },
 
     { "Unified Data Store Scriptable Statement Wrapper",
       MOZ_STORAGE_STATEMENT_WRAPPER_CID,
       MOZ_STORAGE_STATEMENT_WRAPPER_CONTRACTID,
-      mozStorageStatementWrapperConstructor
+      mozilla::storage::StatementWrapperConstructor
     }
 };
 
 NS_IMPL_NSGETMODULE(mozStorageModule, components)
--- a/storage/src/mozStorageStatementWrapper.cpp
+++ b/storage/src/mozStorageStatementWrapper.cpp
@@ -1,10 +1,10 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 sts=4
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
  * ***** 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/
  *
@@ -33,364 +33,189 @@
  * 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 ***** */
 
-#include "nsMemory.h"
 #include "nsString.h"
 
 #include "mozStorageStatementWrapper.h"
 #include "mozStorageStatementParams.h"
 #include "mozStorageStatementRow.h"
 
 #include "sqlite3.h"
 
-using namespace mozilla::storage;
+namespace mozilla {
+namespace storage {
 
-/*************************************************************************
- ****
- **** mozStorageStatementWrapper
- ****
- *************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+//// StatementWrapper
 
-NS_IMPL_ISUPPORTS2(mozStorageStatementWrapper, mozIStorageStatementWrapper, nsIXPCScriptable)
-
-mozStorageStatementWrapper::mozStorageStatementWrapper()
-    : mStatement(nsnull)
+StatementWrapper::StatementWrapper()
+: mStatement(nsnull)
 {
 }
 
-mozStorageStatementWrapper::~mozStorageStatementWrapper()
+StatementWrapper::~StatementWrapper()
 {
-    mStatement = nsnull;
+  mStatement = nsnull;
 }
 
+NS_IMPL_ISUPPORTS2(
+  StatementWrapper,
+  mozIStorageStatementWrapper,
+  nsIXPCScriptable
+)
+
+////////////////////////////////////////////////////////////////////////////////
+//// mozIStorageStatementWrapper
+
 NS_IMETHODIMP
-mozStorageStatementWrapper::Initialize(mozIStorageStatement *aStatement)
+StatementWrapper::Initialize(mozIStorageStatement *aStatement)
 {
-    NS_ASSERTION(mStatement == nsnull, "mozStorageStatementWrapper is already initialized");
-    NS_ENSURE_ARG_POINTER(aStatement);
+  NS_ASSERTION(mStatement == nsnull, "StatementWrapper is already initialized");
+  NS_ENSURE_ARG_POINTER(aStatement);
 
-    mStatement = static_cast<mozStorageStatement *>(aStatement);
-
-    // fetch various things we care about
-    mStatement->GetParameterCount(&mParamCount);
-    mStatement->GetColumnCount(&mResultColumnCount);
+  mStatement = static_cast<mozStorageStatement *>(aStatement);
 
-    for (unsigned int i = 0; i < mResultColumnCount; i++) {
-        const void *name = sqlite3_column_name16 (NativeStatement(), i);
-        mColumnNames.AppendElement(nsDependentString(static_cast<const PRUnichar*>(name)));
-    }
+  // fetch various things we care about
+  (void)mStatement->GetParameterCount(&mParamCount);
+  (void)mStatement->GetColumnCount(&mResultColumnCount);
 
-    return NS_OK;
-}
+  for (unsigned int i = 0; i < mResultColumnCount; i++) {
+    const void *name = ::sqlite3_column_name16(nativeStatement(), i);
+    (void)mColumnNames.AppendElement(nsDependentString(static_cast<const PRUnichar*>(name)));
+  }
 
-NS_IMETHODIMP
-mozStorageStatementWrapper::GetStatement(mozIStorageStatement **aStatement)
-{
-    NS_IF_ADDREF(*aStatement = mStatement);
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-mozStorageStatementWrapper::Reset()
+StatementWrapper::GetStatement(mozIStorageStatement **_statement)
 {
-    if (!mStatement)
-        return NS_ERROR_FAILURE;
-
-    return mStatement->Reset();
+  NS_IF_ADDREF(*_statement = mStatement);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-mozStorageStatementWrapper::Step(PRBool *_retval)
+StatementWrapper::Reset()
 {
-    if (!mStatement)
-        return NS_ERROR_FAILURE;
+  if (!mStatement)
+    return NS_ERROR_FAILURE;
 
-    PRBool hasMore = PR_FALSE;
-    nsresult rv = mStatement->ExecuteStep(&hasMore);
-    if (NS_SUCCEEDED(rv) && !hasMore) {
-        *_retval = PR_FALSE;
-        mStatement->Reset();
-        return NS_OK;
-    }
-
-    *_retval = hasMore;
-    return rv;
+  return mStatement->Reset();
 }
 
 NS_IMETHODIMP
-mozStorageStatementWrapper::Execute()
+StatementWrapper::Step(PRBool *_hasMoreResults)
 {
-    if (!mStatement)
-        return NS_ERROR_FAILURE;
-
-    return mStatement->Execute();
-}
-
-NS_IMETHODIMP
-mozStorageStatementWrapper::GetRow(mozIStorageStatementRow **aRow)
-{
-    NS_ENSURE_ARG_POINTER(aRow);
+  if (!mStatement)
+    return NS_ERROR_FAILURE;
 
-    if (!mStatement)
-        return NS_ERROR_FAILURE;
-
-    PRInt32 state;
-    mStatement->GetState(&state);
-    if (state != mozIStorageStatement::MOZ_STORAGE_STATEMENT_EXECUTING)
-        return NS_ERROR_FAILURE;
+  PRBool hasMore = PR_FALSE;
+  nsresult rv = mStatement->ExecuteStep(&hasMore);
+  if (NS_SUCCEEDED(rv) && !hasMore) {
+    *_hasMoreResults = PR_FALSE;
+    (void)mStatement->Reset();
+    return NS_OK;
+  }
 
-    if (!mStatementRow) {
-        StatementRow *row = new StatementRow(mStatement);
-        if (!row)
-            return NS_ERROR_OUT_OF_MEMORY;
-        mStatementRow = row;
-    }
-
-    NS_ADDREF(*aRow = mStatementRow);
-    return NS_OK;
+  *_hasMoreResults = hasMore;
+  return rv;
 }
 
 NS_IMETHODIMP
-mozStorageStatementWrapper::GetParams(mozIStorageStatementParams **aParams)
+StatementWrapper::Execute()
 {
-    NS_ENSURE_ARG_POINTER(aParams);
-
-    if (!mStatementParams) {
-        StatementParams *params = new StatementParams(mStatement);
-        if (!params)
-            return NS_ERROR_OUT_OF_MEMORY;
-        mStatementParams = params;
-    }
-
-    NS_ADDREF(*aParams = mStatementParams);
-    return NS_OK;
-}
-
-/*** nsIXPCScriptable interface ***/
+  if (!mStatement)
+    return NS_ERROR_FAILURE;
 
-/* readonly attribute string className; */
-NS_IMETHODIMP
-mozStorageStatementWrapper::GetClassName(char * *aClassName)
-{
-    NS_ENSURE_ARG_POINTER(aClassName);
-    *aClassName = (char *) nsMemory::Clone("mozStorageStatementWrapper", 27);
-    if (!*aClassName)
-        return NS_ERROR_OUT_OF_MEMORY;
-    return NS_OK;
-}
-
-/* readonly attribute PRUint32 scriptableFlags; */
-NS_IMETHODIMP
-mozStorageStatementWrapper::GetScriptableFlags(PRUint32 *aScriptableFlags)
-{
-    *aScriptableFlags =
-        nsIXPCScriptable::WANT_CALL |
-        nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY |
-        nsIXPCScriptable::WANT_NEWRESOLVE |
-        nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE;
-    return NS_OK;
+  return mStatement->Execute();
 }
 
-/* PRBool call (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp); */
 NS_IMETHODIMP
-mozStorageStatementWrapper::Call(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                          JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
+StatementWrapper::GetRow(mozIStorageStatementRow **_row)
 {
-    if (!mStatement) {
-        *_retval = PR_TRUE;
-        return NS_ERROR_FAILURE;
-    }
+  NS_ENSURE_ARG_POINTER(_row);
 
-    if (argc != mParamCount) {
-        *_retval = PR_FALSE;
-        return NS_ERROR_FAILURE;
-    }
+  if (!mStatement)
+    return NS_ERROR_FAILURE;
 
-    // reset
-    mStatement->Reset();
+  PRInt32 state;
+  mStatement->GetState(&state);
+  if (state != mozIStorageStatement::MOZ_STORAGE_STATEMENT_EXECUTING)
+    return NS_ERROR_FAILURE;
 
-    // bind parameters
-    for (int i = 0; i < (int) argc; i++) {
-        if (!JSValStorageStatementBinder(cx, mStatement, i, argv[i])) {
-            *_retval = PR_FALSE;
-            return NS_ERROR_INVALID_ARG;
-        }
-    }
+  if (!mStatementRow) {
+    mStatementRow = new StatementRow(mStatement);
+    NS_ENSURE_TRUE(mStatementRow, NS_ERROR_OUT_OF_MEMORY);
+  }
 
-    // if there are no results, we just execute
-    if (mResultColumnCount == 0)
-        mStatement->Execute();
-
-    *vp = JSVAL_TRUE;
-    *_retval = PR_TRUE;
-    return NS_OK;
+  NS_ADDREF(*_row = mStatementRow);
+  return NS_OK;
 }
 
-/* PRBool getProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
 NS_IMETHODIMP
-mozStorageStatementWrapper::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
+StatementWrapper::GetParams(mozIStorageStatementParams **_params)
 {
-    *_retval = PR_FALSE;
-    return NS_OK;
-}
-
-
-/* PRBool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                         JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    *_retval = PR_FALSE;
-    return NS_OK;
-}
+  NS_ENSURE_ARG_POINTER(_params);
 
-/* void preCreate (in nsISupports nativeObj, in JSContextPtr cx, in JSObjectPtr globalObj, out JSObjectPtr parentObj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::PreCreate(nsISupports *nativeObj, JSContext * cx,
-                       JSObject * globalObj, JSObject * *parentObj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+  if (!mStatementParams) {
+    mStatementParams = new StatementParams(mStatement);
+    NS_ENSURE_TRUE(mStatementParams, NS_ERROR_OUT_OF_MEMORY);
+  }
 
-/* void create (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Create(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void postCreate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+  NS_ADDREF(*_params = mStatementParams);
+  return NS_OK;
 }
 
-/* PRBool addProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+////////////////////////////////////////////////////////////////////////////////
+//// nsIXPCScriptable
 
-/* PRBool delProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+#define XPC_MAP_CLASSNAME StatementWrapper
+#define XPC_MAP_QUOTED_CLASSNAME "StatementWrapper"
+#define XPC_MAP_WANT_CALL
+#define XPC_MAP_FLAGS nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE | \
+                      nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY
+#include "xpc_map_end.h"
 
-/* PRBool enumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                               JSObject * obj, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool newEnumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 enum_op, in JSValPtr statep, out JSID idp); */
 NS_IMETHODIMP
-mozStorageStatementWrapper::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                  JSObject * obj, PRUint32 enum_op, jsval * statep, jsid *idp, PRBool *_retval)
+StatementWrapper::Call(nsIXPConnectWrappedNative *aWrapper,
+                       JSContext *aCtx,
+                       JSObject *aScopeObj,
+                       PRUint32 aArgc,
+                       jsval *aArgv,
+                       jsval *_vp,
+                       PRBool *_retval)
 {
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+  if (!mStatement)
+    return NS_ERROR_FAILURE;
 
-/* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 flags, out JSObjectPtr objp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                JSObject * obj, jsval id, PRUint32 flags, JSObject * *objp, PRBool *_retval)
-{
-    *_retval = PR_TRUE;
-    return NS_OK;
-}
+  if (aArgc != mParamCount) {
+    *_retval = PR_FALSE;
+    return NS_ERROR_FAILURE;
+  }
 
-/* PRBool convert (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 type, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Convert(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                JSObject * obj, PRUint32 type, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+  // reset
+  (void)mStatement->Reset();
 
-/* void finalize (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                              JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+  // bind parameters
+  for (int i = 0; i < (int)aArgc; i++) {
+    if (!JSValStorageStatementBinder(aCtx, mStatement, i, aArgv[i])) {
+      *_retval = PR_FALSE;
+      return NS_ERROR_INVALID_ARG;
+    }
+  }
+
+  // if there are no results, we just execute
+  if (mResultColumnCount == 0)
+    (void)mStatement->Execute();
+
+  *_vp = JSVAL_TRUE;
+  *_retval = PR_TRUE;
+  return NS_OK;
 }
 
-/* PRBool checkAccess (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 mode, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj, jsval id, PRUint32 mode, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool construct (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                               JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val, out PRBool bp); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj, jsval val, PRBool *bp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void trace (in nsIXPConnectWrappedNative wrapper, in JSTracerPtr trc, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Trace(nsIXPConnectWrappedNative *wrapper,
-                                  JSTracer *trc, JSObject *obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool equality(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::Equality(nsIXPConnectWrappedNative *wrapper,
-                                    JSContext *cx, JSObject *obj, jsval val,
-                                    PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::OuterObject(nsIXPConnectWrappedNative *wrapper,
-                                        JSContext *cx, JSObject *obj,
-                                        JSObject **_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* JSObjectPtr innerObject(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::InnerObject(nsIXPConnectWrappedNative *wrapper,
-                                        JSContext *cx, JSObject *obj,
-                                        JSObject **_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void postCreatePrototype (in JSContextPtr cx, in JSObjectPtr proto); */
-NS_IMETHODIMP
-mozStorageStatementWrapper::PostCreatePrototype(JSContext * cx,
-                                                JSObject * proto)
-{
-    return NS_OK;
-}
+} // namespace storage
+} // namespace mozilla
--- a/storage/src/mozStorageStatementWrapper.h
+++ b/storage/src/mozStorageStatementWrapper.h
@@ -1,10 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
+ * ***** 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,
@@ -31,54 +32,51 @@
  * 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 _MOZSTORAGESTATEMENTWRAPPER_H_
-#define _MOZSTORAGESTATEMENTWRAPPER_H_
+#ifndef _mozStorageStatementWrapper_h_
+#define _mozStorageStatementWrapper_h_
+
+#include "nsTArray.h"
+#include "nsIXPCScriptable.h"
 
 #include "mozStorageStatement.h"
 #include "mozIStorageStatementWrapper.h"
-#include "nsIXPCScriptable.h"
-
-#include "nsVoidArray.h"
-#include "nsTArray.h"
-
-#include "sqlite3.h"
 
+namespace mozilla {
+namespace storage {
 
-/***
- *** mozStorageStatementWrapper
- ***/
-class mozStorageStatementWrapper : public mozIStorageStatementWrapper,
-                                   public nsIXPCScriptable
+class StatementWrapper : public mozIStorageStatementWrapper
+                       , public nsIXPCScriptable
 {
 public:
-    mozStorageStatementWrapper();
+    StatementWrapper();
 
     // interfaces
     NS_DECL_ISUPPORTS
     NS_DECL_MOZISTORAGESTATEMENTWRAPPER
     NS_DECL_NSIXPCSCRIPTABLE
 
 private:
-    ~mozStorageStatementWrapper();
+    ~StatementWrapper();
 
-protected:
-    sqlite3_stmt* NativeStatement() {
-        return mStatement->nativeStatement();
+    sqlite3_stmt *nativeStatement() {
+      return mStatement->nativeStatement();
     }
 
-    // note: pointer to the concrete statement
     nsRefPtr<mozStorageStatement> mStatement;
     PRUint32 mParamCount;
     PRUint32 mResultColumnCount;
     nsTArray<nsString> mColumnNames;
 
     nsCOMPtr<mozIStorageStatementRow> mStatementRow;
     nsCOMPtr<mozIStorageStatementParams> mStatementParams;
 };
 
-#endif /* _MOZSTORAGESTATEMENTWRAPPER_H_ */
+} // namespace storage
+} // namespace mozilla
+
+#endif // _mozStorageStatementWrapper_h_