[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Mon Sep 28 06:54:46 PDT 2015


 sc/source/core/inc/doubleref.hxx  |   10 +++++++---
 sc/source/core/inc/interpre.hxx   |    3 ++-
 sc/source/core/tool/doubleref.cxx |    9 +++++----
 sc/source/core/tool/interpr1.cxx  |    4 ++--
 4 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 4f63a20bf96aadfd8d5a332f59b2a9835183170d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Sep 28 15:54:19 2015 +0200

    Return the std::unique_ptr itself here, not a raw pointer
    
    Change-Id: I353d6ceb74347f09dad77116b52771dd5aa21dab

diff --git a/sc/source/core/inc/doubleref.hxx b/sc/source/core/inc/doubleref.hxx
index 3c7d182..7208be7 100644
--- a/sc/source/core/inc/doubleref.hxx
+++ b/sc/source/core/inc/doubleref.hxx
@@ -20,6 +20,10 @@
 #ifndef INCLUDED_SC_SOURCE_CORE_INC_DOUBLEREF_HXX
 #define INCLUDED_SC_SOURCE_CORE_INC_DOUBLEREF_HXX
 
+#include <sal/config.h>
+
+#include <memory>
+
 #include "address.hxx"
 #include "types.hxx"
 
@@ -66,7 +70,7 @@ public:
      */
     virtual SCCOL findFieldColumn(SCCOL nIndex) const = 0;
     virtual SCCOL findFieldColumn(const OUString& rStr, sal_uInt16* pErr = NULL) const = 0;
-    virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const = 0;
+    virtual std::unique_ptr<ScDBQueryParamBase> createQueryParam(const ScDBRangeBase* pQueryRef) const = 0;
     virtual bool isRangeEqual(const ScRange& rRange) const = 0;
 
 protected:
@@ -120,7 +124,7 @@ public:
      */
     virtual SCCOL findFieldColumn(SCCOL nIndex) const SAL_OVERRIDE;
     virtual SCCOL findFieldColumn(const OUString& rStr, sal_uInt16* pErr = NULL) const SAL_OVERRIDE;
-    virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const SAL_OVERRIDE;
+    virtual std::unique_ptr<ScDBQueryParamBase> createQueryParam(const ScDBRangeBase* pQueryRef) const SAL_OVERRIDE;
     virtual bool isRangeEqual(const ScRange& rRange) const SAL_OVERRIDE;
 
 private:
@@ -160,7 +164,7 @@ public:
      */
     virtual SCCOL findFieldColumn(SCCOL nIndex) const SAL_OVERRIDE;
     virtual SCCOL findFieldColumn(const OUString& rStr, sal_uInt16* pErr = NULL) const SAL_OVERRIDE;
-    virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const SAL_OVERRIDE;
+    virtual std::unique_ptr<ScDBQueryParamBase> createQueryParam(const ScDBRangeBase* pQueryRef) const SAL_OVERRIDE;
     virtual bool isRangeEqual(const ScRange& rRange) const SAL_OVERRIDE;
 
 private:
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index f11182a..1bda8a8 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -34,6 +34,7 @@
 #include "math.hxx"
 
 #include <map>
+#include <memory>
 #include <vector>
 
 class ScDocument;
@@ -534,7 +535,7 @@ void ScSubTotal();
 // compatibility). If this was the case then rMissingField is set to true upon
 // return. If rMissingField==false upon call all "missing cases" are considered
 // to be an error.
-ScDBQueryParamBase* GetDBParams( bool& rMissingField );
+std::unique_ptr<ScDBQueryParamBase> GetDBParams( bool& rMissingField );
 
 void DBIterator( ScIterFunc );
 void ScDBSum();
diff --git a/sc/source/core/tool/doubleref.cxx b/sc/source/core/tool/doubleref.cxx
index 4f4c523..fa7a12e 100644
--- a/sc/source/core/tool/doubleref.cxx
+++ b/sc/source/core/tool/doubleref.cxx
@@ -30,6 +30,7 @@
 #include <osl/diagnose.h>
 
 #include <memory>
+#include <utility>
 #include <vector>
 
 using ::std::unique_ptr;
@@ -355,7 +356,7 @@ SCCOL ScDBInternalRange::findFieldColumn(const OUString& rStr, sal_uInt16* pErr)
     return bFound ? nField : -1;
 }
 
-ScDBQueryParamBase* ScDBInternalRange::createQueryParam(const ScDBRangeBase* pQueryRef) const
+std::unique_ptr<ScDBQueryParamBase> ScDBInternalRange::createQueryParam(const ScDBRangeBase* pQueryRef) const
 {
     unique_ptr<ScDBQueryParamInternal> pParam(new ScDBQueryParamInternal);
 
@@ -374,7 +375,7 @@ ScDBQueryParamBase* ScDBInternalRange::createQueryParam(const ScDBRangeBase* pQu
     if (!pQueryRef->fillQueryEntries(pParam.get(), this))
         return NULL;
 
-    return pParam.release();
+    return std::unique_ptr<ScDBQueryParamBase>(std::move(pParam));
 }
 
 bool ScDBInternalRange::isRangeEqual(const ScRange& rRange) const
@@ -450,7 +451,7 @@ SCCOL ScDBExternalRange::findFieldColumn(const OUString& rStr, sal_uInt16* pErr)
     return -1;
 }
 
-ScDBQueryParamBase* ScDBExternalRange::createQueryParam(const ScDBRangeBase* pQueryRef) const
+std::unique_ptr<ScDBQueryParamBase> ScDBExternalRange::createQueryParam(const ScDBRangeBase* pQueryRef) const
 {
     unique_ptr<ScDBQueryParamMatrix> pParam(new ScDBQueryParamMatrix);
     pParam->mpMatrix = mpMatrix;
@@ -460,7 +461,7 @@ ScDBQueryParamBase* ScDBExternalRange::createQueryParam(const ScDBRangeBase* pQu
     if (!pQueryRef->fillQueryEntries(pParam.get(), this))
         return NULL;
 
-    return pParam.release();
+    return std::unique_ptr<ScDBQueryParamBase>(std::move(pParam));
 }
 
 bool ScDBExternalRange::isRangeEqual(const ScRange& /*rRange*/) const
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 3a5dd0a..0cb03ef 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -6683,7 +6683,7 @@ void ScInterpreter::ScAggregate()
     }
 }
 
-ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField )
+std::unique_ptr<ScDBQueryParamBase> ScInterpreter::GetDBParams( bool& rMissingField )
 {
     bool bAllowMissingField = false;
     if ( rMissingField )
@@ -6816,7 +6816,7 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField )
                 if (!bNumber && !pParam->bRegExp)
                     pParam->bRegExp = MayBeRegExp(aQueryStr, pDok);
             }
-            return pParam.release();
+            return pParam;
         }
     }
     return NULL;


More information about the Libreoffice-commits mailing list