diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-09-28 15:54:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-09-28 15:54:19 +0200 |
commit | 4f63a20bf96aadfd8d5a332f59b2a9835183170d (patch) | |
tree | b057b6412da8be0bde84307ba08beb04faebf7ff /sc | |
parent | 53d09aa39ae0d08970ccd7d08d54416d5b03908b (diff) |
Return the std::unique_ptr itself here, not a raw pointer
Change-Id: I353d6ceb74347f09dad77116b52771dd5aa21dab
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/inc/doubleref.hxx | 10 | ||||
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/tool/doubleref.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 4 |
4 files changed, 16 insertions, 10 deletions
diff --git a/sc/source/core/inc/doubleref.hxx b/sc/source/core/inc/doubleref.hxx index 3c7d18248cc9..7208be736d5a 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 f11182a60657..1bda8a88a448 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 4f4c523b47b3..fa7a12e768b6 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 3a5dd0a9daee..0cb03ef2b100 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; |