From cac7f1d4b524949811589d99093e3bba0e3601d8 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 3 Feb 2012 12:06:06 -0500 Subject: Replace ScStrCollection with boost::unordered_set. --- sc/source/core/data/table3.cxx | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 550d610d0386..6b3eeab4ae1d 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -63,6 +63,7 @@ #include "subtotalparam.hxx" #include +#include using namespace ::com::sun::star; @@ -1763,8 +1764,8 @@ void lcl_PrepareQuery( const ScDocument* pDoc, ScTable* pTab, ScQueryParam& rPar SCSIZE ScTable::Query(ScQueryParam& rParamOrg, bool bKeepSub) { ScQueryParam aParam( rParamOrg ); - ScStrCollection aScStrCollection; - StrData* pStrData = NULL; + typedef boost::unordered_set StrSetType; + StrSetType aStrSet; bool bStarted = false; bool bOldResult = true; @@ -1813,26 +1814,20 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, bool bKeepSub) bResult = true; else { - String aStr; + rtl::OUString aStr; for (SCCOL k=aParam.nCol1; k <= aParam.nCol2; k++) { rtl::OUString aCellStr; GetString(k, j, aCellStr); - aStr += aCellStr; - aStr += (sal_Unicode)1; + rtl::OUStringBuffer aBuf(aStr); + aBuf.append(aCellStr); + aBuf.append(static_cast(1)); + aStr = aBuf.makeStringAndClear(); } - pStrData = new StrData(aStr); - bool bIsUnique = true; - if (pStrData) - bIsUnique = aScStrCollection.Insert(pStrData); - if (bIsUnique) - bResult = true; - else - { - delete pStrData; - bResult = false; - } + std::pair r = aStrSet.insert(aStr); + bool bIsUnique = r.second; // unique if inserted. + bResult = bIsUnique; } } else -- cgit