diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-15 11:23:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-15 11:23:39 +0100 |
commit | 2bee9847ec615258819b6cfec857c84e8f03fc6d (patch) | |
tree | 6c620af846913c0f28a0af7b2c3fec722cd83c11 /tools | |
parent | f1d1cb2d8f0f6e3a9c6071faeda1e58f88041749 (diff) |
ditch ByteString::Fill
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/string.hxx | 2 | ||||
-rw-r--r-- | tools/source/string/strimp.cxx | 32 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 32 |
3 files changed, 33 insertions, 33 deletions
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index bb674a60cba1..9a70a66031e8 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -177,6 +177,7 @@ private: // Append(char) void operator +=(int); // not implemented; to detect misuses // of operator +=(sal_Char) + public: ByteString(); ByteString( const ByteString& rStr ); @@ -233,7 +234,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& Fill( xub_StrLen nCount, sal_Char cFillChar = ' ' ); ByteString& Expand( xub_StrLen nCount, sal_Char cExpandChar = ' ' ); ByteString& EraseLeadingChars( sal_Char c = ' ' ); diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index f351aea90044..3d15cb29b26c 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -769,38 +769,6 @@ STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount ) // ----------------------------------------------------------------------- -STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( !nCount ) - return *this; - - // Ist nCount groesser wie der jetzige String, dann verlaengern - if ( nCount > mpData->mnLen ) - { - // dann neuen String mit der neuen Laenge anlegen - STRINGDATA* pNewData = ImplAllocData( nCount ); - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - } - else - ImplCopyData(); - - STRCODE* pStr = mpData->maStr; - do - { - *pStr = cFillChar; - ++pStr, - --nCount; - } - while ( nCount ); - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar ) { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 877b6d86fb49..720d5a24b002 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -442,4 +442,36 @@ StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr, return COMPARE_GREATER; } +// ----------------------------------------------------------------------- + +STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + if ( !nCount ) + return *this; + + // Ist nCount groesser wie der jetzige String, dann verlaengern + if ( nCount > mpData->mnLen ) + { + // dann neuen String mit der neuen Laenge anlegen + STRINGDATA* pNewData = ImplAllocData( nCount ); + STRING_RELEASE((STRING_TYPE *)mpData); + mpData = pNewData; + } + else + ImplCopyData(); + + STRCODE* pStr = mpData->maStr; + do + { + *pStr = cFillChar; + ++pStr, + --nCount; + } + while ( nCount ); + + return *this; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |