From fcd1637d5101b9142e6808edfb77b01122857901 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 5 Nov 2013 14:39:55 +0200 Subject: convert OUString compareToAscii == 0 to equalsAscii Convert code like aStr.compareToAscii("XXX") == 0 to aStr.equalsAscii("XXX") which is both easier to read and faster. Change-Id: I448abf58f2fa0e7715dba53f8e8825ca0587c83f --- sw/source/core/unocore/unostyle.cxx | 32 ++++++++++++++++---------------- sw/source/filter/html/htmlforw.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index e40280350f3c..2d9086121986 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -236,15 +236,15 @@ uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name) uno::Any aRet; if(!IsValid()) throw uno::RuntimeException(); - if(Name.compareToAscii("CharacterStyles") == 0 ) + if(Name.equalsAscii("CharacterStyles") ) aRet = getByIndex(0); - else if(Name.compareToAscii("ParagraphStyles") == 0) + else if(Name.equalsAscii("ParagraphStyles") ) aRet = getByIndex(1); - else if(Name.compareToAscii("FrameStyles") == 0 ) + else if(Name.equalsAscii("FrameStyles") ) aRet = getByIndex(3); - else if(Name.compareToAscii("PageStyles") == 0 ) + else if(Name.equalsAscii("PageStyles") ) aRet = getByIndex(2); - else if(Name.compareToAscii("NumberingStyles") == 0 ) + else if(Name.equalsAscii("NumberingStyles") ) aRet = getByIndex(4); else throw container::NoSuchElementException(); @@ -265,11 +265,11 @@ uno::Sequence< OUString > SwXStyleFamilies::getElementNames(void) throw( uno::Ru sal_Bool SwXStyleFamilies::hasByName(const OUString& Name) throw( uno::RuntimeException ) { - if( Name.compareToAscii("CharacterStyles") == 0 || - Name.compareToAscii("ParagraphStyles") == 0 || - Name.compareToAscii("FrameStyles") == 0 || - Name.compareToAscii("PageStyles") == 0 || - Name.compareToAscii("NumberingStyles") == 0 ) + if( Name.equalsAscii("CharacterStyles") || + Name.equalsAscii("ParagraphStyles") || + Name.equalsAscii("FrameStyles") || + Name.equalsAscii("PageStyles") || + Name.equalsAscii("NumberingStyles") ) return sal_True; else return sal_False; @@ -3611,11 +3611,11 @@ uno::Any SwXAutoStyles::getByName(const OUString& Name) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) { uno::Any aRet; - if(Name.compareToAscii("CharacterStyles") == 0 ) + if(Name.equalsAscii("CharacterStyles") ) aRet = getByIndex(0); - else if(Name.compareToAscii("RubyStyles") == 0 ) + else if(Name.equalsAscii("RubyStyles") ) aRet = getByIndex(1); - else if(Name.compareToAscii("ParagraphStyles") == 0 ) + else if(Name.equalsAscii("ParagraphStyles") ) aRet = getByIndex(2); else throw container::NoSuchElementException(); @@ -3636,9 +3636,9 @@ uno::Sequence< OUString > SwXAutoStyles::getElementNames(void) sal_Bool SwXAutoStyles::hasByName(const OUString& Name) throw( uno::RuntimeException ) { - if( Name.compareToAscii("CharacterStyles") == 0 || - Name.compareToAscii("RubyStyles") == 0 || - Name.compareToAscii("ParagraphStyles") == 0 ) + if( Name.equalsAscii("CharacterStyles") || + Name.equalsAscii("RubyStyles") || + Name.equalsAscii("ParagraphStyles") ) return sal_True; else return sal_False; diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 6c6495834cd9..d90d97cd3599 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -1248,7 +1248,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, if( i < nValCnt ) { const OUString& rVal = pValues[i]; - if( rVal.compareToAscii( "$$$empty$$$" ) == 0 ) + if( rVal.equalsAscii( "$$$empty$$$" ) ) bEmptyVal = sal_True; else sVal = rVal; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index fcf1246eb57b..ea08ec5cd695 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -1756,7 +1756,7 @@ Sequence< OUString > SwXTextDocument::getAvailableServiceNames(void) OUString* pRet = aRet.getArray(); for ( sal_Int32 i = 0; i < aRet.getLength(); ++i ) { - if ( pRet[i].compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 ) + if ( pRet[i].equalsAscii( "com.sun.star.drawing.OLE2Shape" ) ) { pRet[i] = pRet[aRet.getLength() - 1]; aRet.realloc( aRet.getLength() - 1 ); // no longer valid. -- cgit