diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-14 20:04:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-14 20:05:19 +0100 |
commit | c162a4c8e496ed457da67ab24da55cb9ee446c02 (patch) | |
tree | 04872ddce51db0e36ffc2d2d45ca2ddef5389114 /tools | |
parent | 7ee62f1d499c02c329f228a1d94eb6d64b80589b (diff) |
remove String::ReplaceAscii
last remaining users used it as a complicated way to do a simple thing
Change-Id: I810b1542b03bd6faa54f6f076b58cb7d3e680ab0
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/string/strascii.cxx | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index fe435427d8fc..7cae272cf7a6 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -329,63 +329,6 @@ UniString& UniString::InsertAscii( const char* pAsciiStr, xub_StrLen nIndex ) return *this; } -UniString& UniString::ReplaceAscii( xub_StrLen nIndex, xub_StrLen nCount, - const sal_Char* pAsciiStr, xub_StrLen nStrLen ) -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( pAsciiStr, "UniString::ReplaceAscii() - pAsciiStr is NULL" ); - - // Use append if index >= length - if ( nIndex >= mpData->mnLen ) - { - AppendAscii( pAsciiStr, nStrLen ); - return *this; - } - - // Use assign if index = 0 and count >= length - if ( (nIndex == 0) && (nCount >= mpData->mnLen) ) - { - AssignAscii( pAsciiStr, nStrLen ); - return *this; - } - - // Use erase if length is equal - if ( nStrLen == STRING_LEN ) - nStrLen = ImplStringLen( pAsciiStr ); - if ( !nStrLen ) - return Erase( nIndex, nCount ); - - // nCount must not exceed string length - if ( nCount > mpData->mnLen - nIndex ) - nCount = static_cast< xub_StrLen >(mpData->mnLen-nIndex); - - // Use assign if length matches - if ( nCount == nStrLen ) - { - ImplCopyData(); - ImplCopyAsciiStr( mpData->maStr+nIndex, pAsciiStr, nStrLen ); - return *this; - } - - // detect overflow - sal_Int32 n = ImplGetCopyLen( mpData->mnLen-nCount, nStrLen ); - - // allocate new string - STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount+n ); - - // copy string data - memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) ); - ImplCopyAsciiStr( pNewData->maStr+nIndex, pAsciiStr, n ); - memcpy( pNewData->maStr+nIndex+n, mpData->maStr+nIndex+nCount, - (mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) ); - - // release old string - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - - return *this; -} - StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ) const { |