diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-17 14:09:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-17 23:20:46 +0100 |
commit | f20bafad82340f1f735c1804a34ddd3a34c00e74 (patch) | |
tree | 40f33eee2c3fd94c60c1b81be057fc0a2a64c004 /tools | |
parent | simplify this (diff) | |
download | core-f20bafad82340f1f735c1804a34ddd3a34c00e74.tar.gz core-f20bafad82340f1f735c1804a34ddd3a34c00e74.zip |
ditch ByteString::Expand
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/string.hxx | 3 | ||||
-rw-r--r-- | tools/source/string/strimp.cxx | 31 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 31 |
3 files changed, 31 insertions, 34 deletions
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index 9a70a66031e8..b2bbfe75c772 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -177,7 +177,6 @@ private: // Append(char) void operator +=(int); // not implemented; to detect misuses // of operator +=(sal_Char) - public: ByteString(); ByteString( const ByteString& rStr ); @@ -234,8 +233,6 @@ public: ByteString& Erase( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ); ByteString Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const; - ByteString& Expand( xub_StrLen nCount, sal_Char cExpandChar = ' ' ); - ByteString& EraseLeadingChars( sal_Char c = ' ' ); ByteString& EraseTrailingChars( sal_Char c = ' ' ); ByteString& EraseLeadingAndTrailingChars( sal_Char c = ' ' ); diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index 3d15cb29b26c..d8428750526b 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -769,37 +769,6 @@ STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount ) // ----------------------------------------------------------------------- -STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - // Muss der String erweitert werden - sal_Int32 nLen = mpData->mnLen; - if ( nCount <= nLen ) - return *this; - - // Neuen String anlegen - STRINGDATA* pNewData = ImplAllocData( nCount ); - - // Alten String kopieren - memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) ); - - // und initialisieren - STRCODE* pStr = pNewData->maStr; - pStr += nLen; - for (sal_Int32 i = nCount - nLen; i > 0; --i) { - *pStr++ = cExpandChar; - } - - // Alte Daten loeschen und Neue zuweisen - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::EraseLeadingChars( STRCODE c ) { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 720d5a24b002..0f9874140769 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -474,4 +474,35 @@ STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar ) return *this; } +// ----------------------------------------------------------------------- + +STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + // Muss der String erweitert werden + sal_Int32 nLen = mpData->mnLen; + if ( nCount <= nLen ) + return *this; + + // Neuen String anlegen + STRINGDATA* pNewData = ImplAllocData( nCount ); + + // Alten String kopieren + memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) ); + + // und initialisieren + STRCODE* pStr = pNewData->maStr; + pStr += nLen; + for (sal_Int32 i = nCount - nLen; i > 0; --i) { + *pStr++ = cExpandChar; + } + + // Alte Daten loeschen und Neue zuweisen + STRING_RELEASE((STRING_TYPE *)mpData); + mpData = pNewData; + + return *this; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |