diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-03 12:06:06 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-04 00:25:50 -0500 |
commit | cac7f1d4b524949811589d99093e3bba0e3601d8 (patch) | |
tree | 1be9e46f8ac69a2db396a52fd0174e9f2db3ec83 /sc | |
parent | e67a43b29184608a2ee2a2205b8839b0962c81b9 (diff) |
Replace ScStrCollection with boost::unordered_set.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table3.cxx | 27 |
1 files changed, 11 insertions, 16 deletions
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 <vector> +#include <boost/unordered_set.hpp> 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<rtl::OUString, rtl::OUStringHash> 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<sal_Unicode>(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<StrSetType::iterator, bool> r = aStrSet.insert(aStr); + bool bIsUnique = r.second; // unique if inserted. + bResult = bIsUnique; } } else |