stoc/source/inspect/introspection.cxx | 70 ++++++++-------------------------- 1 file changed, 18 insertions(+), 52 deletions(-)
New commits: commit f0c4130746e7b61029ce90f24e69a3203b547e54 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Jul 8 14:30:27 2015 +0200 Use OUString::starts/endsWith Change-Id: I88effbf6f88dfb286f85f8fbd06bab8033aca6b0 diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 9f061ae..e6b9110 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1972,12 +1972,9 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( continue; // Ist es eine get-Methode? - OUString aStartStr = aMethName.copy( 0, 3 ); - if( aStartStr == "get" ) + OUString aPropName; + if( aMethName.startsWith("get", &aPropName) ) { - // Namen der potentiellen Property - OUString aPropName = aMethName.copy( 3 ); - // get-Methode darf keinen Parameter haben Sequence< Reference<XIdlClass> > getParams = rxMethod_i->getParameterTypes(); if( getParams.getLength() > 0 ) @@ -2044,13 +2041,9 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( // Name holen und auswerten OUString aMethName2 = rxMethod_k->getName(); - OUString aStartStr2 = aMethName2.copy( 0, 3 ); - if( aStartStr2 != "set" ) - continue; - - // Ist es denn der gleiche Name? - OUString aPropName2 = aMethName2.copy( 3 ); - if( aPropName != aPropName2 ) + OUString aPropName2; + if (!(aMethName2.startsWith("set", &aPropName2) + && aPropName2 == aPropName)) continue; // set-Methode muss void returnen @@ -2092,22 +2085,13 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( } // Ist es eine addListener-Methode? - else if( aStartStr == "add" ) + else if( aMethName.startsWith("add", &aPropName) ) { - OUString aListenerStr( "Listener" ); - - // Namen der potentiellen Property - sal_Int32 nStrLen = aMethName.getLength(); - sal_Int32 nCopyLen = nStrLen - aListenerStr.getLength(); - OUString aEndStr = aMethName.copy( nCopyLen > 0 ? nCopyLen : 0 ); - // Endet das Teil auf Listener? - if( aEndStr != aListenerStr ) + OUString aListenerName; + if( !aPropName.endsWith("Listener", &aListenerName) ) continue; - // Welcher Listener? - OUString aListenerName = aMethName.copy( 3, nStrLen - aListenerStr.getLength() - 3 ); - // TODO: Hier koennten noch genauere Pruefungen vorgenommen werden // - Rueckgabe-Typ // - Anzahl und Art der Parameter @@ -2126,19 +2110,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( // Name holen und auswerten OUString aMethName2 = rxMethod_k->getName(); - sal_Int32 nNameLen = aMethName2.getLength(); - sal_Int32 nCopyLen2 = (nNameLen < 6) ? nNameLen : 6; - OUString aStartStr2 = aMethName2.copy( 0, nCopyLen2 ); - OUString aRemoveStr("remove" ); - if( aStartStr2 != aRemoveStr ) - continue; - - // Ist es denn der gleiche Listener? - if( aMethName2.getLength() - aRemoveStr.getLength() <= aListenerStr.getLength() ) - continue; - OUString aListenerName2 = aMethName2.copy - ( 6, aMethName2.getLength() - aRemoveStr.getLength() - aListenerStr.getLength() ); - if( aListenerName != aListenerName2 ) + OUString aListenerName2; + if (!(aMethName2.startsWith( + "remove", &aPropName) + && aPropName.endsWith( + "Listener", &aListenerName2) + && aListenerName2 == aListenerName)) continue; // TODO: Hier koennten noch genauere Pruefungen vorgenommen werden @@ -2177,12 +2154,9 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( continue; // Ist es eine set-Methode ohne zugehoerige get-Methode? - OUString aStartStr = aMethName.copy( 0, 3 ); - if( aStartStr == "set" ) + OUString aPropName; + if( aMethName.startsWith("set", &aPropName) ) { - // Namen der potentiellen Property - OUString aPropName = aMethName.copy( 3 ); - // set-Methode muss void returnen Reference<XIdlClass> xSetRetType = rxMethod_i->getReturnType(); if( xSetRetType->getTypeClass() != TypeClass_VOID ) commit 4ec7f1d7a82e13532b07acb5da6bb17cfd550ee2 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Jul 8 12:28:53 2015 +0200 Whatever that "SDL-Bug" was supposed to be, it is clearly irrelevant by now Change-Id: Iaa3482e0895b1ccb1f1743893d64ae1941f3f396 diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index d5e3235..9f061ae 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -2045,14 +2045,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( // Name holen und auswerten OUString aMethName2 = rxMethod_k->getName(); OUString aStartStr2 = aMethName2.copy( 0, 3 ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! - if( !( aStartStr2 == "set" ) ) + if( aStartStr2 != "set" ) continue; // Ist es denn der gleiche Name? OUString aPropName2 = aMethName2.copy( 3 ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! - if( !( aPropName == aPropName2 ) ) + if( aPropName != aPropName2 ) continue; // set-Methode muss void returnen @@ -2104,8 +2102,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( OUString aEndStr = aMethName.copy( nCopyLen > 0 ? nCopyLen : 0 ); // Endet das Teil auf Listener? - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! - if( !( aEndStr == aListenerStr ) ) + if( aEndStr != aListenerStr ) continue; // Welcher Listener? @@ -2133,8 +2130,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( sal_Int32 nCopyLen2 = (nNameLen < 6) ? nNameLen : 6; OUString aStartStr2 = aMethName2.copy( 0, nCopyLen2 ); OUString aRemoveStr("remove" ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! - if( !( aStartStr2 == aRemoveStr ) ) + if( aStartStr2 != aRemoveStr ) continue; // Ist es denn der gleiche Listener? @@ -2142,8 +2138,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( continue; OUString aListenerName2 = aMethName2.copy ( 6, aMethName2.getLength() - aRemoveStr.getLength() - aListenerStr.getLength() ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! - if( !( aListenerName == aListenerName2 ) ) + if( aListenerName != aListenerName2 ) continue; // TODO: Hier koennten noch genauere Pruefungen vorgenommen werden commit 1290ec321ccff4aeb5f9e3f7d12d84c72f128a04 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Jul 8 12:09:29 2015 +0200 Reduce variable scope Change-Id: Ia9e427dfbd6e7f87087f5df334ec68acbcdfc624 diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index ca8d99a..d5e3235 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1906,9 +1906,6 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( pLocalMethodConcepts[ i ] = 0; } - OUString aMethName; - OUString aPropName; - OUString aStartStr; for( i = 0 ; i < nSourceMethodCount ; i++ ) { // Methode ansprechen @@ -1916,7 +1913,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( sal_Int32& rMethodConcept_i = pLocalMethodConcepts[ i ]; // Namen besorgen - aMethName = rxMethod_i->getName(); + OUString aMethName = rxMethod_i->getName(); // Methoden katalogisieren // Alle (?) Methoden von XInterface filtern, damit z.B. nicht @@ -1975,11 +1972,11 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( continue; // Ist es eine get-Methode? - aStartStr = aMethName.copy( 0, 3 ); + OUString aStartStr = aMethName.copy( 0, 3 ); if( aStartStr == "get" ) { // Namen der potentiellen Property - aPropName = aMethName.copy( 3 ); + OUString aPropName = aMethName.copy( 3 ); // get-Methode darf keinen Parameter haben Sequence< Reference<XIdlClass> > getParams = rxMethod_i->getParameterTypes(); @@ -2178,18 +2175,18 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( continue; // Namen besorgen - aMethName = rxMethod_i->getName(); + OUString aMethName = rxMethod_i->getName(); // Wenn der Name zu kurz ist, wird's sowieso nichts if( aMethName.getLength() <= 3 ) continue; // Ist es eine set-Methode ohne zugehoerige get-Methode? - aStartStr = aMethName.copy( 0, 3 ); + OUString aStartStr = aMethName.copy( 0, 3 ); if( aStartStr == "set" ) { // Namen der potentiellen Property - aPropName = aMethName.copy( 3 ); + OUString aPropName = aMethName.copy( 3 ); // set-Methode muss void returnen Reference<XIdlClass> xSetRetType = rxMethod_i->getReturnType(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits