diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2011-01-25 13:52:43 +0100 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2011-01-25 13:52:53 +0100 |
commit | 48d7b435354f4e2d06c63f941c3e7960e57d62f6 (patch) | |
tree | cc5aa0375414881fef5a383a74bc83fdc8138529 /stoc | |
parent | WaE: gcc 4.6.0 various warnings (diff) | |
download | core-48d7b435354f4e2d06c63f941c3e7960e57d62f6.tar.gz core-48d7b435354f4e2d06c63f941c3e7960e57d62f6.zip |
Code-cleanup for testintrosp.cxx.
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/test/testintrosp.cxx | 368 |
1 files changed, 3 insertions, 365 deletions
diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx index df204f50a96d..582d38f42a69 100644 --- a/stoc/test/testintrosp.cxx +++ b/stoc/test/testintrosp.cxx @@ -53,13 +53,9 @@ #include <stdio.h> #include <string.h> - using namespace rtl; using namespace cppu; using namespace ModuleA; -//using namespace ModuleB; -//using namespace ModuleC; -//using namespace ModuleA::ModuleB; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -82,10 +78,6 @@ typedef WeakImplHelper1< XPropertySetInfo > ImplPropertySetInfoHelper; #define TEST_ENSHURE(c, m) OSL_VERIFY(c) #endif -//class IntroTestWritelnOutput; - - - //************************************************************** //*** Hilfs-Funktion, um vom Type eine XIdlClass zu bekommen *** //************************************************************** @@ -143,16 +135,12 @@ OUString AnyToString( const Any& aValue, sal_Bool bIncludeType, const Reference< case TypeClass_BOOLEAN: { sal_Bool b = *(sal_Bool*)aValue.getValue(); - //aRet.setValue( &b, getCppuBooleanType() ); - //aValue >>= b; aRetStr = OUString::valueOf( b ); break; } case TypeClass_CHAR: { sal_Unicode c = *(sal_Unicode*)aValue.getValue(); - //aValue >>= c; - //getCppuCharType() aRetStr = OUString::valueOf( c ); break; } @@ -198,28 +186,6 @@ OUString AnyToString( const Any& aValue, sal_Bool bIncludeType, const Reference< aRetStr = OUString::valueOf( n ); break; } - /* - case TypeClass_HYPER: - { - aRetStr = L"TYPE HYPER"; - break; - } - case TypeClass_UNSIGNED_SHORT: - { - aRetStr = StringToUString(WSString(aValue.getUINT16()), CHARSET_SYSTEM); - break; - } - case TypeClass_UNSIGNED_LONG: - { - aRetStr = StringToUString(WSString(aValue.getUINT32()), CHARSET_SYSTEM); - break; - } - case TypeClass_UNSIGNED_HYPER: - { - aRetStr = L"TYPE UNSIGNED_HYPER"; - break; - } - */ default: ; } @@ -231,43 +197,6 @@ OUString AnyToString( const Any& aValue, sal_Bool bIncludeType, const Reference< return aRetStr; } -/* -// Hilfs-Funktion, um ein UString in einen Any zu konvertieren -UsrAny StringToAny( UString aStr, TypeClass eTargetType ) -{ - UsrAny aRetAny; - switch( eTargetType ) - { - case TypeClass_INTERFACE: break; - case TypeClass_SERVICE: break; - case TypeClass_STRUCT: break; - case TypeClass_TYPEDEF: break; - case TypeClass_UNION: break; - case TypeClass_ENUM: break; - case TypeClass_EXCEPTION: break; - case TypeClass_ARRAY: break; - case TypeClass_SEQUENCE: break; - case TypeClass_VOID: break; - case TypeClass_ANY: break; - case TypeClass_UNKNOWN: break; - case TypeClass_BOOLEAN: aRetAny.setBOOL( short(aStr)!=0 ); break; - case TypeClass_CHAR: aRetAny.setChar( char(aStr) ); break; - case TypeClass_STRING: aRetAny.setString( aStr ); break; - case TypeClass_FLOAT: aRetAny.setFloat( (float)strtod( aStr.GetStr(), NULL ) ); break; - case TypeClass_DOUBLE: aRetAny.setDouble( strtod( aStr.GetStr(), NULL ) ); break; - case TypeClass_BYTE: aRetAny.setBYTE( BYTE(short(aStr)) ); break; - case TypeClass_SHORT: aRetAny.setINT16( short(aStr) ); break; - case TypeClass_LONG: aRetAny.setINT32( long(aStr) ); break; - case TypeClass_HYPER: break; - case TypeClass_UNSIGNED_SHORT: aRetAny.setUINT16( USHORT(aStr) ); break; - case TypeClass_UNSIGNED_LONG: aRetAny.setUINT32( ULONG(aStr) ); break; - case TypeClass_UNSIGNED_HYPER: break; - } - return aRetAny; -} -*/ - - //***************************************** //*** XPropertySetInfo fuer Test-Klasse *** //***************************************** @@ -281,15 +210,6 @@ class ImplPropertySetInfo : public ImplPropertySetInfoHelper public: ImplPropertySetInfo( const Reference< XMultiServiceFactory > & xMgr ) : mxMgr( xMgr ) {} - //: mxMgr( xMgr ), ImplPropertySetInfoHelper( xMgr ) {} - -/* - // Methoden von XInterface - virtual sal_Bool SAL_CALL queryInterface( const Uik & rUik, Any & ifc ) throw( RuntimeException ); - virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - virtual void SAL_CALL release() throw() { OWeakObject::release(); } - //ALT: sal_Bool queryInterface( Uik aUik, Reference<XInterface> & rOut ); -*/ // Methods of XPropertySetInfo virtual Sequence< Property > SAL_CALL getProperties( ) @@ -298,35 +218,9 @@ public: throw(UnknownPropertyException, RuntimeException); virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw(RuntimeException); - //virtual Sequence< Property > SAL_CALL getProperties(void) throw( RuntimeException ); - //virtual Property SAL_CALL getPropertyByName(const OUString& Name) throw( RuntimeException ); - //virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& Name) throw( RuntimeException ); }; -/* -// Methoden von XInterface -sal_Bool SAL_CALL ImplPropertySetInfo::queryInterface( const Uik & rUik, Any & ifc ) - throw( RuntimeException ) -{ - // PropertySet-Implementation - if( com::sun::star::uno::queryInterface( rUik, ifc, - SAL_STATIC_CAST(XPropertySetInfo*, this) ) ) - return sal_True; - - return OWeakObject::queryInterface( rUik, ifc ); -} - -sal_Bool ImplPropertySetInfo::queryInterface( Uik aUik, Reference<XInterface> & rOut ) -{ - if( aUik == XPropertySetInfo::getSmartUik() ) - rOut = (XPropertySetInfo *)this; - else - UsrObject::queryInterface( aUik, rOut ); - return rOut.is(); -} -*/ - Sequence< Property > ImplPropertySetInfo::getProperties(void) throw( RuntimeException ) { @@ -341,22 +235,16 @@ Sequence< Property > ImplPropertySetInfo::getProperties(void) pAry[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Factor")); pAry[0].Handle = -1; pAry[0].Type = getCppuType( (double*) NULL ); - //pAry[0].Type = TypeToIdlClass( getCppuType( (double*) NULL ), mxMgr ); - //pAry[0].Type = Double_getReflection()->getIdlClass(); pAry[0].Attributes = BOUND | TRANSIENT; pAry[1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("MyCount")); pAry[1].Handle = -1; pAry[1].Type = getCppuType( (sal_Int32*) NULL ); - //pAry[1].Type = TypeToIdlClass( getCppuType( (sal_Int32*) NULL ), mxMgr ); - //pAry[1].Type = INT32_getReflection()->getIdlClass(); pAry[1].Attributes = BOUND | TRANSIENT; pAry[2].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Info")); pAry[2].Handle = -1; pAry[2].Type = getCppuType( (OUString*) NULL ); - //pAry[2].Type = TypeToIdlClass( getCppuType( (OUString*) NULL ), mxMgr ); - //pAry[2].Type = OUString_getReflection()->getIdlClass(); pAry[2].Attributes = TRANSIENT; } // Die Information über alle drei Properties liefern. @@ -393,13 +281,7 @@ sal_Bool ImplPropertySetInfo::hasPropertyByName(const OUString& Name) return sal_False; } - - - //***************************************************************** - - - class ImplIntroTest : public ImplIntroTestHelper { Reference< XMultiServiceFactory > mxMgr; @@ -409,9 +291,6 @@ class ImplIntroTest : public ImplIntroTestHelper // Properties fuer das PropertySet Any aAnyArray[10]; - // Optionale Schnittstelle fuer die writeln-Ausgabe - //IntroTestWritelnOutput* m_pOutput; - Reference< XPropertySetInfo > m_xMyInfo; OUString m_ObjectName; @@ -451,24 +330,10 @@ class ImplIntroTest : public ImplIntroTestHelper public: ImplIntroTest( const Reference< XMultiServiceFactory > & xMgr ) : mxMgr( xMgr ) - //: mxMgr( xMgr ), ImplIntroTestHelper( xMgr ) { Init(); } - /* - ImplIntroTest( IntroTestWritelnOutput* pOutput_ ) - { - Init(); - m_pOutput = pOutput_; - } - */ - - //SMART_UNO_DECLARATION(ImplIntroTest,UsrObject); - - //BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut ); - //Reference< XIdlClass > getIdlClass(); - // Trotz virtual inline, um Schreibarbeit zu sparen (nur fuer Testzwecke) // XPropertySet virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) @@ -490,19 +355,6 @@ public: throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {} - /* - virtual void setIndexedPropertyValue(const OUString& aPropertyName, INT32 nIndex, const Any& aValue) {} - virtual Any getIndexedPropertyValue(const UString& aPropertyName, INT32 nIndex) const { return Any(); } - virtual void addPropertyChangeListener(const UString& aPropertyName, const XPropertyChangeListenerRef& aListener) - THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {} - virtual void removePropertyChangeListener(const UString& aPropertyName, const XPropertyChangeListenerRef& aListener) - THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {} - virtual void addVetoableChangeListener(const UString& aPropertyName, const XVetoableChangeListenerRef& aListener) - THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {} - virtual void removeVetoableChangeListener(const UString& aPropertyName, const XVetoableChangeListenerRef& aListener) - THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {} - */ - // XIntroTest-Methoden // Attributes virtual OUString SAL_CALL getObjectName() throw(RuntimeException) @@ -575,8 +427,6 @@ public: throw(RuntimeException); virtual sal_Bool SAL_CALL hasElements( ) throw(RuntimeException); - //virtual XIdlClassRef getElementType(void) constTHROWS( (UsrSystemException) ); - //virtual BOOL hasElements(void) const THROWS( (UsrSystemException) ); // XNameAccess-Methoden // Methods @@ -586,10 +436,6 @@ public: throw(RuntimeException); virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException); - //virtual Any getByName(const UString& Name) const - //THROWS( (NoSuchElementException, WrappedTargetException, UsrSystemException) ); - //virtual Sequence<UString> getElementNames(void) const THROWS( (UsrSystemException) ); - //virtual BOOL hasByName(const UString& Name) const THROWS( (UsrSystemException) ); // XIndexAccess-Methoden // Methods @@ -597,13 +443,8 @@ public: throw(RuntimeException); virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException); - //virtual INT32 getCount(void) const THROWS( (UsrSystemException) ); - //virtual Any getByIndex(INT32 Index) const - //THROWS( (IndexOutOfBoundsException, WrappedTargetException, UsrSystemException) ); }; -//SMART_UNO_IMPLEMENTATION(ImplIntroTest,UsrObject) - void ImplIntroTest::Init( void ) { // Eindeutigen Namen verpassen @@ -617,9 +458,6 @@ void ImplIntroTest::Init( void ) aAnyArray[1] <<= (sal_Int32)42; aAnyArray[2] <<= OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")) ); - // Output-Interface - //m_pOutput = NULL; - // Einmal fuer den internen Gebrauch die PropertySetInfo abholen m_xMyInfo = getPropertySetInfo(); m_xMyInfo->acquire(); // sonst raucht es am Programm-Ende ab @@ -660,36 +498,6 @@ void ImplIntroTest::Init( void ) pNameAccessTab = NULL; } -/* -BOOL ImplIntroTest::queryInterface( Uik aUik, XInterfaceRef & rOut ) -{ - if( aUik == XIntroTest::getSmartUik() ) - rOut = (XIntroTest*)this; - else if( aUik == XPropertySet::getSmartUik() ) - rOut = (XPropertySet*)this; - else if( aUik == XNameAccess::getSmartUik() ) - rOut = (XNameAccess*)this; - else if( aUik == XIndexAccess::getSmartUik() ) - rOut = (XIndexAccess*)this; - else if( aUik == ((XElementAccess*)NULL)->getSmartUik() ) - rOut = (XElementAccess*)(XIndexAccess *)this; - else - UsrObject::queryInterface( aUik, rOut ); - return rOut.is(); -} - -XIdlClassRef ImplIntroTest::getIdlClass() -{ - static XIdlClassRef xClass = createStandardClass( L"ImplIntroTest", - UsrObject::getUsrObjectIdlClass(), 4, - XIntroTest_getReflection(), - XPropertySet_getReflection(), - XNameAccess_getReflection(), - XIndexAccess_getReflection() ); - return xClass; -} -*/ - Reference< XPropertySetInfo > ImplIntroTest::getPropertySetInfo() throw(RuntimeException) { @@ -697,16 +505,10 @@ Reference< XPropertySetInfo > ImplIntroTest::getPropertySetInfo() // Alle Objekt haben die gleichen Properties, deshalb kann // die Info für alle gleich sein return &aInfo; - - //if( m_xMyInfo == NULL ) - // ((ImplIntroTest*)this)->m_xMyInfo = new ImplPropertySetInfo( this ); - //return m_xMyInfo; } void ImplIntroTest::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) -//void ImplIntroTest::setPropertyValue( const UString& aPropertyName, const Any& aValue ) -// THROWS( (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, UsrSystemException) ) { if( aPropChangeListener.is() && aPropertyName == aPropChangeListenerStr ) { @@ -714,9 +516,6 @@ void ImplIntroTest::setPropertyValue( const OUString& aPropertyName, const Any& aEvt.Source = (OWeakObject*)this; aEvt.PropertyName = aPropertyName; aEvt.PropertyHandle = 0L; - //aEvt.OldValue; - //aEvt.NewValue; - //aEvt.PropagationId; aPropChangeListener->propertyChange( aEvt ); } if( aVetoPropChangeListener.is() && aPropertyName == aVetoPropChangeListenerStr ) @@ -725,9 +524,6 @@ void ImplIntroTest::setPropertyValue( const OUString& aPropertyName, const Any& aEvt.Source = (OWeakObject*)this; aEvt.PropertyName = aVetoPropChangeListenerStr; aEvt.PropertyHandle = 0L; - //aEvt.OldValue; - //aEvt.NewValue; - //aEvt.PropagationId; aVetoPropChangeListener->vetoableChange( aEvt ); } @@ -743,8 +539,6 @@ void ImplIntroTest::setPropertyValue( const OUString& aPropertyName, const Any& Any ImplIntroTest::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) -//Any ImplIntroTest::getPropertyValue(const UString& aPropertyName) const - //THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) { Sequence<Property> aPropSeq = m_xMyInfo->getProperties(); sal_Int32 nLen = aPropSeq.getLength(); @@ -768,21 +562,11 @@ void ImplIntroTest::writeln( const OUString& Text ) { OString aStr( Text.getStr(), Text.getLength(), RTL_TEXTENCODING_ASCII_US ); - // Haben wir ein Output? - //if( m_pOutput ) - //{ - //m_pOutput->doWriteln( TextStr ); - //} - // Sonst einfach rausbraten - //else - { - printf( "%s", aStr.getStr() ); - } + printf( "%s", aStr.getStr() ); } Reference< XIntroTest > ImplIntroTest::getIntroTest() throw(RuntimeException) -//XIntroTestRef ImplIntroTest::getIntroTest(void) THROWS( (UsrSystemException) ) { if( !m_xIntroTest.is() ) m_xIntroTest = new ImplIntroTest( mxMgr ); @@ -792,7 +576,6 @@ Reference< XIntroTest > ImplIntroTest::getIntroTest() // Methoden von XElementAccess Type ImplIntroTest::getElementType( ) throw(RuntimeException) -//XIdlClassRef ImplIntroTest::getElementType(void) const THROWS( (UsrSystemException) ) { // TODO Type aRetType; @@ -803,7 +586,6 @@ Type ImplIntroTest::getElementType( ) sal_Bool ImplIntroTest::hasElements( ) throw(RuntimeException) -//BOOL ImplIntroTest::hasElements(void) const THROWS( (UsrSystemException) ) { return sal_True; } @@ -826,8 +608,6 @@ sal_Int32 getIndexForName( const OUString& ItemName ) Any ImplIntroTest::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) -//Any ImplIntroTest::getByName(const UString& Name) const - //THROWS( (NoSuchElementException, WrappedTargetException, UsrSystemException) ) { Any aRetAny; @@ -842,23 +622,18 @@ Any ImplIntroTest::getByName( const OUString& aName ) ImplIntroTest* p = new ImplIntroTest( mxMgr ); OUString aName2( RTL_CONSTASCII_USTRINGPARAM("IntroTest by Name-Access, Index = ") ); aName2 += OUString::valueOf( iIndex ); - //aName2 = aName2 + StringToUString( String( iIndex ), CHARSET_SYSTEM ); p->setObjectName( aName2 ); pNameAccessTab[iIndex] = p; } Reference< XIntroTest > xRet = pNameAccessTab[iIndex]; aRetAny = makeAny( xRet ); - - //aRetAny.set( &xRet, XIntroTest_getReflection() ); - //return (UsrObject*)(XIntroTest*)pNameAccessTab[iIndex]; } return aRetAny; } Sequence< OUString > ImplIntroTest::getElementNames( ) throw(RuntimeException) -//Sequence<UString> ImplIntroTest::getElementNames(void) const THROWS( (UsrSystemException) ) { Sequence<OUString> aStrSeq( DEFAULT_NAME_ACCESS_COUNT ); OUString* pStr = aStrSeq.getArray(); @@ -866,7 +641,6 @@ Sequence< OUString > ImplIntroTest::getElementNames( ) { OUString aName( RTL_CONSTASCII_USTRINGPARAM("Item") ); aName += OUString::valueOf( i ); - //aName = aName + StringToUString( i, CHARSET_SYSTEM ); pStr[i] = aName; } return aStrSeq; @@ -874,7 +648,6 @@ Sequence< OUString > ImplIntroTest::getElementNames( ) sal_Bool ImplIntroTest::hasByName( const OUString& aName ) throw(RuntimeException) -//BOOL ImplIntroTest::hasByName(const UString& Name) const THROWS( (UsrSystemException) ) { return ( getIndexForName( aName ) != -1 ); } @@ -882,15 +655,12 @@ sal_Bool ImplIntroTest::hasByName( const OUString& aName ) // XIndexAccess-Methoden sal_Int32 ImplIntroTest::getCount( ) throw(RuntimeException) -//sal_Int32 ImplIntroTest::getCount(void) const THROWS( (UsrSystemException) ) { return iIndexAccessCount; } Any ImplIntroTest::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) -//Any ImplIntroTest::getByIndex( sal_Int32 Index ) const - //THROWS( (IndexOutOfBoundsException, WrappedTargetException, UsrSystemException) ) { Any aRetAny; @@ -904,7 +674,6 @@ Any ImplIntroTest::getByIndex( sal_Int32 Index ) ImplIntroTest* p = new ImplIntroTest( mxMgr ); OUString aName( RTL_CONSTASCII_USTRINGPARAM("IntroTest by Index-Access, Index = ") ); aName += OUString::valueOf( Index ); - //aName = aName + StringToUString( String( iIndex ), CHARSET_SYSTEM ); p->setObjectName( aName ); pIndexAccessTab[Index] = p; } @@ -917,17 +686,12 @@ Any ImplIntroTest::getByIndex( sal_Int32 Index ) void ImplIntroTest::addPropertiesChangeListener( const Sequence< OUString >& /*PropertyNames*/, const Reference< XPropertiesChangeListener >& /*Listener*/ ) throw(RuntimeException) -//void ImplIntroTest::addPropertiesChangeListener -//(const Sequence< UString >& PropertyNames, const XPropertiesChangeListenerRef& Listener) - //THROWS( (UsrSystemException) ) { } void ImplIntroTest::removePropertiesChangeListener ( const Reference< XPropertiesChangeListener >& /*Listener*/ ) throw(RuntimeException) -//void ImplIntroTest::removePropertiesChangeListener(const XPropertiesChangeListenerRef& Listener) - //THROWS( (UsrSystemException) ) { } @@ -983,34 +747,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, { NULL, 0 } }; - // Tabelle der Property-Namen, die gefunden werden muessen -// char* pDemandedPropNames[] = -// { -// "Factor", -// "MyCount", -// "Info", -// "ObjectName", -// "FirstName", -// "LastName", -// "Age", -// "ChildrenCount", -// "FirstStruct", -// "SecondStruct", -// "Droenk", -// "IntroTest", -// "Bla", -// "Blub", -// "Gulp", -// "Strings", -// "MultiSequence", -// "PropertySetInfo", -// "ElementType", -// "ElementNames", -// "Count", -// "Types" -// "ImplementationId" -// }; - char const * pDemandedPropVals[] = { "3.140000", @@ -1091,8 +827,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, "[]type", "[]byte", }; - //is() nDemandedPropCount = 22; - DefItem pMethodDefs[] = { @@ -1146,14 +880,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Test-Objekt anlegen Any aObjAny = getIntrospectionTestObject( xMgr ); - // Introspection-Service holen - //Reference< XMultiServiceFactory > xServiceManager(getProcessServiceManager(), USR_QUERY); - //Reference< XIntrospection > xIntrospection( xMgr->createInstance(L"com.sun.star.beans.Introspection"), UNO_QUERY ); - //TEST_ENSHURE( xIntrospection.is(), "Creation of introspection instance failed" ); - //if( !xIntrospection.is() ) - //return sal_False; - - // und unspecten + // Introspection-Service unspecten Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny ); xAccess = xIntrospection->inspect( aObjAny ); xAccess = xIntrospection->inspect( aObjAny ); @@ -1165,16 +892,9 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // XPropertySet-UIK ermitteln Type aType = getCppuType( (Reference< XPropertySet >*) NULL ); - //typelib_InterfaceTypeDescription* pTypeDesc = NULL; - //aType.getDescription( (typelib_TypeDescription**)&pTypeDesc ); - //Uik aPropertySetUik = *(Uik*)&pTypeDesc->aUik; - //typelib_typedescription_release( (typelib_TypeDescription*)pTypeDesc ); Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aType ); - //Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aPropertySetUik ); Reference< XPropertySet > xPropSet( xPropSetIface, UNO_QUERY ); - //XPropertySetRef xPropSet = (XPropertySet*)xPropSetIface-> - // queryInterface( XPropertySet::getSmartUik() ); TEST_ENSHURE( xPropSet.is(), "Could not get XPropertySet by queryAdapter()" ); // XExactName @@ -1184,9 +904,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Schleife ueber alle Kombinationen von Concepts for( sal_Int32 nConcepts = 0 ; nConcepts < 16 ; nConcepts++ ) { -//printf( "*******************************************************\n" ); -//printf( "nConcepts = %ld\n", nConcepts ); - // Wieviele Properties sollten es sein sal_Int32 nDemandedPropCount = 0; sal_Int32 iList = 0; @@ -1200,7 +917,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, if( xPropSet.is() ) { Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); - //Sequence<Property> aRetSeq = xPropSetInfo->getProperties(); Sequence<Property> aRetSeq = xAccess->getProperties( nConcepts ); sal_Int32 nLen = aRetSeq.getLength(); @@ -1211,11 +927,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += OString::valueOf( nLen ); TEST_ENSHURE( nLen == nDemandedPropCount, aErrorStr.getStr() ); - // cout << "**********************************\n"; - // cout << "*** Ergebnis der Introspection ***\n"; - // cout << "**********************************\n"; - // cout << "\nIntrospection hat " << nLen << " Properties gefunden:\n"; - const Property* pProps = aRetSeq.getConstArray(); Any aPropVal; sal_Int32 i; @@ -1236,27 +947,18 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OUString aPropName = aProp.Name; OString aNameStr( aPropName.getStr(), aPropName.getLength(), RTL_TEXTENCODING_ASCII_US ); - //UStringToString(aPropName, CHARSET_SYSTEM); - -//printf( "Property = %s\n", aNameStr.getStr() ); OString aDemandedName = pPropertyDefs[ iDemanded ].pName; - //OString aDemandedName = pDemandedPropNames[ i ]; aErrorStr = "Expected property \""; aErrorStr += aDemandedName; aErrorStr += "\", found \""; aErrorStr += aNameStr; aErrorStr += "\""; TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() ); - // cout << "Property " << (i+1) << ": \"" << (const char*)UStringToString(aPropName, CHARSET_SYSTEM) << "\""; - Type aPropType = aProp.Type; OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) ); - //Reference< XIdlClass > xPropType = aProp.Type; - //OString aTypeNameStr( xPropType->getName(), xPropType->getName().getLength(), RTL_TEXTENCODING_ASCII_US ); OString aDemandedTypeNameStr = pDemandedPropTypes[ iDemanded ]; - //OString aDemandedTypeNameStr = pDemandedPropTypes[ i ]; aErrorStr = "Property \""; aErrorStr += aDemandedName; aErrorStr += "\", expected type >"; @@ -1265,15 +967,12 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += aTypeNameStr; aErrorStr += "<"; TEST_ENSHURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() ); - // cout << " (Prop-Typ: " << (const char*)UStringToString(xPropType->getName(), CHARSET_SYSTEM) << ")"; // Wert des Property lesen und ausgeben aPropVal = xPropSet->getPropertyValue( aPropName ); - // cout << "\n\tWert = " << (const char*)UStringToString(AnyToString( aPropVal, sal_True ), CHARSET_SYSTEM); OString aValStr = OUStringToOString( AnyToString( aPropVal, sal_False, xMgr ), RTL_TEXTENCODING_ASCII_US ); OString aDemandedValStr = pDemandedPropVals[ iDemanded ]; - //OString aDemandedValStr = pDemandedPropVals[ i ]; aErrorStr = "Property \""; aErrorStr += aDemandedName; aErrorStr += "\", expected val >"; @@ -1285,8 +984,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Wert pruefen und typgerecht modifizieren TypeClass eType = aPropVal.getValueType().getTypeClass(); - //Reference< XIdlClass > xIdlClass = aPropVal.getReflection()->getIdlClass(); - //TypeClass eType = xIdlClass->getTypeClass(); Any aNewVal; sal_Bool bModify = sal_True; switch( eType ) @@ -1295,7 +992,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, { OUString aStr; aPropVal >>= aStr; - //OString aStr = aPropVal.getString(); aStr = aStr + OUString(RTL_CONSTASCII_USTRINGPARAM(" (Modified!)")); aNewVal <<= aStr; break; @@ -1351,9 +1047,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Neuen Wert setzen, wieder lesen und ausgeben if( bModify ) { - // cout.flush(); - - // 1.7.1999, UnknownPropertyException bei ReadOnly-Properties abfangen + // UnknownPropertyException bei ReadOnly-Properties abfangen try { xPropSet->setPropertyValue( aPropName, aNewVal ); @@ -1363,7 +1057,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, } aPropVal = xPropSet->getPropertyValue( aPropName ); - // cout << "\n\tModifizierter Wert = " << (const char*) UStringToString(AnyToString( aPropVal, sal_True ), CHARSET_SYSTEM) << "\n"; OUString aStr = AnyToString( aPropVal, sal_False, xMgr ); OString aModifiedValStr = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US ); @@ -1377,10 +1070,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "<"; TEST_ENSHURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() ); } - else - { - // cout << "\n\tWert wurde nicht modifiziert\n"; - } // Checken, ob alle Properties auch einzeln gefunden werden aErrorStr = "property \""; @@ -1388,7 +1077,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\" not found with hasProperty()"; OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts ); - //sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, PropertyConcept::ALL - PropertyConcept::DANGEROUS ); TEST_ENSHURE( bProperty, aErrorStr.getStr() ); aErrorStr = "property \""; @@ -1397,8 +1085,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, try { Property aGetProp = xAccess->getProperty( aWDemandedName, nConcepts ); - //Property aGetProp = xAccess->getProperty( aWDemandedName, PropertyConcept::ALL ); - //TEST_ENSHURE( aGetProp == aProp , aErrorStr.getStr() ); } catch (RuntimeException e1) { @@ -1415,9 +1101,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Schleife ueber alle Kombinationen von Concepts for( sal_Int32 nConcepts = 0 ; nConcepts < 128 ; nConcepts++ ) { -//printf( "*******************************************************\n" ); -//printf( "nConcepts = %ld\n", nConcepts ); - // Das 2^6-Bit steht fuer "den Rest" sal_Int32 nRealConcepts = nConcepts; if( nConcepts & 0x40 ) @@ -1434,13 +1117,8 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, } // Methoden-Array ausgeben - //aMethodSeq = xAccess->getMethods Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( nRealConcepts ); - //Sequence<XIdlMethodRef> aMethodSeq = xAccess->getMethods - // ( MethodConcept::ALL - MethodConcept::DANGEROUS - MethodConcept::PROPERTY ); sal_Int32 nLen = aMethodSeq.getLength(); - // cout << "\n\n*** Methoden ***\n"; - // cout << "Introspection hat " << nLen << " Methoden gefunden:\n"; aErrorStr = "Expected to find "; aErrorStr += OString::valueOf( nDemandedMethCount ); @@ -1461,8 +1139,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OUString aMethName = rxMethod->getName(); OString aNameStr = OUStringToOString(aMethName, RTL_TEXTENCODING_ASCII_US ); -//printf( "Method = %s\n", aNameStr.getStr() ); - // Naechste Passende Methode in der Liste suchen while( pMethodDefs[ iList ].pName ) { @@ -1473,15 +1149,12 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OString aDemandedName = pMethodDefs[ iList ].pName; iList++; - //OString aDemandedName = pDemandedMethNames[ i ]; aErrorStr = "Expected method \""; aErrorStr += aDemandedName; aErrorStr += "\", found \""; aErrorStr += aNameStr; aErrorStr += "\""; TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() ); - // cout << "Methode " << (i+1) << ": " << (const char*) UStringToString(rxMethod->getReturnType()->getName(), CHARSET_SYSTEM) - // << " " << (const char*) UStringToString(rxMethod->getName(), CHARSET_SYSTEM) << "( "; // Checken, ob alle Methoden auch einzeln gefunden werden aErrorStr = "method \""; @@ -1489,7 +1162,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\" not found with hasMethod()"; OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts ); - //sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, MethodConcept::ALL ); TEST_ENSHURE( bMethod, aErrorStr.getStr() ); aErrorStr = "method \""; @@ -1498,7 +1170,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, try { Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts ); - //XIdlMethodRef xGetMethod = xAccess->getMethod( aWDemandedName, MethodConcept::ALL ); TEST_ENSHURE( xGetMethod == rxMethod , aErrorStr.getStr() ); } catch (RuntimeException e1) @@ -1514,8 +1185,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Listener-Klassen ausgeben Sequence< Type > aClassSeq = xAccess->getSupportedListeners(); sal_Int32 nLen = aClassSeq.getLength(); - // cout << "\n\n*** Anmeldbare Listener ***\n"; - // cout << "Introspection hat " << nLen << " Listener gefunden:\n"; const Type* pListeners = aClassSeq.getConstArray(); for( sal_Int32 i = 0 ; i < nLen ; i++ ) @@ -1525,19 +1194,8 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, // Namen besorgen OUString aListenerClassName = aListenerType.getTypeName(); - // cout << "Listener " << (i+1) << ": " << (const char*)UStringToString(aListenerClassName, CHARSET_SYSTEM) << "\n"; } - - // Performance bei hasMethod testen. - //CheckMethodPerformance( xAccess, "queryInterface", 100000 ); - //CheckMethodPerformance( xAccess, "getIdlClasses", 100000 ); - - // cout.flush(); - - - - return sal_True; } @@ -1556,7 +1214,6 @@ SAL_IMPLEMENT_MAIN() // Register services OUString libName( RTL_CONSTASCII_USTRINGPARAM( "reflection.uno" SAL_DLLEXTENSION) ); -// ORealDynamicLoader::computeLibraryName( OUString(RTL_CONSTASCII_USTRINGPARAM("corefl")), libName); fprintf(stderr, "1\n" ); xImplReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), libName, Reference< XSimpleRegistry >() ); @@ -1567,7 +1224,6 @@ SAL_IMPLEMENT_MAIN() // Introspection libName = OUString(RTL_CONSTASCII_USTRINGPARAM( "introspection.uno" SAL_DLLEXTENSION)); -// ORealDynamicLoader::computeLibraryName( OUString(RTL_CONSTASCII_USTRINGPARAM("insp")), libName); fprintf(stderr, "3\n" ); xImplReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), libName, Reference< XSimpleRegistry >() ); @@ -1578,7 +1234,6 @@ SAL_IMPLEMENT_MAIN() fprintf(stderr, "before test_introsp\n" ); bSucc = test_introsp( xMgr, xRefl, xIntrosp ); fprintf(stderr, "after test_introsp\n" ); - //bSucc = test_corefl( xRefl ); } catch (Exception & rExc) { @@ -1595,21 +1250,4 @@ SAL_IMPLEMENT_MAIN() return (bSucc ? 0 : -1); } - - - - - - -//***************************** -//*** TEST-Implementationen *** -//***************************** -// Bleibt auf Dauer nicht drin, dient als exportierbare Test-Klasse -// z.B. fuer Basic-Anbindung - - - - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |