sc/inc/stringutil.hxx | 1 sc/source/core/tool/stringutil.cxx | 52 ----------------------------------- sc/source/filter/excel/xicontent.cxx | 6 +--- sc/source/ui/dbgui/validate.cxx | 7 ++-- 4 files changed, 5 insertions(+), 61 deletions(-)
New commits: commit 920f9155a79120611acface4dc64f2ac0cc081f0 Author: Matteo Casalin <matteo.casa...@yahoo.com> AuthorDate: Thu Nov 15 08:21:33 2018 +0100 Commit: Matteo Casalin <matteo.casa...@yahoo.com> CommitDate: Thu Jan 3 16:11:58 2019 +0100 Get rid of ScStringUtil::GetQuotedTokenCount() Change-Id: If50beb8edaf2c0bb0d336c81b4144ff58147771f Reviewed-on: https://gerrit.libreoffice.org/65657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx index ff2bc9cd74cd..bb1c8cf2e0f0 100644 --- a/sc/inc/stringutil.hxx +++ b/sc/inc/stringutil.hxx @@ -151,7 +151,6 @@ public: static bool parseSimpleNumber( const char* p, size_t n, char dsep, char gsep, double& rVal); - static sal_Int32 SC_DLLPUBLIC GetQuotedTokenCount(const OUString &rIn, const OUString& rQuotedPairs, sal_Unicode cTok ); static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs, sal_Unicode cTok, sal_Int32& rIndex ); diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index ba5923896e38..ebca2a7d96c7 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -346,58 +346,6 @@ bool ScStringUtil::parseSimpleNumber( return true; } -sal_Int32 ScStringUtil::GetQuotedTokenCount(const OUString &rIn, const OUString& rQuotedPairs, sal_Unicode cTok ) -{ - assert( !(rQuotedPairs.getLength()%2) ); - assert( rQuotedPairs.indexOf(cTok) == -1 ); - - // empty string: TokenCount is 0 per definition - if ( rIn.isEmpty() ) - return 0; - - sal_Int32 nTokCount = 1; - sal_Int32 nLen = rIn.getLength(); - sal_Int32 nQuotedLen = rQuotedPairs.getLength(); - sal_Unicode cQuotedEndChar = 0; - const sal_Unicode* pQuotedStr = rQuotedPairs.getStr(); - const sal_Unicode* pStr = rIn.getStr(); - sal_Int32 nIndex = 0; - while ( nIndex < nLen ) - { - sal_Unicode c = *pStr; - if ( cQuotedEndChar ) - { - // reached end of the quote? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Is the char a quote-begin char? - sal_Int32 nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // If the token-char matches then increase TokCount - if ( c == cTok ) - ++nTokCount; - } - - ++pStr; - ++nIndex; - } - - return nTokCount; -} - OUString ScStringUtil::GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs, sal_Unicode cTok, sal_Int32& rIndex ) { diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 02b1dd17867f..f5d4780ef3ac 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1001,11 +1001,9 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) OUString aTables( rStrm.ReadUniString() ); const sal_Unicode cSep = ';'; - OUString aQuotedPairs( "\"\"" ); - sal_Int32 nTokenCnt = ScStringUtil::GetQuotedTokenCount( aTables, aQuotedPairs, ',' ); + const OUString aQuotedPairs( "\"\"" ); maTables.clear(); - sal_Int32 nStringIx = 0; - for( sal_Int32 nToken = 0; nToken < nTokenCnt; ++nToken ) + for ( sal_Int32 nStringIx {aTables.isEmpty() ? -1 : 0}; nStringIx>=0; ) { OUString aToken( ScStringUtil::GetQuotedToken( aTables, 0, aQuotedPairs, ',', nStringIx ) ); sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.toInt32() : 0; diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 1a3ef64c2563..591acbb3e3f9 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -299,14 +299,13 @@ void lclGetFormulaFromStringList( OUString& rFmlaStr, const OUString& rStringLis @return true = Conversion successful. */ bool lclGetStringListFromFormula( OUString& rStringList, const OUString& rFmlaStr, sal_Unicode cFmlaSep ) { - OUString aQuotes( "\"\"" ); - sal_Int32 nTokenCnt = ScStringUtil::GetQuotedTokenCount(rFmlaStr, aQuotes, cFmlaSep ); + const OUString aQuotes( "\"\"" ); rStringList.clear(); - bool bIsStringList = (nTokenCnt > 0); + bool bIsStringList = !rFmlaStr.isEmpty(); bool bTokenAdded = false; - for( sal_Int32 nToken = 0, nStringIx = 0; bIsStringList && (nToken < nTokenCnt); ++nToken ) + for ( sal_Int32 nStringIx = 0; bIsStringList && nStringIx>=0; ) { OUString aToken( ScStringUtil::GetQuotedToken(rFmlaStr, 0, aQuotes, cFmlaSep, nStringIx ) ); aToken = comphelper::string::strip(aToken, ' '); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits