diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-08-04 10:33:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-08-07 16:14:45 +0100 |
commit | db95e0b75903a34a1b88a3701334e154f32eeceb (patch) | |
tree | ed9a2370175d5dc85b2908b35e430d9051e8dee3 /tools | |
parent | 95ef04b5364845f41d9484905e70ba09a018950d (diff) |
move UniString::GetQuotedToken to sc, you can keep it
Change-Id: I6bc724186d9d701316e3e945d877bfaa88ac120d
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/string.hxx | 13 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 135 |
2 files changed, 0 insertions, 148 deletions
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index e070fb59afc4..d3528df8ac80 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -287,12 +287,6 @@ public: UniString GetToken( xub_StrLen nToken, sal_Unicode cTok, xub_StrLen& rIndex ) const; UniString GetToken( xub_StrLen nToken, sal_Unicode cTok = ';' ) const; - xub_StrLen GetQuotedTokenCount( const UniString& rQuotedPairs, sal_Unicode cTok = ';' ) const; - UniString GetQuotedToken( xub_StrLen nToken, const UniString& rQuotedPairs, - sal_Unicode cTok, xub_StrLen& rIndex ) const; - UniString GetQuotedToken( xub_StrLen nToken, const UniString& rQuotedPairs, - sal_Unicode cTok = ';' ) const; - const sal_Unicode* GetBuffer() const { return mpData->maStr; } sal_Unicode* GetBufferAccess(); void ReleaseBufferAccess( xub_StrLen nLen = STRING_LEN ); @@ -323,13 +317,6 @@ inline UniString UniString::GetToken( xub_StrLen nToken, sal_Unicode cTok ) cons return GetToken( nToken, cTok, nTempPos ); } -inline UniString UniString::GetQuotedToken( xub_StrLen nToken, const UniString& rQuotedPairs, - sal_Unicode cTok ) const -{ - xub_StrLen nTempPos = 0; - return GetQuotedToken( nToken, rQuotedPairs, cTok, nTempPos ); -} - template< typename charT, typename traits > std::basic_ostream<charT, traits> & operator <<( std::basic_ostream<charT, traits> & stream, UniString const & string) diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 120bf002b873..e21b2d018eb3 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -188,141 +188,6 @@ STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen, // ----------------------------------------------------------------------- -xub_StrLen STRING::GetQuotedTokenCount( const STRING& rQuotedPairs, STRCODE cTok ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); - DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedTokenCount() - QuotedString%2 != 0" ); - DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedTokenCount() - cTok in QuotedString" ); - - // Leerer String: TokenCount per Definition 0 - if ( !mpData->mnLen ) - return 0; - - xub_StrLen nTokCount = 1; - sal_Int32 nLen = mpData->mnLen; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - STRCODE cQuotedEndChar = 0; - const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; - const STRCODE* pStr = mpData->maStr; - sal_Int32 nIndex = 0; - while ( nIndex < nLen ) - { - STRCODE c = *pStr; - if ( cQuotedEndChar ) - { - // Ende des Quotes erreicht ? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Ist das Zeichen ein Quote-Anfang-Zeichen ? - xub_StrLen nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( c == cTok ) - ++nTokCount; - } - - ++pStr, - ++nIndex; - } - - return nTokCount; -} - -// ----------------------------------------------------------------------- - -STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs, - STRCODE cTok, xub_StrLen& rIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); - DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedToken() - QuotedString%2 != 0" ); - DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedToken() - cTok in QuotedString" ); - - const STRCODE* pStr = mpData->maStr; - const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; - STRCODE cQuotedEndChar = 0; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - xub_StrLen nLen = (xub_StrLen)mpData->mnLen; - xub_StrLen nTok = 0; - xub_StrLen nFirstChar = rIndex; - xub_StrLen i = nFirstChar; - - // Bestimme die Token-Position und Laenge - pStr += i; - while ( i < nLen ) - { - STRCODE c = *pStr; - if ( cQuotedEndChar ) - { - // Ende des Quotes erreicht ? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Ist das Zeichen ein Quote-Anfang-Zeichen ? - xub_StrLen nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( c == cTok ) - { - ++nTok; - - if ( nTok == nToken ) - nFirstChar = i+1; - else - { - if ( nTok > nToken ) - break; - } - } - } - - ++pStr, - ++i; - } - - if ( nTok >= nToken ) - { - if ( i < nLen ) - rIndex = i+1; - else - rIndex = STRING_NOTFOUND; - return Copy( nFirstChar, i-nFirstChar ); - } - else - { - rIndex = STRING_NOTFOUND; - return STRING(); - } -} - -// ----------------------------------------------------------------------- - static sal_Int32 ImplStringICompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2, sal_Int32 nCount ) { |