mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
694 lines
27 KiB
Diff
694 lines
27 KiB
Diff
From 3debd23d47d1fcbef76033c739a0b7003824d4ca Mon Sep 17 00:00:00 2001
|
|
From: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Date: Sat, 11 Aug 2018 13:25:09 +0200
|
|
Subject: [PATCH] Update mdds to 1.4.1
|
|
|
|
loplugin:constantparam
|
|
|
|
Reviewed-on: https://gerrit.libreoffice.org/58875
|
|
Tested-by: Jenkins
|
|
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
(cherry picked from commit bb6f2b12e8f0bbc99a5ca93141d35fd40b043e55)
|
|
|
|
Update mdds to 1.4.1.
|
|
|
|
The largest change in 1.4.x relevant to the calc code is that the
|
|
multi_type_matrix::walk() methods now take a copy of the function
|
|
object rather than a reference, to allow for it to take an inline
|
|
lambda function. Instead, it does return a instance of the input
|
|
function object, similar to how std::for_each() behaves.
|
|
|
|
In case the function object contains a large data member, try to
|
|
make it a moveable so that it will get moved rather than copied
|
|
when going through one of the walk() methods.
|
|
|
|
Reviewed-on: https://gerrit.libreoffice.org/59584
|
|
Tested-by: Jenkins
|
|
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
|
|
(cherry picked from commit 51f73f35ea61dd81dd3194af50394b98ff1bf8e9)
|
|
|
|
mdds 1.4.1 is now a minimum requirement.
|
|
|
|
Reviewed-on: https://gerrit.libreoffice.org/59614
|
|
Tested-by: Jenkins
|
|
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
|
|
(cherry picked from commit 4d1f735fcf064b18ef2848cc1f5a2a0616b0b33d)
|
|
|
|
fd08fc4a2ed75039e5292a35ff08726e0126c77f
|
|
647bcfbdd8e0417990ed93b25c1bca00f60df709
|
|
|
|
Change-Id: I676a8408e97cc8134009f764736cad68513c89ad
|
|
---
|
|
configure.ac | 2 +-
|
|
download.lst | 4 +-
|
|
external/mdds/UnpackedTarball_mdds.mk | 3 -
|
|
external/mdds/c++17.patch | 22 ---
|
|
sc/inc/scmatrix.hxx | 6 +-
|
|
sc/source/core/tool/interpr3.cxx | 4 +-
|
|
sc/source/core/tool/scmatrix.cxx | 208 +++++++++++++++++++-------
|
|
7 files changed, 161 insertions(+), 88 deletions(-)
|
|
delete mode 100644 external/mdds/c++17.patch
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 735ebf2e360a..3ff574a3f24f 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -8883,7 +8883,7 @@ AC_SUBST(SYSTEM_BOOST)
|
|
dnl ===================================================================
|
|
dnl Check for system mdds
|
|
dnl ===================================================================
|
|
-libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
|
|
+libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
|
|
|
|
dnl ===================================================================
|
|
dnl Check for system glm
|
|
diff --git a/download.lst b/download.lst
|
|
index c40bece90e26..d4c145a0cfc9 100644
|
|
--- a/download.lst
|
|
+++ b/download.lst
|
|
@@ -166,8 +166,8 @@ export LXML_SHA256SUM := 940caef1ec7c78e0c34b0f6b94fe42d0f2022915ffc78643d28538a
|
|
export LXML_TARBALL := lxml-4.1.1.tgz
|
|
export MARIADB_CONNECTOR_C_SHA256SUM := fd2f751dea049c1907735eb236aeace1d811d6a8218118b00bbaa9b84dc5cd60
|
|
export MARIADB_CONNECTOR_C_TARBALL := a233181e03d3c307668b4c722d881661-mariadb_client-2.0.0-src.tar.gz
|
|
-export MDDS_SHA256SUM := dcb8cd2425567a5a5ec164afea475bce57784bca3e352ad4cbdd3d1a7e08e5a1
|
|
-export MDDS_TARBALL := mdds-1.3.1.tar.bz2
|
|
+export MDDS_SHA256SUM := 9ac690c37f5f06dc88551405d5daf9d9ad25edf65aae6325b59e905c2ba444c3
|
|
+export MDDS_TARBALL := mdds-1.4.1.tar.bz2
|
|
export MDNSRESPONDER_SHA256SUM := 4737cb51378377e11d0edb7bcdd1bec79cbdaa7b27ea09c13e3006e58f8d92c0
|
|
export MDNSRESPONDER_TARBALL := mDNSResponder-576.30.4.tar.gz
|
|
export MSPUB_SHA256SUM := ef36c1a1aabb2ba3b0bedaaafe717bf4480be2ba8de6f3894be5fd3702b013ba
|
|
diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk
|
|
index 4f6db6b24e7b..c015f4c13f5a 100644
|
|
--- a/external/mdds/UnpackedTarball_mdds.mk
|
|
+++ b/external/mdds/UnpackedTarball_mdds.mk
|
|
@@ -13,10 +13,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,mdds,$(MDDS_TARBALL)))
|
|
|
|
$(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0))
|
|
|
|
-# c++17.patch upstreamed as <https://gitlab.com/mdds/mdds/merge_requests/11> "Remove some
|
|
-# unnecessary uses of obsolete std::unary_function":
|
|
$(eval $(call gb_UnpackedTarball_add_patches,mdds,\
|
|
- external/mdds/c++17.patch \
|
|
))
|
|
|
|
# vim: set noet sw=4 ts=4:
|
|
diff --git a/external/mdds/c++17.patch b/external/mdds/c++17.patch
|
|
deleted file mode 100644
|
|
index d96910f34e68..000000000000
|
|
--- a/external/mdds/c++17.patch
|
|
+++ /dev/null
|
|
@@ -1,22 +0,0 @@
|
|
---- include/mdds/multi_type_matrix.hpp
|
|
-+++ include/mdds/multi_type_matrix.hpp
|
|
-@@ -149,7 +149,7 @@
|
|
-
|
|
- private:
|
|
- template<typename _Func>
|
|
-- struct walk_func : std::unary_function<typename store_type::const_iterator::value_type, void>
|
|
-+ struct walk_func
|
|
- {
|
|
- _Func& m_func;
|
|
- walk_func(_Func& func) : m_func(func) {}
|
|
---- include/mdds/multi_type_vector.hpp
|
|
-+++ include/mdds/multi_type_vector.hpp
|
|
-@@ -139,7 +139,7 @@
|
|
- block& operator=(block);
|
|
- };
|
|
-
|
|
-- struct element_block_deleter : public std::unary_function<void, const element_block_type*>
|
|
-+ struct element_block_deleter
|
|
- {
|
|
- void operator() (const element_block_type* p)
|
|
- {
|
|
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
|
|
index 9be335fbc06b..b1bc5e0e3047 100644
|
|
--- a/sc/inc/scmatrix.hxx
|
|
+++ b/sc/inc/scmatrix.hxx
|
|
@@ -399,7 +399,7 @@ public:
|
|
virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) = 0;
|
|
virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) = 0;
|
|
|
|
- virtual std::vector<ScMatrix::IterateResult> Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp) = 0;
|
|
+ virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) = 0;
|
|
|
|
virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos,
|
|
DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc,
|
|
@@ -617,7 +617,7 @@ public:
|
|
virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) override;
|
|
virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) override;
|
|
|
|
- virtual std::vector<ScMatrix::IterateResult> Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override;
|
|
+ virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override;
|
|
|
|
virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos,
|
|
DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc,
|
|
@@ -837,7 +837,7 @@ public:
|
|
virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) override;
|
|
virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) override;
|
|
|
|
- virtual std::vector<ScMatrix::IterateResult> Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override;
|
|
+ virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override;
|
|
|
|
virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos,
|
|
DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc,
|
|
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
|
|
index 28e8cd9a9c48..88c0d8353783 100644
|
|
--- a/sc/source/core/tool/interpr3.cxx
|
|
+++ b/sc/source/core/tool/interpr3.cxx
|
|
@@ -2745,12 +2745,12 @@ void ScInterpreter::ScFTest()
|
|
aOp.emplace_back(new sc::op::Op(0.0, [](double& rAccum, double fVal){rAccum += fVal;}));
|
|
aOp.emplace_back(new sc::op::Op(0.0, [](double& rAccum, double fVal){rAccum += fVal * fVal;}));
|
|
|
|
- auto aVal1 = pMat1->Collect(false, aOp);
|
|
+ auto aVal1 = pMat1->Collect(aOp);
|
|
fSum1 = aVal1[0].mfFirst + aVal1[0].mfRest;
|
|
fSumSqr1 = aVal1[1].mfFirst + aVal1[1].mfRest;
|
|
fCount1 = aVal1[2].mnCount;
|
|
|
|
- auto aVal2 = pMat2->Collect(false, aOp);
|
|
+ auto aVal2 = pMat2->Collect(aOp);
|
|
fSum2 = aVal2[0].mfFirst + aVal2[0].mfRest;
|
|
fSumSqr2 = aVal2[1].mfFirst + aVal2[1].mfRest;
|
|
fCount2 = aVal2[2].mnCount;
|
|
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
|
|
index 7f8c8767e917..7dadec9f0b57 100644
|
|
--- a/sc/source/core/tool/scmatrix.cxx
|
|
+++ b/sc/source/core/tool/scmatrix.cxx
|
|
@@ -160,6 +160,12 @@ public:
|
|
maNewMatValues.reserve(nRow*nCol);
|
|
}
|
|
|
|
+ CompareMatrixElemFunc( const CompareMatrixElemFunc& ) = delete;
|
|
+ CompareMatrixElemFunc& operator= ( const CompareMatrixElemFunc& ) = delete;
|
|
+
|
|
+ CompareMatrixElemFunc( CompareMatrixElemFunc&& ) = default;
|
|
+ CompareMatrixElemFunc& operator= ( CompareMatrixElemFunc&& ) = default;
|
|
+
|
|
void operator() (const MatrixImplType::element_block_node_type& node)
|
|
{
|
|
switch (node.type)
|
|
@@ -323,7 +329,7 @@ public:
|
|
const ScFullMatrix::EmptyOpFunction& aEmptyFunc) const;
|
|
|
|
template<typename T>
|
|
- std::vector<ScMatrix::IterateResult> ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp);
|
|
+ std::vector<ScMatrix::IterateResult> ApplyCollectOperation(const std::vector<std::unique_ptr<T>>& aOp);
|
|
|
|
void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2,
|
|
SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool);
|
|
@@ -979,7 +985,7 @@ void ScMatrixImpl::CompareEqual()
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
CompareMatrixElemFunc<ElemEqualZero> aFunc(aSize.row, aSize.column);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(maMat);
|
|
}
|
|
|
|
@@ -987,7 +993,7 @@ void ScMatrixImpl::CompareNotEqual()
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
CompareMatrixElemFunc<ElemNotEqualZero> aFunc(aSize.row, aSize.column);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(maMat);
|
|
}
|
|
|
|
@@ -995,7 +1001,7 @@ void ScMatrixImpl::CompareLess()
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
CompareMatrixElemFunc<ElemLessZero> aFunc(aSize.row, aSize.column);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(maMat);
|
|
}
|
|
|
|
@@ -1003,7 +1009,7 @@ void ScMatrixImpl::CompareGreater()
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
CompareMatrixElemFunc<ElemGreaterZero> aFunc(aSize.row, aSize.column);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(maMat);
|
|
}
|
|
|
|
@@ -1011,7 +1017,7 @@ void ScMatrixImpl::CompareLessEqual()
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
CompareMatrixElemFunc<ElemLessEqualZero> aFunc(aSize.row, aSize.column);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(maMat);
|
|
}
|
|
|
|
@@ -1019,7 +1025,7 @@ void ScMatrixImpl::CompareGreaterEqual()
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
CompareMatrixElemFunc<ElemGreaterEqualZero> aFunc(aSize.row, aSize.column);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(maMat);
|
|
}
|
|
|
|
@@ -1174,21 +1180,34 @@ public:
|
|
template<typename Op>
|
|
class WalkElementBlocksMultipleValues
|
|
{
|
|
- const std::vector<std::unique_ptr<Op>>& maOp;
|
|
+ const std::vector<std::unique_ptr<Op>>* mpOp;
|
|
std::vector<ScMatrix::IterateResult> maRes;
|
|
bool mbFirst:1;
|
|
- bool mbTextAsZero:1;
|
|
public:
|
|
- WalkElementBlocksMultipleValues(bool bTextAsZero, const std::vector<std::unique_ptr<Op>>& aOp) :
|
|
- maOp(aOp), mbFirst(true), mbTextAsZero(bTextAsZero)
|
|
+ WalkElementBlocksMultipleValues(const std::vector<std::unique_ptr<Op>>& aOp) :
|
|
+ mpOp(&aOp), mbFirst(true)
|
|
{
|
|
- for (const auto& rpOp : maOp)
|
|
+ for (const auto& rpOp : *mpOp)
|
|
{
|
|
maRes.emplace_back(rpOp->mInitVal, rpOp->mInitVal, 0);
|
|
}
|
|
maRes.emplace_back(0.0, 0.0, 0); // count
|
|
}
|
|
|
|
+ WalkElementBlocksMultipleValues( const WalkElementBlocksMultipleValues& ) = delete;
|
|
+ WalkElementBlocksMultipleValues& operator= ( const WalkElementBlocksMultipleValues& ) = delete;
|
|
+
|
|
+ WalkElementBlocksMultipleValues( WalkElementBlocksMultipleValues&& r ) :
|
|
+ mpOp(r.mpOp), maRes(std::move(r.maRes)), mbFirst(r.mbFirst) {}
|
|
+
|
|
+ WalkElementBlocksMultipleValues& operator= ( WalkElementBlocksMultipleValues&& r )
|
|
+ {
|
|
+ mpOp = r.mpOp;
|
|
+ maRes = std::move(r.maRes);
|
|
+ mbFirst = r.mbFirst;
|
|
+ return *this;
|
|
+ }
|
|
+
|
|
const std::vector<ScMatrix::IterateResult>& getResult() const { return maRes; }
|
|
|
|
void operator() (const MatrixImplType::element_block_node_type& node)
|
|
@@ -1205,17 +1224,17 @@ public:
|
|
{
|
|
if (mbFirst)
|
|
{
|
|
- for (auto i = 0u; i < maOp.size(); ++i)
|
|
+ for (auto i = 0u; i < mpOp->size(); ++i)
|
|
{
|
|
- (*maOp[i])(maRes[i].mfFirst, *it);
|
|
+ (*(*mpOp)[i])(maRes[i].mfFirst, *it);
|
|
}
|
|
mbFirst = false;
|
|
}
|
|
else
|
|
{
|
|
- for (auto i = 0u; i < maOp.size(); ++i)
|
|
+ for (auto i = 0u; i < mpOp->size(); ++i)
|
|
{
|
|
- (*maOp[i])(maRes[i].mfRest, *it);
|
|
+ (*(*mpOp)[i])(maRes[i].mfRest, *it);
|
|
}
|
|
}
|
|
}
|
|
@@ -1232,17 +1251,17 @@ public:
|
|
{
|
|
if (mbFirst)
|
|
{
|
|
- for (auto i = 0u; i < maOp.size(); ++i)
|
|
+ for (auto i = 0u; i < mpOp->size(); ++i)
|
|
{
|
|
- (*maOp[i])(maRes[i].mfFirst, *it);
|
|
+ (*(*mpOp)[i])(maRes[i].mfFirst, *it);
|
|
}
|
|
mbFirst = false;
|
|
}
|
|
else
|
|
{
|
|
- for (auto i = 0u; i < maOp.size(); ++i)
|
|
+ for (auto i = 0u; i < mpOp->size(); ++i)
|
|
{
|
|
- (*maOp[i])(maRes[i].mfRest, *it);
|
|
+ (*(*mpOp)[i])(maRes[i].mfRest, *it);
|
|
}
|
|
}
|
|
}
|
|
@@ -1250,9 +1269,6 @@ public:
|
|
}
|
|
break;
|
|
case mdds::mtm::element_string:
|
|
- if (mbTextAsZero)
|
|
- maRes.back().mnCount += node.size;
|
|
- break;
|
|
case mdds::mtm::element_empty:
|
|
default:
|
|
;
|
|
@@ -1310,8 +1326,8 @@ template<typename Type>
|
|
class WalkAndMatchElements
|
|
{
|
|
Type maMatchValue;
|
|
- const size_t mnStartIndex;
|
|
- const size_t mnStopIndex;
|
|
+ size_t mnStartIndex;
|
|
+ size_t mnStopIndex;
|
|
size_t mnResult;
|
|
size_t mnIndex;
|
|
|
|
@@ -1669,6 +1685,24 @@ public:
|
|
maResValues.reserve(nResSize);
|
|
}
|
|
|
|
+ CompareMatrixFunc( const CompareMatrixFunc& ) = delete;
|
|
+ CompareMatrixFunc& operator= ( const CompareMatrixFunc& ) = delete;
|
|
+
|
|
+ CompareMatrixFunc( CompareMatrixFunc&& r ) :
|
|
+ mrComp(r.mrComp),
|
|
+ mnMatPos(r.mnMatPos),
|
|
+ mpOptions(r.mpOptions),
|
|
+ maResValues(std::move(r.maResValues)) {}
|
|
+
|
|
+ CompareMatrixFunc& operator= ( CompareMatrixFunc&& r )
|
|
+ {
|
|
+ mrComp = r.mrComp;
|
|
+ mnMatPos = r.mnMatPos;
|
|
+ mpOptions = r.mpOptions;
|
|
+ maResValues = std::move(r.maResValues);
|
|
+ return *this;
|
|
+ }
|
|
+
|
|
void operator() (const MatrixImplType::element_block_node_type& node)
|
|
{
|
|
sc::Compare::Cell& rCell = mrComp.maCells[mnMatPos];
|
|
@@ -1777,6 +1811,24 @@ public:
|
|
maResValues.reserve(nResSize);
|
|
}
|
|
|
|
+ CompareMatrixToNumericFunc( const CompareMatrixToNumericFunc& ) = delete;
|
|
+ CompareMatrixToNumericFunc& operator= ( const CompareMatrixToNumericFunc& ) = delete;
|
|
+
|
|
+ CompareMatrixToNumericFunc( CompareMatrixToNumericFunc&& r ) :
|
|
+ mrComp(r.mrComp),
|
|
+ mfRightValue(r.mfRightValue),
|
|
+ mpOptions(r.mpOptions),
|
|
+ maResValues(std::move(r.maResValues)) {}
|
|
+
|
|
+ CompareMatrixToNumericFunc& operator= ( CompareMatrixToNumericFunc&& r )
|
|
+ {
|
|
+ mrComp = r.mrComp;
|
|
+ mfRightValue = r.mfRightValue;
|
|
+ mpOptions = r.mpOptions;
|
|
+ maResValues = std::move(r.maResValues);
|
|
+ return *this;
|
|
+ }
|
|
+
|
|
void operator() (const MatrixImplType::element_block_node_type& node)
|
|
{
|
|
sc::Compare::Cell& rCell = mrComp.maCells[0];
|
|
@@ -1840,6 +1892,17 @@ class ToDoubleArray
|
|
double mfNaN;
|
|
bool mbEmptyAsZero;
|
|
|
|
+ void moveArray( ToDoubleArray& r )
|
|
+ {
|
|
+ // Re-create the iterator from the new array after the array has been
|
|
+ // moved, to ensure that the iterator points to a valid array
|
|
+ // position.
|
|
+ size_t n = std::distance(r.maArray.begin(), r.miPos);
|
|
+ maArray = std::move(r.maArray);
|
|
+ miPos = maArray.begin();
|
|
+ std::advance(miPos, n);
|
|
+ }
|
|
+
|
|
public:
|
|
ToDoubleArray( size_t nSize, bool bEmptyAsZero ) :
|
|
maArray(nSize, 0.0), miPos(maArray.begin()), mbEmptyAsZero(bEmptyAsZero)
|
|
@@ -1847,6 +1910,23 @@ public:
|
|
mfNaN = CreateDoubleError( FormulaError::ElementNaN);
|
|
}
|
|
|
|
+ ToDoubleArray( const ToDoubleArray& ) = delete;
|
|
+ ToDoubleArray& operator= ( const ToDoubleArray& ) = delete;
|
|
+
|
|
+ ToDoubleArray( ToDoubleArray&& r ) :
|
|
+ mfNaN(r.mfNaN), mbEmptyAsZero(r.mbEmptyAsZero)
|
|
+ {
|
|
+ moveArray(r);
|
|
+ }
|
|
+
|
|
+ ToDoubleArray& operator= ( ToDoubleArray&& r )
|
|
+ {
|
|
+ mfNaN = r.mfNaN;
|
|
+ mbEmptyAsZero = r.mbEmptyAsZero;
|
|
+ moveArray(r);
|
|
+ return *this;
|
|
+ }
|
|
+
|
|
void operator() (const MatrixImplType::element_block_node_type& node)
|
|
{
|
|
using namespace mdds::mtv;
|
|
@@ -1917,6 +1997,12 @@ public:
|
|
mfNaN = CreateDoubleError( FormulaError::ElementNaN);
|
|
}
|
|
|
|
+ MergeDoubleArrayFunc( const MergeDoubleArrayFunc& ) = delete;
|
|
+ MergeDoubleArrayFunc& operator= ( const MergeDoubleArrayFunc& ) = delete;
|
|
+
|
|
+ MergeDoubleArrayFunc( MergeDoubleArrayFunc&& ) = default;
|
|
+ MergeDoubleArrayFunc& operator= ( MergeDoubleArrayFunc&& ) = default;
|
|
+
|
|
void operator() (const MatrixImplType::element_block_node_type& node)
|
|
{
|
|
using namespace mdds::mtv;
|
|
@@ -1982,7 +2068,7 @@ template<typename TOp>
|
|
ScMatrix::IterateResult GetValueWithCount(bool bTextAsZero, const MatrixImplType& maMat)
|
|
{
|
|
WalkElementBlocks<TOp> aFunc(bTextAsZero);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getResult();
|
|
}
|
|
|
|
@@ -2006,49 +2092,49 @@ ScMatrix::IterateResult ScMatrixImpl::Product(bool bTextAsZero) const
|
|
size_t ScMatrixImpl::Count(bool bCountStrings, bool bCountErrors) const
|
|
{
|
|
CountElements aFunc(bCountStrings, bCountErrors);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getCount();
|
|
}
|
|
|
|
size_t ScMatrixImpl::MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const
|
|
{
|
|
WalkAndMatchElements<double> aFunc(fValue, maMat.size(), nCol1, nCol2);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getMatching();
|
|
}
|
|
|
|
size_t ScMatrixImpl::MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const
|
|
{
|
|
WalkAndMatchElements<svl::SharedString> aFunc(rStr, maMat.size(), nCol1, nCol2);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getMatching();
|
|
}
|
|
|
|
double ScMatrixImpl::GetMaxValue( bool bTextAsZero ) const
|
|
{
|
|
CalcMaxMinValue<MaxOp> aFunc(bTextAsZero);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getValue();
|
|
}
|
|
|
|
double ScMatrixImpl::GetMinValue( bool bTextAsZero ) const
|
|
{
|
|
CalcMaxMinValue<MinOp> aFunc(bTextAsZero);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getValue();
|
|
}
|
|
|
|
double ScMatrixImpl::GetGcd() const
|
|
{
|
|
CalcGcdLcm<Gcd> aFunc;
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getResult();
|
|
}
|
|
|
|
double ScMatrixImpl::GetLcm() const
|
|
{
|
|
CalcGcdLcm<Lcm> aFunc;
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
return aFunc.getResult();
|
|
}
|
|
|
|
@@ -2065,7 +2151,7 @@ ScMatrixRef ScMatrixImpl::CompareMatrix(
|
|
// function object that has much less branching for much better
|
|
// performance.
|
|
CompareMatrixToNumericFunc aFunc(nSize, rComp, rComp.maCells[1].mfValue, pOptions);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
|
|
// We assume the result matrix has the same dimension as this matrix.
|
|
const std::vector<double>& rResVal = aFunc.getValues();
|
|
@@ -2077,7 +2163,7 @@ ScMatrixRef ScMatrixImpl::CompareMatrix(
|
|
}
|
|
|
|
CompareMatrixFunc aFunc(nSize, rComp, nMatPos, pOptions);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
|
|
// We assume the result matrix has the same dimension as this matrix.
|
|
const std::vector<double>& rResVal = aFunc.getValues();
|
|
@@ -2091,7 +2177,7 @@ void ScMatrixImpl::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZer
|
|
{
|
|
MatrixImplType::size_pair_type aSize = maMat.size();
|
|
ToDoubleArray aFunc(aSize.row*aSize.column, bEmptyAsZero);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
aFunc.swap(rArray);
|
|
}
|
|
|
|
@@ -2107,7 +2193,7 @@ void ScMatrixImpl::MergeDoubleArray( std::vector<double>& rArray, ScFullMatrix::
|
|
case ScFullMatrix::Mul:
|
|
{
|
|
MergeDoubleArrayFunc<ArrayMul> aFunc(rArray);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
}
|
|
break;
|
|
default:
|
|
@@ -2329,16 +2415,26 @@ struct MatrixOpWrapper
|
|
private:
|
|
MatrixImplType& mrMat;
|
|
MatrixImplType::position_type pos;
|
|
- T maOp;
|
|
+ const T* mpOp;
|
|
|
|
public:
|
|
- MatrixOpWrapper(MatrixImplType& rMat, T const & aOp):
|
|
+ MatrixOpWrapper(MatrixImplType& rMat, const T& aOp):
|
|
mrMat(rMat),
|
|
pos(rMat.position(0,0)),
|
|
- maOp(aOp)
|
|
+ mpOp(&aOp)
|
|
{
|
|
}
|
|
|
|
+ MatrixOpWrapper( const MatrixOpWrapper& r ) : mrMat(r.mrMat), pos(r.pos), mpOp(r.mpOp) {}
|
|
+
|
|
+ MatrixOpWrapper& operator= ( const MatrixOpWrapper& r )
|
|
+ {
|
|
+ mrMat = r.mrMat;
|
|
+ pos = r.pos;
|
|
+ mpOp = r.mpOp;
|
|
+ return *this;
|
|
+ }
|
|
+
|
|
void operator()(const MatrixImplType::element_block_node_type& node)
|
|
{
|
|
switch (node.type)
|
|
@@ -2349,7 +2445,7 @@ public:
|
|
|
|
block_type::const_iterator it = block_type::begin(*node.data);
|
|
block_type::const_iterator itEnd = block_type::end(*node.data);
|
|
- MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, maOp);
|
|
+ MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, *mpOp);
|
|
pos = mrMat.set(pos,aFunc.begin(), aFunc.end());
|
|
}
|
|
break;
|
|
@@ -2360,7 +2456,7 @@ public:
|
|
block_type::const_iterator it = block_type::begin(*node.data);
|
|
block_type::const_iterator itEnd = block_type::end(*node.data);
|
|
|
|
- MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, maOp);
|
|
+ MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, *mpOp);
|
|
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
|
|
}
|
|
break;
|
|
@@ -2371,17 +2467,17 @@ public:
|
|
block_type::const_iterator it = block_type::begin(*node.data);
|
|
block_type::const_iterator itEnd = block_type::end(*node.data);
|
|
|
|
- MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, maOp);
|
|
+ MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, *mpOp);
|
|
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
|
|
}
|
|
break;
|
|
case mdds::mtm::element_empty:
|
|
{
|
|
- if (maOp.useFunctionForEmpty())
|
|
+ if (mpOp->useFunctionForEmpty())
|
|
{
|
|
std::vector<char> aVec(node.size);
|
|
MatrixIteratorWrapper<std::vector<char>, T, typename T::number_value_type>
|
|
- aFunc(aVec.begin(), aVec.end(), maOp);
|
|
+ aFunc(aVec.begin(), aVec.end(), *mpOp);
|
|
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
|
|
}
|
|
}
|
|
@@ -2397,14 +2493,14 @@ template<typename T>
|
|
void ScMatrixImpl::ApplyOperation(T aOp, ScMatrixImpl& rMat)
|
|
{
|
|
MatrixOpWrapper<T> aFunc(rMat.maMat, aOp);
|
|
- maMat.walk(aFunc);
|
|
+ aFunc = maMat.walk(aFunc);
|
|
}
|
|
|
|
template<typename T>
|
|
-std::vector<ScMatrix::IterateResult> ScMatrixImpl::ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp)
|
|
+std::vector<ScMatrix::IterateResult> ScMatrixImpl::ApplyCollectOperation(const std::vector<std::unique_ptr<T>>& aOp)
|
|
{
|
|
- WalkElementBlocksMultipleValues<T> aFunc(bTextAsZero, aOp);
|
|
- maMat.walk(aFunc);
|
|
+ WalkElementBlocksMultipleValues<T> aFunc(aOp);
|
|
+ aFunc = maMat.walk(std::move(aFunc));
|
|
return aFunc.getResult();
|
|
}
|
|
|
|
@@ -2544,8 +2640,10 @@ void ScMatrixImpl::ExecuteOperation(const std::pair<size_t, size_t>& rStartPos,
|
|
{
|
|
WalkElementBlockOperation aFunc(maMat.size().row,
|
|
aDoubleFunc, aBoolFunc, aStringFunc, aEmptyFunc);
|
|
- maMat.walk(aFunc, MatrixImplType::size_pair_type(rStartPos.first, rStartPos.second),
|
|
- MatrixImplType::size_pair_type(rEndPos.first, rEndPos.second));
|
|
+ aFunc = maMat.walk(
|
|
+ aFunc,
|
|
+ MatrixImplType::size_pair_type(rStartPos.first, rStartPos.second),
|
|
+ MatrixImplType::size_pair_type(rEndPos.first, rEndPos.second));
|
|
}
|
|
|
|
#if DEBUG_MATRIX
|
|
@@ -3452,9 +3550,9 @@ void ScFullMatrix::ExecuteOperation(const std::pair<size_t, size_t>& rStartPos,
|
|
pImpl->ExecuteOperation(rStartPos, rEndPos, aDoubleFunc, aBoolFunc, aStringFunc, aEmptyFunc);
|
|
}
|
|
|
|
-std::vector<ScMatrix::IterateResult> ScFullMatrix::Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp)
|
|
+std::vector<ScMatrix::IterateResult> ScFullMatrix::Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp)
|
|
{
|
|
- return pImpl->ApplyCollectOperation(bTextAsZero, aOp);
|
|
+ return pImpl->ApplyCollectOperation(aOp);
|
|
}
|
|
|
|
ScFullMatrix& ScFullMatrix::operator+= ( const ScFullMatrix& r )
|
|
@@ -4216,10 +4314,10 @@ void ScVectorRefMatrix::PowOp(bool bFlag, double fVal, ScMatrix& rMat)
|
|
mpFullMatrix->PowOp(bFlag, fVal, rMat);
|
|
}
|
|
|
|
-std::vector<ScMatrix::IterateResult> ScVectorRefMatrix::Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp)
|
|
+std::vector<ScMatrix::IterateResult> ScVectorRefMatrix::Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp)
|
|
{
|
|
ensureFullMatrix();
|
|
- return mpFullMatrix->Collect(bTextAsZero, aOp);
|
|
+ return mpFullMatrix->Collect(aOp);
|
|
}
|
|
|
|
void ScVectorRefMatrix::ExecuteOperation(const std::pair<size_t, size_t>& rStartPos,
|
|
--
|
|
2.17.1
|
|
|
|
|