diff options
author | Noel Grandin <noel@peralex.com> | 2013-11-05 14:39:55 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-11-11 12:58:13 +0200 |
commit | fcd1637d5101b9142e6808edfb77b01122857901 (patch) | |
tree | 5fd09f97de80cf2a9481bd55a798015db35f1d0c /xmlhelp/source | |
parent | ef90021abe3735fba57145598fd7c3d359d2718e (diff) |
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
Diffstat (limited to 'xmlhelp/source')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 20 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 2 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/services.cxx | 2 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 34 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvfactory.cxx | 6 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 18 |
6 files changed, 41 insertions, 41 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 1ff125c22af0..8d64dcfd337a 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -420,7 +420,7 @@ const std::vector< OUString >& Databases::getModuleList( const OUString& Languag ( str[idx + 2] == 'f' || str[idx + 2] == 'F' ) && ( str[idx + 3] == 'g' || str[idx + 3] == 'G' ) && ( fileName = fileName.copy(0,idx).toAsciiLowerCase() ).compareToAscii( "picture" ) != 0 ) { - if(! m_bShowBasic && fileName.compareToAscii("sbasic") == 0 ) + if(! m_bShowBasic && fileName.equalsAscii("sbasic") ) continue; m_avModules.push_back( fileName ); } @@ -633,21 +633,21 @@ Databases::getCollator( const OUString& Language, OUString countryStr = country(Language); if( countryStr.isEmpty() ) { - if( langStr.compareToAscii("de") == 0 ) + if( langStr.equalsAscii("de") ) countryStr = "DE"; - else if( langStr.compareToAscii("en") == 0 ) + else if( langStr.equalsAscii("en") ) countryStr = "US"; - else if( langStr.compareToAscii("es") == 0 ) + else if( langStr.equalsAscii("es") ) countryStr = "ES"; - else if( langStr.compareToAscii("it") == 0 ) + else if( langStr.equalsAscii("it") ) countryStr = "IT"; - else if( langStr.compareToAscii("fr") == 0 ) + else if( langStr.equalsAscii("fr") ) countryStr = "FR"; - else if( langStr.compareToAscii("sv") == 0 ) + else if( langStr.equalsAscii("sv") ) countryStr = "SE"; - else if( langStr.compareToAscii("ja") == 0 ) + else if( langStr.equalsAscii("ja") ) countryStr = "JP"; - else if( langStr.compareToAscii("ko") == 0 ) + else if( langStr.equalsAscii("ko") ) countryStr = "KR"; } /* FIXME-BCP47: all this does not look right for language tag context, @@ -1065,7 +1065,7 @@ void Databases::cascadingStylesheet( const OUString& Language, sal_Bool bHighContrastMode = sal_False; OUString aCSS( m_aCSS ); - if ( aCSS.compareToAscii( "default" ) == 0 ) + if ( aCSS.equalsAscii( "default" ) ) { // #i50760: "default" needs to adapt HC mode uno::Reference< awt::XToolkit2 > xToolkit = diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index d030e7735f2c..e4cc68e2229d 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -126,7 +126,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte vector< OUString > aCompleteResultVector; OUString scope = m_aURLParameter.get_scope(); - bool bCaptionsOnly = ( scope.compareToAscii( "Heading" ) == 0 ); + bool bCaptionsOnly = scope.equalsAscii( "Heading" ); sal_Int32 hitCount = m_aURLParameter.get_hitCount(); IndexFolderIterator aIndexFolderIt( *pDatabases, m_aURLParameter.get_module(), m_aURLParameter.get_language() ); diff --git a/xmlhelp/source/cxxhelp/provider/services.cxx b/xmlhelp/source/cxxhelp/provider/services.cxx index ee7c1f7f9e84..f1fbd9ff7a52 100644 --- a/xmlhelp/source/cxxhelp/provider/services.cxx +++ b/xmlhelp/source/cxxhelp/provider/services.cxx @@ -39,7 +39,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpchelp_component_getFactory( // Create factory, if implementation name matches. if ( ::chelp::ContentProvider::getImplementationName_Static(). - compareToAscii( pImplName ) == 0 ) + equalsAscii( pImplName ) ) { xFactory = ::chelp::ContentProvider::createServiceFactory( xSMgr ); } diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 9ac95e644580..5130efdbf2c2 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -131,7 +131,7 @@ OString URLParameter::getByName( const char* par ) OUString URLParameter::get_id() { - if( m_aId.compareToAscii("start") == 0 ) + if( m_aId.equalsAscii("start") ) { // module is set StaticModuleInformation* inf = m_pDatabases->getStaticInformationForModule( get_module(), @@ -268,7 +268,7 @@ OUString URLParameter::get_the_jar() void URLParameter::readHelpDataFile() { - if( get_id().compareToAscii("") == 0 ) + if( get_id().equalsAscii("") ) return; OUString aModule = get_module(); @@ -519,7 +519,7 @@ bool URLParameter::scheme() sal_Int32 nLen = m_aExpr.getLength(); OUString aLastStr = m_aExpr.copy(sal::static_int_cast<sal_uInt32>(nLen) - 6); - if( aLastStr.compareToAscii( "DbPAR=" ) == 0 ) + if( aLastStr.equalsAscii( "DbPAR=" ) ) { OUString aNewExpr = m_aExpr.copy( 0, 20 ); OUString aSharedStr("shared"); @@ -618,39 +618,39 @@ bool URLParameter::query() query_ = query_.copy( delimIdx+1 ).trim(); } - if( parameter.compareToAscii( "Language" ) == 0 ) + if( parameter.equalsAscii( "Language" ) ) m_aLanguage = value; - else if( parameter.compareToAscii( "Device" ) == 0 ) + else if( parameter.equalsAscii( "Device" ) ) m_aDevice = value; - else if( parameter.compareToAscii( "Program" ) == 0 ) + else if( parameter.equalsAscii( "Program" ) ) m_aProgram = value; - else if( parameter.compareToAscii( "Eid" ) == 0 ) + else if( parameter.equalsAscii( "Eid" ) ) m_aEid = value; - else if( parameter.compareToAscii( "UseDB" ) == 0 ) - m_bUseDB = ! ( value.compareToAscii("no") == 0 ); - else if( parameter.compareToAscii( "DbPAR" ) == 0 ) + else if( parameter.equalsAscii( "UseDB" ) ) + m_bUseDB = ( value.equalsAscii("no") != 0 ); + else if( parameter.equalsAscii( "DbPAR" ) ) m_aDbPar = value; - else if( parameter.compareToAscii( "Query" ) == 0 ) + else if( parameter.equalsAscii( "Query" ) ) { if( m_aQuery.isEmpty() ) m_aQuery = value; else m_aQuery += ( OUString( " " ) + value ); } - else if( parameter.compareToAscii( "Scope" ) == 0 ) + else if( parameter.equalsAscii( "Scope" ) ) m_aScope = value; - else if( parameter.compareToAscii( "System" ) == 0 ) + else if( parameter.equalsAscii( "System" ) ) m_aSystem = value; - else if( parameter.compareToAscii( "HelpPrefix" ) == 0 ) + else if( parameter.equalsAscii( "HelpPrefix" ) ) m_aPrefix = rtl::Uri::decode( value, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - else if( parameter.compareToAscii( "HitCount" ) == 0 ) + else if( parameter.equalsAscii( "HitCount" ) ) m_nHitCount = value.toInt32(); - else if( parameter.compareToAscii( "Active" ) == 0 ) + else if( parameter.equalsAscii( "Active" ) ) m_aActive = value; - else if( parameter.compareToAscii( "Version" ) == 0 ) + else if( parameter.equalsAscii( "Version" ) ) ; // ignored (but accepted) in the build-in help, useful only for the online help else ret = false; diff --git a/xmlhelp/source/treeview/tvfactory.cxx b/xmlhelp/source/treeview/tvfactory.cxx index b4cee958fd8e..1bcf74ecaefd 100644 --- a/xmlhelp/source/treeview/tvfactory.cxx +++ b/xmlhelp/source/treeview/tvfactory.cxx @@ -93,8 +93,8 @@ TVFactory::supportsService( throw( RuntimeException ) { return - ServiceName.compareToAscii( "com.sun.star.help.TreeView" ) == 0 || - ServiceName.compareToAscii( "com.sun.star.ucb.HiearchyDataSource" ) == 0; + ServiceName.equalsAscii( "com.sun.star.help.TreeView" ) || + ServiceName.equalsAscii( "com.sun.star.ucb.HiearchyDataSource" ); } Sequence< OUString > SAL_CALL @@ -230,7 +230,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL treeview_component_getFactory( // File Content Provider. - if ( TVFactory::getImplementationName_static().compareToAscii( pImplName ) == 0 ) + if ( TVFactory::getImplementationName_static().equalsAscii( pImplName ) ) { xFactory = TVFactory::createServiceFactory( xSMgr ); } diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 722784c39652..76ef240bcc50 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -305,11 +305,11 @@ TVRead::getByName( const OUString& aName ) { bool found( true ); Any aAny; - if( aName.compareToAscii( "Title" ) == 0 ) + if( aName.equalsAscii( "Title" ) ) aAny <<= Title; - else if( aName.compareToAscii( "TargetURL" ) == 0 ) + else if( aName.equalsAscii( "TargetURL" ) ) aAny <<= TargetURL; - else if( aName.compareToAscii( "Children" ) == 0 ) + else if( aName.equalsAscii( "Children" ) ) { cppu::OWeakObject* p = Children.get(); aAny <<= Reference< XInterface >( p ); @@ -340,9 +340,9 @@ sal_Bool SAL_CALL TVRead::hasByName( const OUString& aName ) throw( RuntimeException ) { - if( aName.compareToAscii( "Title" ) == 0 || - aName.compareToAscii( "TargetURL" ) == 0 || - aName.compareToAscii( "Children" ) == 0 ) + if( aName.equalsAscii( "Title" ) || + aName.equalsAscii( "TargetURL" ) || + aName.equalsAscii( "Children" ) ) return true; return false; @@ -359,7 +359,7 @@ TVRead::getByHierarchicalName( const OUString& aName ) OUString name( aName ); if( ( idx = name.indexOf( sal_Unicode( '/' ) ) ) != -1 && - name.copy( 0,idx ).compareToAscii( "Children" ) == 0 ) + name.copy( 0,idx ).equalsAscii( "Children" ) ) return Children->getByHierarchicalName( name.copy( 1 + idx ) ); return getByName( name ); @@ -373,7 +373,7 @@ TVRead::hasByHierarchicalName( const OUString& aName ) OUString name( aName ); if( ( idx = name.indexOf( sal_Unicode( '/' ) ) ) != -1 && - name.copy( 0,idx ).compareToAscii( "Children" ) == 0 ) + name.copy( 0,idx ).equalsAscii( "Children" ) ) return Children->hasByHierarchicalName( name.copy( 1 + idx ) ); return hasByName( name ); @@ -775,7 +775,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext ) ( str[idx_ + 4] == 'e' || str[idx_ + 4] == 'E' ) ) { OUString baseName = aFileName.copy(0,idx_).toAsciiLowerCase(); - if(! showBasic && baseName.compareToAscii("sbasic") == 0 ) + if(! showBasic && baseName.equalsAscii("sbasic") ) continue; osl::File aFile( aFileUrl ); if( osl::FileBase::E_None == aFile.open( osl_File_OpenFlag_Read ) ) |