diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-06 23:00:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-09 13:28:37 +0000 |
commit | 45b19123a63f23fe37b11b063d7567bf79ef09aa (patch) | |
tree | befd8c637ac6fbdf94c05bb80c500fb781dd2bb4 /unotools/source | |
parent | String sNm unused (diff) | |
download | core-45b19123a63f23fe37b11b063d7567bf79ef09aa.tar.gz core-45b19123a63f23fe37b11b063d7567bf79ef09aa.zip |
simplify CharClass
multiple variants of toUpper (etc)
some that take a non-const OUString or String and modify it
some that take a const OUString or String and return a new one
some that take part of a const OUString or String and return a new one
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/i18n/charclass.cxx | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx index f3c1d416f34a..c169a6614b6a 100644 --- a/unotools/source/i18n/charclass.cxx +++ b/unotools/source/i18n/charclass.cxx @@ -276,40 +276,23 @@ sal_Bool CharClass::isLetterNumeric( const String& rStr ) const } } -void CharClass::toUpper( rtl::OUString& rStr ) const -{ - rStr = toUpper_rtl(rStr, 0, rStr.getLength()); -} - -String CharClass::toUpper( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const -{ - return toUpper_rtl(rStr, nPos, nCount); -} - -String CharClass::toLower( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const -{ - return toLower_rtl(::rtl::OUString(rStr), nPos, nCount); -} - - -String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const +rtl::OUString CharClass::titlecase(const rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount) const { try { if ( xCC.is() ) return xCC->toTitle( rStr, nPos, nCount, getLocale() ); else - return rStr.Copy( nPos, nCount ); + return rStr.copy( nPos, nCount ); } catch ( const Exception& ) { - DBG_ERRORFILE( "toTitle: Exception caught!" ); - return rStr.Copy( nPos, nCount ); + DBG_ERRORFILE( "titlecase: Exception caught!" ); + return rStr.copy( nPos, nCount ); } } - -::rtl::OUString CharClass::toUpper_rtl( const ::rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const +::rtl::OUString CharClass::uppercase( const ::rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const { try { @@ -320,13 +303,12 @@ String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCoun } catch ( const Exception& ) { - DBG_ERRORFILE( "toUpper: Exception caught!" ); + DBG_ERRORFILE( "uppercase: Exception caught!" ); return rStr.copy( nPos, nCount ); } } - -::rtl::OUString CharClass::toLower_rtl( const ::rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const +::rtl::OUString CharClass::lowercase( const ::rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const { try { @@ -337,12 +319,11 @@ String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCoun } catch ( const Exception& ) { - DBG_ERRORFILE( "toLower: Exception caught!" ); + DBG_ERRORFILE( "lowercase: Exception caught!" ); return rStr.copy( nPos, nCount ); } } - sal_Int16 CharClass::getType( const String& rStr, xub_StrLen nPos ) const { try |