diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-11-24 09:16:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-11-24 15:29:52 +0000 |
commit | 56d168cc59a352ec432e09b8ba471b858387023c (patch) | |
tree | 439c0e3aac70e91b78b6df167262bf1a36177ba7 /tools/source | |
parent | 9a6c74171b401310d143cfe1b0d1a0be1a4108c3 (diff) |
strip down old string class some more
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/string/strimp.cxx | 53 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 32 |
2 files changed, 32 insertions, 53 deletions
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index aad7df6dd67e..33c0572867d2 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -757,59 +757,6 @@ STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount ) // ----------------------------------------------------------------------- -STRING& STRING::EraseLeadingChars( STRCODE c ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( mpData->maStr[0] != c ) - return *this; - - xub_StrLen nStart = 0; - while ( mpData->maStr[nStart] == c ) - ++nStart; - - return Erase( 0, nStart ); -} - -// ----------------------------------------------------------------------- - -STRING& STRING::EraseTrailingChars( STRCODE c ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - sal_Int32 nEnd = mpData->mnLen; - while ( nEnd && (mpData->maStr[nEnd-1] == c) ) - nEnd--; - - if ( nEnd != mpData->mnLen ) - Erase( static_cast< xub_StrLen >(nEnd) ); - - return *this; -} - -// ----------------------------------------------------------------------- - -STRING& STRING::EraseLeadingAndTrailingChars( STRCODE c ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - xub_StrLen nStart = 0; - while ( mpData->maStr[nStart] == c ) - ++nStart; - if ( nStart ) - Erase( 0, nStart ); - - sal_Int32 nEnd = mpData->mnLen; - while ( nEnd && (mpData->maStr[nEnd-1] == c) ) - nEnd--; - if ( nEnd != mpData->mnLen ) - Erase( static_cast< xub_StrLen >(nEnd) ); - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::ToLowerAscii() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 30a0fd508f49..79a7ebc3febd 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -576,4 +576,36 @@ STRING::STRING( STRCODE c ) mpData->maStr[0] = c; } +// ----------------------------------------------------------------------- + +STRING& STRING::EraseLeadingChars( STRCODE c ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + if ( mpData->maStr[0] != c ) + return *this; + + xub_StrLen nStart = 0; + while ( mpData->maStr[nStart] == c ) + ++nStart; + + return Erase( 0, nStart ); +} + +// ----------------------------------------------------------------------- + +STRING& STRING::EraseTrailingChars( STRCODE c ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + sal_Int32 nEnd = mpData->mnLen; + while ( nEnd && (mpData->maStr[nEnd-1] == c) ) + nEnd--; + + if ( nEnd != mpData->mnLen ) + Erase( static_cast< xub_StrLen >(nEnd) ); + + return *this; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |