diff options
Diffstat (limited to 'stoc/test')
27 files changed, 372 insertions, 839 deletions
diff --git a/stoc/test/excomp/excomp.cxx b/stoc/test/excomp/excomp.cxx index bdfa520a6e39..7b3c4b4b14b3 100644 --- a/stoc/test/excomp/excomp.cxx +++ b/stoc/test/excomp/excomp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,9 @@ using namespace com::sun::star::registry; using namespace com::sun::star::lang; using namespace example; using namespace cppu; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OUStringToOString; #if OSL_DEBUG_LEVEL > 0 #define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) @@ -85,25 +88,25 @@ SAL_IMPLEMENT_MAIN() OUString exePath( getExePath() ); OUString excompRdb(exePath); - excompRdb += OUString::createFromAscii("excomp.rdb"); + excompRdb += OUString(RTL_CONSTASCII_USTRINGPARAM("excomp.rdb")); Reference< XMultiServiceFactory > xSMgr = ::cppu::createRegistryServiceFactory( excompRdb ); TEST_ENSHURE( xSMgr.is(), "excomp error 0" ); typelib_TypeDescription* pTypeDesc = NULL; - OUString sType = OUString::createFromAscii("com.sun.star.text.XTextDocument"); + OUString sType(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.XTextDocument")); typelib_typedescription_getByName( &pTypeDesc, sType.pData); // typelib_InterfaceTypeDescription* pInterDesc = (typelib_InterfaceTypeDescription*)pTypeDesc; - Reference< XInterface > xIFace = xSMgr->createInstance(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration")); + Reference< XInterface > xIFace = xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))); Reference< XImplementationRegistration > xImpReg( xIFace, UNO_QUERY); TEST_ENSHURE( xImpReg.is(), "excomp error 1" ); try { - xImpReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), + xImpReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), compName1, Reference< XSimpleRegistry >() ); - xImpReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), + xImpReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), compName2, Reference< XSimpleRegistry >() ); } @@ -112,10 +115,10 @@ SAL_IMPLEMENT_MAIN() TEST_ENSHURE( e.Message.getLength(), OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr() ); } - Reference< XTest > xTest1( xSMgr->createInstance(OUString::createFromAscii("example.ExampleComponent1")), + Reference< XTest > xTest1( xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("example.ExampleComponent1"))), UNO_QUERY); TEST_ENSHURE( xTest1.is(), "excomp error 2" ); - Reference< XTest > xTest2( xSMgr->createInstance(OUString::createFromAscii("example.ExampleComponent2")), + Reference< XTest > xTest2( xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("example.ExampleComponent2"))), UNO_QUERY); TEST_ENSHURE( xTest2.is(), "excomp error 3" ); @@ -134,3 +137,4 @@ SAL_IMPLEMENT_MAIN() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/excomp/excomp1.cxx b/stoc/test/excomp/excomp1.cxx index 210bee770cc9..44d81cd55f06 100644 --- a/stoc/test/excomp/excomp1.cxx +++ b/stoc/test/excomp/excomp1.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,7 +46,8 @@ using namespace com::sun::star::lang; using namespace com::sun::star::registry; using namespace cppu; using namespace osl; -using namespace rtl; + +using ::rtl::OUString; #define SERVICENAME1 "example.ExampleComponent1" #define IMPLNAME1 "example.ExampleComponent1.Impl" @@ -128,7 +130,7 @@ Sequence<OUString> SAL_CALL ExampleComponent1Impl::getSupportedServiceNames_Stat OUString SAL_CALL ExampleComponent1Impl::getMessage() throw(RuntimeException) { Guard< Mutex > aGuard( m_mutex ); - return OUString::createFromAscii("Lalelu nur der Mann im Mond schaut zu ..."); + return OUString(RTL_CONSTASCII_USTRINGPARAM("Lalelu nur der Mann im Mond schaut zu ...")); } @@ -213,3 +215,4 @@ void * SAL_CALL component_getFactory( +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/excomp/excomp1.xml b/stoc/test/excomp/excomp1.xml index 80b6cb0450f9..f7abad04302c 100644 --- a/stoc/test/excomp/excomp1.xml +++ b/stoc/test/excomp/excomp1.xml @@ -24,10 +24,8 @@ </component-description> <project-build-dependency> cppuhelper </project-build-dependency> <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> vos </project-build-dependency> <project-build-dependency> sal </project-build-dependency> <runtime-module-dependency> cppuhelper </runtime-module-dependency> <runtime-module-dependency> cppu </runtime-module-dependency> - <runtime-module-dependency> vos </runtime-module-dependency> <runtime-module-dependency> sal </runtime-module-dependency> </module-description> diff --git a/stoc/test/excomp/excomp2.cxx b/stoc/test/excomp/excomp2.cxx index 3595b6ecda06..9e484c11d268 100644 --- a/stoc/test/excomp/excomp2.cxx +++ b/stoc/test/excomp/excomp2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,7 +49,8 @@ using namespace com::sun::star::lang; using namespace com::sun::star::registry; using namespace cppu; using namespace osl; -using namespace rtl; + +using ::rtl::OUString; #define SERVICENAME2 "example.ExampleComponent2" #define IMPLNAME2 "example.ExampleComponent2.Impl" @@ -198,7 +200,7 @@ Sequence<OUString> SAL_CALL ExampleComponent2Impl::getSupportedServiceNames_Stat OUString SAL_CALL ExampleComponent2Impl::getMessage() throw(RuntimeException) { Guard< Mutex > aGuard( m_mutex ); - return OUString::createFromAscii("Alle meine Entchen schwimmen auf dem See, schwimmen auf dem See ..."); + return OUString(RTL_CONSTASCII_USTRINGPARAM("Alle meine Entchen schwimmen auf dem See, schwimmen auf dem See ...")); } @@ -284,3 +286,4 @@ void * SAL_CALL component_getFactory( +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/excomp/excomp2.xml b/stoc/test/excomp/excomp2.xml index 67df74bd188d..4801cf240135 100644 --- a/stoc/test/excomp/excomp2.xml +++ b/stoc/test/excomp/excomp2.xml @@ -24,10 +24,8 @@ </component-description> <project-build-dependency> cppuhelper </project-build-dependency> <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> vos </project-build-dependency> <project-build-dependency> sal </project-build-dependency> <runtime-module-dependency> cppuhelper </runtime-module-dependency> <runtime-module-dependency> cppu </runtime-module-dependency> - <runtime-module-dependency> vos </runtime-module-dependency> <runtime-module-dependency> sal </runtime-module-dependency> </module-description> diff --git a/stoc/test/excomp/makefile.mk b/stoc/test/excomp/makefile.mk index b41acb372620..01ffb65a5fcc 100644 --- a/stoc/test/excomp/makefile.mk +++ b/stoc/test/excomp/makefile.mk @@ -31,7 +31,6 @@ TARGET= excomp TARGET1= excomp1 TARGET2= excomp2 TARGETTYPE=CUI -#LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE USE_DEFFILE= TRUE NO_BSYMBOLIC= TRUE diff --git a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx index 076a2e9c1e62..a661eb89eb74 100644 --- a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx +++ b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,10 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_stoc.hxx" - #include <jni.h> -//#include <iostream> #include <stdio.h> #include <sal/main.h> #include <rtl/process.h> @@ -60,17 +59,20 @@ #include <com/sun/star/java/JavaVMCreationFailureException.hpp> #include <cppuhelper/implbase1.hxx> #include <uno/current_context.hxx> + using namespace std; -using namespace rtl; using namespace cppu; using namespace com::sun::star::uno; using namespace com::sun::star::lang; -//using namespace com::sun::star::reflection; using namespace com::sun::star::lang; using namespace com::sun::star::registry; using namespace com::sun::star::java; using namespace com::sun::star::task; +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; + #define OUSTR( x ) OUString(RTL_CONSTASCII_USTRINGPARAM( x )) #define INTERACTION_HANDLER_NAME "java-vm.interaction-handler" @@ -119,9 +121,6 @@ void SAL_CALL InteractionHandler::handle( const Reference< XInteractionRequest > break; } -// if( abort.is()) -// abort->select(); - static int cRetry= 0; if( cRetry++ == 5) @@ -203,3 +202,4 @@ SAL_IMPLEMENT_MAIN() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/javavm/makefile.mk b/stoc/test/javavm/makefile.mk index 7f6190fecc4f..4998b0a64a73 100644 --- a/stoc/test/javavm/makefile.mk +++ b/stoc/test/javavm/makefile.mk @@ -35,14 +35,11 @@ NO_BSYMBOLIC= TRUE UNOUCRDEP= $(SOLARBINDIR)$/udkapi.rdb UNOUCRRDB= $(SOLARBINDIR)$/udkapi.rdb -#UNOUCROUT= $(OUT)$/inc$/test UNOUCROUT= $(OUT)$/inc$ -#INCPRE+= $(OUT)$/inc$/test INCPRE+= $(OUT)$/inc$ - - # --- Settings ----------------------------------------------------- + .INCLUDE : settings.mk # --- Application 6 - testjavavm ------------------------------------ @@ -65,7 +62,6 @@ APP6STDLIBS= \ $(CPPUHELPERLIB) \ $(SALHELPERLIB) \ $(SALLIB) -# $(UNOLIB) # --- Target ------------------------------------------------ diff --git a/stoc/test/javavm/testapplet/makefile.mk b/stoc/test/javavm/testapplet/makefile.mk index 4ddadebd9aa2..31872c5386df 100644 --- a/stoc/test/javavm/testapplet/makefile.mk +++ b/stoc/test/javavm/testapplet/makefile.mk @@ -31,11 +31,12 @@ PRJNAME = testapplet PACKAGE = TARGET = TestApplet - # --- Settings ----------------------------------------------------- -#.INCLUDE : $(PRJ)$/util$/makefile.pmk + .INCLUDE : settings.mk + # Files -------------------------------------------------------- + JARFILES = ridl.jar jurt.jar unoil.jar JAVAFILES= $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) @@ -45,11 +46,7 @@ JAVACLASSFILES= \ $(CLASSDIR)$/$(PACKAGE)$/TestApplet.class JARCLASSDIRS= . -#JARTARGET = $(TARGET).jar -#JARCOMPRESS= TRUE -#CUSTOMMANIFESTFILE= .$/manifest # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - diff --git a/stoc/test/javavm/testcomponent/makefile.mk b/stoc/test/javavm/testcomponent/makefile.mk index a2f8eb16fe4d..9d77ebfb9bdf 100644 --- a/stoc/test/javavm/testcomponent/makefile.mk +++ b/stoc/test/javavm/testcomponent/makefile.mk @@ -31,11 +31,12 @@ PRJNAME = testcomponent PACKAGE = TARGET = JavaTestComponent - # --- Settings ----------------------------------------------------- -#.INCLUDE : $(PRJ)$/util$/makefile.pmk + .INCLUDE : settings.mk + # Files -------------------------------------------------------- + JARFILES = ridl.jar jurt.jar unoil.jar CUSTOMMANIFESTFILE= manifest @@ -48,11 +49,6 @@ JAVAFILES= \ JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - - - - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - diff --git a/stoc/test/javavm/testjavavm.cxx b/stoc/test/javavm/testjavavm.cxx index e9111bd3cd1d..0329f785b046 100644 --- a/stoc/test/javavm/testjavavm.cxx +++ b/stoc/test/javavm/testjavavm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,10 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_stoc.hxx" - #include <jni.h> -//#include <iostream> #include <stdio.h> #include <sal/main.h> #include <rtl/process.h> @@ -47,18 +46,18 @@ #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/java/XJavaThreadRegister_11.hpp> -//#include <cppuhelper/implbase1.hxx> - using namespace std; -using namespace rtl; using namespace cppu; using namespace com::sun::star::uno; using namespace com::sun::star::lang; -//using namespace com::sun::star::reflection; using namespace com::sun::star::lang; using namespace com::sun::star::registry; using namespace com::sun::star::java; +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; + sal_Bool testJavaVM(const Reference< XMultiServiceFactory > & xMgr ) { @@ -104,44 +103,15 @@ sal_Bool testJavaVM(const Reference< XMultiServiceFactory > & xMgr ) if( _jvm->AttachCurrentThread((void**) &p_env, 0)) return sal_False; -// jclass aJProg = p_env->FindClass("TestJavaVM"); -// if( p_env->ExceptionOccurred()){ -// p_env->ExceptionDescribe(); -// p_env->ExceptionClear(); -// } -// -// jmethodID mid= p_env->GetStaticMethodID( aJProg,"main", "([Ljava/lang/String;)V"); - jclass cls = p_env->FindClass( "TestJavaVM"); if (cls == 0) { OSL_TRACE( "Can't find Prog class\n"); exit(1); } -// jmethodID methid = p_env->GetStaticMethodID( cls, "main", "([Ljava/lang/String;)V"); -// if (methid == 0) { -// OSL_TRACE("Can't find Prog.main\n"); -// exit(1); -// } - -// jstring jstr = p_env->NewStringUTF(" from C!"); -// if (jstr == 0) { -// OSL_TRACE("Out of memory\n"); -// exit(1); -// } -// jobjectArray args = p_env->NewObjectArray( 1, -// p_env->FindClass("java/lang/String"), jstr); -// if (args == 0) { -// OSL_TRACE( "Out of memory\n"); -// exit(1); -// } -// p_env->CallStaticVoidMethod( cls, methid, args); - - jmethodID id = p_env->GetStaticMethodID( cls, "getInt", "()I"); if( id) { -// jint _i= p_env->CallStaticIntMethod(cls, id); p_env->CallStaticIntMethod(cls, id); } @@ -185,9 +155,9 @@ SAL_IMPLEMENT_MAIN() } catch (Exception & rExc) { - OSL_ENSURE( sal_False, "### exception occured!" ); + OSL_ENSURE( sal_False, "### exception occurred!" ); OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### exception occured: " ); + OSL_TRACE( "### exception occurred: " ); OSL_TRACE( aMsg.getStr() ); OSL_TRACE( "\n" ); } @@ -195,8 +165,8 @@ SAL_IMPLEMENT_MAIN() Reference< XComponent > xCompContext( context, UNO_QUERY ); xCompContext->dispose(); printf("javavm %s", bSucc ? "succeeded" : "failed"); -// cout << "javavm " << (bSucc ? "succeeded" : "failed") << " !" << endl; return (bSucc ? 0 : -1); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/makefile.mk b/stoc/test/makefile.mk index a7b18d062f8b..2f24634da5a0 100644 --- a/stoc/test/makefile.mk +++ b/stoc/test/makefile.mk @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + PRJ=.. PRJNAME=stoc @@ -38,7 +39,7 @@ TARGET7=testconv TARGET8=testproxyfac TARGET9=testsmgr2 TARGETTYPE=CUI -#LIBTARGET=NO + ENABLE_EXCEPTIONS=TRUE NO_BSYMBOLIC=TRUE @@ -59,7 +60,6 @@ SHL1STDLIBS= \ SHL1TARGET=testsmgr_component SHL1DEPN= SHL1IMPLIB=i$(SHL1TARGET) -#SHL1LIBS=$(SLB)$/$(SHL1TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) SHL1VERSIONMAP=testsmgr_cpnt.map diff --git a/stoc/test/mergekeys_.cxx b/stoc/test/mergekeys_.cxx index b75a1ef7df35..e47de6cfbc00 100644 --- a/stoc/test/mergekeys_.cxx +++ b/stoc/test/mergekeys_.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,3 +30,5 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_stoc.hxx" #include "../source/implementationregistration/mergekeys.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx index ca245d7d7f43..cb47b3371e8c 100644 --- a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx +++ b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -867,7 +868,7 @@ sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const &) } rtl::OUString Service::getImplementationName() { - return rtl::OUString::createFromAscii("test.registrytdprovider.impl"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.impl")); } css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames() { @@ -911,9 +912,9 @@ namespace { bool writeInfo(void * registryKey, rtl::OUString const & implementationName, css::uno::Sequence< rtl::OUString > const & serviceNames) { - rtl::OUString keyName(rtl::OUString::createFromAscii("/")); + rtl::OUString keyName(RTL_CONSTASCII_USTRINGPARAM("/")); keyName += implementationName; - keyName += rtl::OUString::createFromAscii("/UNO/SERVICES"); + keyName += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); css::uno::Reference< css::registry::XRegistryKey > key; try { key = static_cast< css::registry::XRegistryKey * >(registryKey)-> @@ -941,3 +942,5 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) { && writeInfo(registryKey, Service::getImplementationName(), Service::getSupportedServiceNames()); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/security/test_security.cxx b/stoc/test/security/test_security.cxx index 3678ed2b7c65..510f832b09b1 100644 --- a/stoc/test/security/test_security.cxx +++ b/stoc/test/security/test_security.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -521,3 +522,5 @@ SAL_IMPLEMENT_MAIN() return 1; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/tdmanager/testtdmanager.cxx b/stoc/test/tdmanager/testtdmanager.cxx index 53b793c8fbe4..6f3542697b94 100644 --- a/stoc/test/tdmanager/testtdmanager.cxx +++ b/stoc/test/tdmanager/testtdmanager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -298,7 +299,7 @@ sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const & arguments) } rtl::OUString Service::getImplementationName() { - return rtl::OUString::createFromAscii("test.tdmanager.impl"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test.tdmanager.impl")); } css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames() { @@ -342,9 +343,9 @@ namespace { bool writeInfo(void * registryKey, rtl::OUString const & implementationName, css::uno::Sequence< rtl::OUString > const & serviceNames) { - rtl::OUString keyName(rtl::OUString::createFromAscii("/")); + rtl::OUString keyName(RTL_CONSTASCII_USTRINGPARAM("/")); keyName += implementationName; - keyName += rtl::OUString::createFromAscii("/UNO/SERVICES"); + keyName += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); css::uno::Reference< css::registry::XRegistryKey > key; try { key = static_cast< css::registry::XRegistryKey * >(registryKey)-> @@ -372,3 +373,5 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) { && writeInfo(registryKey, Service::getImplementationName(), Service::getSupportedServiceNames()); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testconv.cxx b/stoc/test/testconv.cxx index 0687046512af..d8c0dd359e6a 100644 --- a/stoc/test/testconv.cxx +++ b/stoc/test/testconv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,7 +44,6 @@ #include <stdio.h> -using namespace rtl; using namespace cppu; using namespace osl; using namespace com::sun::star::uno; @@ -52,6 +52,9 @@ using namespace com::sun::star::script; using namespace com::sun::star::reflection; using namespace com::sun::star::registry; +using ::rtl::OUString; +using ::rtl::OUStringToOString; + const double MIN_DOUBLE = -DBL_MAX; const double MAX_DOUBLE = DBL_MAX; const double MIN_FLOAT = -FLT_MAX; @@ -305,66 +308,66 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) sal_uInt32 nElems = 0; // ==BYTE== - aVal <<= OUString::createFromAscii( "0xff" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0xff")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "255" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("255")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_Int8)0xffu; pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "0x80" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x80")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "128" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("128")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_Int8)( 0x80u ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "0x7f" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x7f")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "127" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("127")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); aVal <<= (sal_Int8)( 0x7f ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "5" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("5")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "+5" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("+5")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); aVal <<= (sal_Int8)( 5 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "-5" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-5")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa aVal <<= (sal_Int8)( -5 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "256" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("256")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa // ==UINT16== - aVal <<= OUString::createFromAscii( "65535" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("65535")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "0xffff" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0xffff")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt16)( 0xffff ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "32768" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("32768")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt16)( 0x8000 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "32767" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("32767")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "0x7fff" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x7fff")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt16)( 0x7fff ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "256" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("256")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "0x100" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x100")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt16)( 0x100 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 ); @@ -395,33 +398,33 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa // ==UINT32== - aVal <<= OUString::createFromAscii( "+4294967295" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("+4294967295")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "4294967295" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("4294967295")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "0xffffffff" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0xffffffff")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt32)( 0xffffffff ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "-2147483648" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-2147483648")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "-0x80000000" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-0x80000000")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa aVal <<= (sal_uInt32)( 0x80000000 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "2147483647" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("2147483647")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "0x7fffffff" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x7fffffff")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt32)( 0x7fffffff ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "65536" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("65536")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); - aVal <<= OUString::createFromAscii( "0x10000" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x10000")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt32)( 0x10000 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 ); @@ -432,7 +435,7 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) aVal <<= (sal_uInt32)( 5 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "0xfffffffb" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0xfffffffb")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (sal_uInt32)( -5 ); // is 0xfffffffb pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); @@ -460,27 +463,27 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa // ==FLOAT== - aVal <<= OUString::createFromAscii( "-3.4e+38" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-3.4e+38")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (float)( MIN_FLOAT ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "+3.4e+38" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("+3.4e+38")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (float)( MAX_FLOAT ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "9e-20" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("9e-20")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); aVal <<= (float)( 9e-20 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "+.7071067811865" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("+.7071067811865")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); aVal <<= (float)( .7071067811865 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "3.14159265359" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("3.14159265359")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); aVal <<= (float)( 3.14159265359 ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); @@ -489,12 +492,12 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa // ==DOUBLE== - aVal <<= OUString::createFromAscii( "-1.7976931348623155e+308" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-1.7976931348623155e+308")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (double)( MIN_DOUBLE ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "1.7976931348623155e+308" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("1.7976931348623155e+308")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); aVal <<= (double)( MAX_DOUBLE ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); @@ -520,7 +523,7 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) aVal <<= (double)( 0xffffffff ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "0x100000000" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0x100000000")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); #ifndef OS2 aVal <<= (double)( SAL_CONST_INT64(0x100000000) ); @@ -535,20 +538,20 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) aVal.setValue( &c, ::getCharCppuType() ); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "A" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("A")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa // ==BOOL== - aVal <<= OUString::createFromAscii( "0" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "1" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("1")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "False" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("False")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "true" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("true")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa @@ -560,17 +563,17 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) aVal <<= OUString(); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "-" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "-0" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("-0")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa // ==TYPECLASS ENUM== - aVal <<= OUString::createFromAscii( "eNuM" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("eNuM")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa - aVal <<= OUString::createFromAscii( "DOUBLE" ); + aVal <<= OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa int e = 1; @@ -600,19 +603,19 @@ static sal_Int32 initBlocks( ConvBlock * pTestBlocks ) Sequence< Any > aAnySeq( 2 ), aAnySeq2( 2 ), aAnySeq3( 2 ); Any * pAnySeq = aAnySeq.getArray(); pAnySeq[0] = makeAny( aINT32Seq ); - pAnySeq[1] = makeAny( OUString::createFromAscii("lala") ); + pAnySeq[1] = makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("lala")) ); aVal <<= aAnySeq; pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa pAnySeq = aAnySeq2.getArray(); pAnySeq[0] <<= (sal_Int32)4711; - pAnySeq[1] <<= OUString::createFromAscii("0815"); + pAnySeq[1] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("0815")); aVal <<= aAnySeq2; pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa pAnySeq = aAnySeq3.getArray(); - pAnySeq[0] <<= OUString::createFromAscii("TypeClass_UNION"); - pAnySeq[1] <<= OUString::createFromAscii("TypeClass_ENUM"); + pAnySeq[0] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TypeClass_UNION")); + pAnySeq[1] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TypeClass_ENUM")); aVal <<= aAnySeq3; pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ); // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa @@ -625,7 +628,7 @@ static void test_Conversion( const Reference< XMultiServiceFactory > & xMgr ) printf( "test_Conversion(): start...\n" ); Reference< XTypeConverter > xConverter( xMgr->createInstance( - OUString::createFromAscii( "com.sun.star.script.Converter" ) ), UNO_QUERY ); + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter")) ), UNO_QUERY ); ConvBlock * pTestBlocks = new ConvBlock[256]; sal_Int32 nPos = initBlocks( pTestBlocks ); @@ -675,27 +678,27 @@ static void test_Conversion( const Reference< XMultiServiceFactory > & xMgr ) SAL_IMPLEMENT_MAIN() { - Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString::createFromAscii("stoctest.rdb") ) ); + Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString(RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb")) ) ); try { Reference< XImplementationRegistration > xImplReg( - xMgr->createInstance( OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY ); + xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration")) ), UNO_QUERY ); OSL_ENSURE( xImplReg.is(), "### no impl reg!" ); OUString aLibName( RTL_CONSTASCII_USTRINGPARAM("stocservices.uno" SAL_DLLEXTENSION) ); xImplReg->registerImplementation( - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), aLibName, Reference< XSimpleRegistry >() ); test_Conversion( xMgr ); } catch (Exception & rExc) { - OSL_ENSURE( sal_False, "### exception occured!" ); + OSL_ENSURE( sal_False, "### exception occurred!" ); OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### exception occured: " ); + OSL_TRACE( "### exception occurred: " ); OSL_TRACE( aMsg.getStr() ); OSL_TRACE( "\n" ); } @@ -703,3 +706,5 @@ SAL_IMPLEMENT_MAIN() Reference< XComponent >( xMgr, UNO_QUERY )->dispose(); return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testcorefl.cxx b/stoc/test/testcorefl.cxx index 31cc9fc18b8a..63bde05d44e2 100644 --- a/stoc/test/testcorefl.cxx +++ b/stoc/test/testcorefl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,7 +60,6 @@ #include <stdio.h> -using namespace rtl; using namespace cppu; using namespace osl; using namespace ModuleA; @@ -74,6 +74,10 @@ using namespace com::sun::star::registry; using namespace com::sun::star::reflection; using namespace com::sun::star::container; +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; + //================================================================================================== class OInterfaceA : public WeakImplHelper1< XInterfaceA > @@ -105,23 +109,23 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Reference< XHierarchicalNameAccess > xHNameAccess( xRefl, UNO_QUERY ); TEST_ENSHURE(xHNameAccess.is(), "### cannot get XHierarchicalNameAccess!" ); - TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.StructA"))->getName() == OUString::createFromAscii("ModuleA.StructA"), "test_RegCoreReflection(): error 2b"); - TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.ExceptionB"))->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 2c"); - TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.ModuleB.EnumA")).is(), "test_RegCoreReflection(): error 2e"); + TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")))->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 2b"); + TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionB")))->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 2c"); + TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA"))).is(), "test_RegCoreReflection(): error 2e"); // const - TEST_ENSHURE(*(const sal_Bool *)xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstBoolean")).getValue() == aConstBoolean, "test_RegCoreReflection(): error 4c"); - TEST_ENSHURE(*(const sal_Int8 *)xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstByte")).getValue() == aConstByte, "test_RegCoreReflection(): error 4e"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstShort")) == aConstShort, "test_RegCoreReflection(): error 4g"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstUShort")) == aConstUShort, "test_RegCoreReflection(): error 4i"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstLong")) == aConstLong, "test_RegCoreReflection(): error 4k"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstULong")) == aConstULong, "test_RegCoreReflection(): error 4m"); -// TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstFloat")) == aConstFloat, "test_RegCoreReflection(): error 4o"); -// TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstDouble")) == aConstDouble, "test_RegCoreReflection(): error 4q"); + TEST_ENSHURE(*(const sal_Bool *)xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstBoolean"))).getValue() == aConstBoolean, "test_RegCoreReflection(): error 4c"); + TEST_ENSHURE(*(const sal_Int8 *)xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstByte"))).getValue() == aConstByte, "test_RegCoreReflection(): error 4e"); + TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstShort"))) == aConstShort, "test_RegCoreReflection(): error 4g"); + TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstUShort"))) == aConstUShort, "test_RegCoreReflection(): error 4i"); + TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstLong"))) == aConstLong, "test_RegCoreReflection(): error 4k"); + TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstULong"))) == aConstULong, "test_RegCoreReflection(): error 4m"); +// TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstFloat"))) == aConstFloat, "test_RegCoreReflection(): error 4o"); +// TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstDouble"))) == aConstDouble, "test_RegCoreReflection(): error 4q"); // Enums - xClass = xRefl->forName(OUString::createFromAscii("ModuleA.ModuleB.EnumA")); + xClass = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA"))); TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 5"); @@ -140,9 +144,9 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) // Interface - Reference< XIdlClass > xA = xRefl->forName( OUString::createFromAscii("ModuleC.XInterfaceB") ); + Reference< XIdlClass > xA = xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceB")) ); - xClass = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceB")); + xClass = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceB"))); TEST_ENSHURE(xClass == xA, "test_RegCoreReflection(): error 7"); TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 7a"); @@ -158,10 +162,10 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) typelib_typedescription_release( pTD ); TEST_ENSHURE(xClass->getSuperclasses().getLength() == 1, "test_RegCoreReflection(): error 9"); - TEST_ENSHURE(xClass->getSuperclasses().getArray()[0]->getName() == OUString::createFromAscii("ModuleC.XInterfaceA"), "test_RegCoreReflection(): error 10"); + TEST_ENSHURE(xClass->getSuperclasses().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")), "test_RegCoreReflection(): error 10"); TEST_ENSHURE(xClass->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11"); TEST_ENSHURE(xA->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11a"); - TEST_ENSHURE(xClass->getMethods().getArray()[3]->getName() == OUString::createFromAscii("methodA"), "test_RegCoreReflection(): 12"); + TEST_ENSHURE(xClass->getMethods().getArray()[3]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodA")), "test_RegCoreReflection(): 12"); TEST_ENSHURE(xClass->getMethods().getArray()[3]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 13"); TEST_ENSHURE(xClass->getMethods().getArray()[3]->getParameterTypes().getLength() == 0, "test_RegCoreReflection(): error 14"); TEST_ENSHURE(xClass->getMethods().getArray()[3]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 15"); @@ -174,44 +178,44 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aType == xRefl->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("short") ) ), "test_RegCoreReflection(): error 18b"); TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aMode == ParamMode_IN, "test_RegCoreReflection(): error 18c"); TEST_ENSHURE(xClass->getMethods().getArray()[4]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 19"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getName() == OUString::createFromAscii("methodC"), "test_RegCoreReflection(): error 20"); + TEST_ENSHURE(xClass->getMethods().getArray()[5]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")), "test_RegCoreReflection(): error 20"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getMode() == MethodMode_TWOWAY, "test_RegCoreReflection(): error 20a"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 21"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 22"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getName() == OUString::createFromAscii("ModuleA.StructB"), "test_RegCoreReflection(): error 23"); + TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructB")), "test_RegCoreReflection(): error 23"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getLength() == 2, "test_RegCoreReflection(): error 24"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 25"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getName() == OUString::createFromAscii("ModuleA.StructC"), "test_RegCoreReflection(): error 26"); + TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")), "test_RegCoreReflection(): error 26"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 27"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getName() == OUString::createFromAscii("ModuleA.StructA"), "test_RegCoreReflection(): error 28"); + TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 28"); TEST_ENSHURE(xClass->getMethods().getArray()[5]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 29"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getName() == OUString::createFromAscii("methodD"), "test_RegCoreReflection(): error 30"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodD")), "test_RegCoreReflection(): error 30"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 31"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getName() == OUString::createFromAscii("ModuleC.XInterfaceA"), "test_RegCoreReflection(): error 32"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")), "test_RegCoreReflection(): error 32"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 33"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_ENUM, "test_RegCoreReflection(): error 34"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getName() == OUString::createFromAscii("ModuleA.ModuleB.EnumA"), "test_RegCoreReflection(): error 35"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA")), "test_RegCoreReflection(): error 35"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getLength() == 3, "test_RegCoreReflection(): error 36"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 37"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getName() == OUString::createFromAscii("ModuleA.ExceptionA"), "test_RegCoreReflection(): error 38"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionA")), "test_RegCoreReflection(): error 38"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 38"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getName() == OUString::createFromAscii("ModuleA.ExceptionB"), "test_RegCoreReflection(): error 39"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionB")), "test_RegCoreReflection(): error 39"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 40"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getName() == OUString::createFromAscii("ModuleA.ExceptionC"), "test_RegCoreReflection(): error 41"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionC")), "test_RegCoreReflection(): error 41"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getLength() == 3, "test_RegCoreReflection(): error 42"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getTypeClass() == TypeClass_BOOLEAN, "test_RegCoreReflection(): error 43"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getName() == OUString::createFromAscii("boolean"), "test_RegCoreReflection(): error 43a"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")), "test_RegCoreReflection(): error 43a"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 44"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getName() == OUString::createFromAscii("ModuleA.StructC"), "test_RegCoreReflection(): error 45"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")), "test_RegCoreReflection(): error 45"); TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 46"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getName() == OUString::createFromAscii("ModuleA.XInterface1"), "test_RegCoreReflection(): error 47"); + TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.XInterface1")), "test_RegCoreReflection(): error 47"); // SequenceReflections - TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[]ModuleA.StructA") )->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 48"); - TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[]ModuleA.StructA") )->getComponentType().is(), "test_RegCoreReflection(): error 49"); - TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[][]ModuleA.StructA") )->getComponentType()->getComponentType()->getName() == OUString::createFromAscii("ModuleA.StructA"), "test_RegCoreReflection(): error 50"); - TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[]com.sun.star.uno.XInterface") ) == xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString::createFromAscii("aInterfaceSeq"))->getType(), "test_RegCoreReflection(): error 51"); + TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 48"); + TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->getComponentType().is(), "test_RegCoreReflection(): error 49"); + TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[][]ModuleA.StructA")) )->getComponentType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 50"); + TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]com.sun.star.uno.XInterface")) ) == xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aInterfaceSeq")))->getType(), "test_RegCoreReflection(): error 51"); StructC aStructC; aStructC.aLong = aConstLong; @@ -222,7 +226,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any aAny; - xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aInterfaceSeq"))->getType()->createObject(aAny); + xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aInterfaceSeq")))->getType()->createObject(aAny); TEST_ENSHURE(aAny.getValueType() == ::getCppuType( (const Sequence<Reference< XInterface > > *)0 ), "test_RegCoreReflection(): error 51a"); @@ -233,33 +237,33 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get( Any(&aStructC, ::getCppuType( (const StructC *)0 ))).getValue() == aConstLong, "test_RegCoreReflection(): error 52"); - TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.StructA"))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->getAccessMode() == FieldAccessMode_READWRITE, "test_RegCoreReflection(): error 52a"); + TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->getAccessMode() == FieldAccessMode_READWRITE, "test_RegCoreReflection(): error 52a"); Reference< XIdlField2 > rField ( xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") )) , UNO_QUERY ); rField->set(aStructAny, aAny); - TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString::createFromAscii("ModuleA.StructB"))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get(aStructAny).getValue() == *(sal_Int32*)aAny.getValue(), "test_RegCoreReflection(): error 53"); + TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructB")))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get(aStructAny).getValue() == *(sal_Int32*)aAny.getValue(), "test_RegCoreReflection(): error 53"); - xRefl->forName( OUString::createFromAscii("[]ModuleA.StructA") )->createObject(aAny); + xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->createObject(aAny); TEST_ENSHURE(aAny.getValueTypeName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("[]ModuleA.StructA")), "test_RegCoreReflection(): error 54"); - xRefl->forName(OUString::createFromAscii("[][]ModuleA.StructA"))->createObject(aAny); + xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("[][]ModuleA.StructA")))->createObject(aAny); TEST_ENSHURE(aAny.getValueTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("[][]ModuleA.StructA") ), "test_RegCoreReflection(): error 56"); // xClass = xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.XIntroTest") )); // TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 58"); -// TEST_ENSHURE(xClass->getMethod(OUString::createFromAscii("getStrings"))->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 59"); -// TEST_ENSHURE(xClass->getMethod(OUString::createFromAscii("getStrings"))->getReturnType()->getComponentType()->getName() == OUString::createFromAscii("string"), "test_RegCoreReflection(): error 60"); +// TEST_ENSHURE(xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 59"); +// TEST_ENSHURE(xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("string")), "test_RegCoreReflection(): error 60"); -// xClass->getMethod(OUString::createFromAscii("getStrings"))->getReturnType()->createObject(aAny); +// xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->createObject(aAny); // TEST_ENSHURE(aAny.getValueTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("[]string") ), "test_RegCoreReflection(): error 61"); - TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("[][][]unsigned long"))->getComponentType()->getComponentType()->getComponentType()->getTypeClass() == TypeClass_UNSIGNED_LONG, "test_RegCoreReflection(): error 62"); + TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("[][][]unsigned long")))->getComponentType()->getComponentType()->getComponentType()->getTypeClass() == TypeClass_UNSIGNED_LONG, "test_RegCoreReflection(): error 62"); try { fprintf( stderr, "%1\n" ); - Any bla = xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->get(Any()); + Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->get(Any()); TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 63"); return sal_False; } @@ -273,9 +277,9 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any blup; blup <<= aStructC; Any gulp; - rField = Reference< XIdlField2 > ( xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString")) , UNO_QUERY); + rField = Reference< XIdlField2 > ( xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString"))) , UNO_QUERY); rField->set( blup, gulp); -// xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->set(blup, gulp); +// xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->set(blup, gulp); TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 64"); return sal_False; } @@ -291,8 +295,8 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any blup; blup <<= aStructC; rField = Reference< XIdlField2 > ( - xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString")) , UNO_QUERY); - xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->set(blup, gulp); + xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString"))) , UNO_QUERY); + xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->set(blup, gulp); TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 65"); return sal_False; } @@ -301,10 +305,10 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) } Any gulp; - gulp <<= OUString(OUString::createFromAscii("Test")); + gulp <<= OUString(OUString(RTL_CONSTASCII_USTRINGPARAM("Test"))); Any blup; blup <<= aStructC; - xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->set(blup, gulp); + xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->set(blup, gulp); Reference< XInterfaceA > xAI = new OInterfaceA(); @@ -315,7 +319,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; - Any bla = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params); + Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params); TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 66"); return sal_False; } @@ -333,7 +337,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; - Any bla = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params); + Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params); } try { @@ -344,7 +348,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; - Any bla = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params); + Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params); TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 67"); return sal_False; } @@ -359,7 +363,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; - TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params).getValueType() + TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params).getValueType() == ::getCppuType( (const Sequence<StructB> *)0 ), "test_RegCoreReflection(): error 68"); return sal_True; @@ -399,10 +403,10 @@ SAL_IMPLEMENT_MAIN() } catch (Exception & rExc) { - OSL_ENSURE( sal_False, "### exception occured!" ); + OSL_ENSURE( sal_False, "### exception occurred!" ); OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### exception occured: " ); + OSL_TRACE( "### exception occurred: " ); OSL_TRACE( aMsg.getStr() ); OSL_TRACE( "\n" ); } @@ -410,3 +414,5 @@ SAL_IMPLEMENT_MAIN() printf( "testcorefl %s !\n", (bSucc ? "succeeded" : "failed") ); return (bSucc ? 0 : -1); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testiadapter.cxx b/stoc/test/testiadapter.cxx index 62c9736aa204..b91cae5ec98a 100644 --- a/stoc/test/testiadapter.cxx +++ b/stoc/test/testiadapter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,7 +50,6 @@ using namespace test; -using namespace rtl; using namespace cppu; using namespace osl; using namespace com::sun::star::uno; @@ -60,6 +60,10 @@ using namespace com::sun::star::reflection; using namespace com::sun::star::lang; using namespace com::sun::star::registry; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringToOString; + //================================================================================================== sal_Bool equals( const test::TestElement & rData1, const test::TestElement & rData2 ) @@ -763,7 +767,7 @@ sal_Bool performTest( const Reference<XLanguageBindingTest > & xLBT ) sal_True, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, SAL_CONST_INT64(0x123456789abcdef0), SAL_CONST_UINT64(0xfedcba9876543210), - (float)17.0815, 3.1415926359, TestEnum_LOLA, OUString::createFromAscii("dumdidum"), xI, + (float)17.0815, 3.1415926359, TestEnum_LOLA, OUString(RTL_CONSTASCII_USTRINGPARAM("dumdidum")), xI, Any( &xI, ::getCppuType( (const Reference<XInterface > *)0 ) ) ); OSL_ENSURE( aData.Any == xI, "### unexpected any!" ); @@ -866,7 +870,7 @@ test::TestData Test_Impl::raiseException( sal_Bool& /*bBool*/, sal_Unicode& /*cC { IllegalArgumentException aExc; aExc.ArgumentPosition = 5; - aExc.Message = OUString::createFromAscii("dum dum dum ich tanz im kreis herum..."); + aExc.Message = OUString(RTL_CONSTASCII_USTRINGPARAM("dum dum dum ich tanz im kreis herum...")); aExc.Context = *this; throw aExc; } @@ -874,7 +878,7 @@ test::TestData Test_Impl::raiseException( sal_Bool& /*bBool*/, sal_Unicode& /*cC sal_Int32 Test_Impl::getRuntimeException() throw(::com::sun::star::uno::RuntimeException) { RuntimeException aExc; - aExc.Message = OUString::createFromAscii("dum dum dum ich tanz im kreis herum..."); + aExc.Message = OUString(RTL_CONSTASCII_USTRINGPARAM("dum dum dum ich tanz im kreis herum...")); aExc.Context = *this; throw aExc; } @@ -882,7 +886,7 @@ sal_Int32 Test_Impl::getRuntimeException() throw(::com::sun::star::uno::RuntimeE void Test_Impl::setRuntimeException( sal_Int32 /*_runtimeexception*/ ) throw(::com::sun::star::uno::RuntimeException) { RuntimeException aExc; - aExc.Message = OUString::createFromAscii("dum dum dum ich tanz im kreis herum..."); + aExc.Message = OUString(RTL_CONSTASCII_USTRINGPARAM("dum dum dum ich tanz im kreis herum...")); aExc.Context = *this; throw aExc; } @@ -951,7 +955,7 @@ sal_Bool raiseException( const Reference<XLanguageBindingTest > & xLBT ) static sal_Bool test_adapter( const Reference< XMultiServiceFactory > & xMgr ) { Reference< XInvocationAdapterFactory > xAdapFac( - xMgr->createInstance( OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY ); + xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.InvocationAdapterFactory")) ), UNO_QUERY ); Reference< XInvocationAdapterFactory2 > xAdapFac2( xAdapFac, UNO_QUERY_THROW ); Reference< XLanguageBindingTest > xOriginal( (XLanguageBindingTest *)new Test_Impl() ); @@ -996,9 +1000,9 @@ static sal_Bool test_adapter( const Reference< XMultiServiceFactory > & xMgr ) static sal_Bool test_invocation( const Reference< XMultiServiceFactory > & xMgr ) { Reference< XInvocationAdapterFactory > xAdapFac( - xMgr->createInstance( OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY ); + xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.InvocationAdapterFactory")) ), UNO_QUERY ); Reference< XSingleServiceFactory > xInvocFac( - xMgr->createInstance( OUString::createFromAscii("com.sun.star.script.Invocation") ), UNO_QUERY ); + xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Invocation")) ), UNO_QUERY ); Reference< XLanguageBindingTest > xOriginal( (XLanguageBindingTest *)new Test_Impl() ); Any aOriginal( &xOriginal, ::getCppuType( &xOriginal ) ); @@ -1027,24 +1031,24 @@ SAL_IMPLEMENT_MAIN() OSL_ENSURE( xImplReg.is(), "### no impl reg!" ); xImplReg->registerImplementation( - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), - OUString::createFromAscii("invocadapt.uno" SAL_DLLEXTENSION), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), + OUString(RTL_CONSTASCII_USTRINGPARAM("invocadapt.uno" SAL_DLLEXTENSION)), Reference< XSimpleRegistry >() ); xImplReg->registerImplementation( - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), - OUString::createFromAscii("stocservices.uno" SAL_DLLEXTENSION), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), + OUString(RTL_CONSTASCII_USTRINGPARAM("stocservices.uno" SAL_DLLEXTENSION)), Reference< XSimpleRegistry >() ); xImplReg->registerImplementation( - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), - OUString::createFromAscii("invocation.uno" SAL_DLLEXTENSION), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), + OUString(RTL_CONSTASCII_USTRINGPARAM("invocation.uno" SAL_DLLEXTENSION)), Reference< XSimpleRegistry >() ); xImplReg->registerImplementation( - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), - OUString::createFromAscii("reflection.uno" SAL_DLLEXTENSION), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), + OUString(RTL_CONSTASCII_USTRINGPARAM("reflection.uno" SAL_DLLEXTENSION)), Reference< XSimpleRegistry >() ); xImplReg->registerImplementation( - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), - OUString::createFromAscii("introspection.uno" SAL_DLLEXTENSION), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), + OUString(RTL_CONSTASCII_USTRINGPARAM("introspection.uno" SAL_DLLEXTENSION)), Reference< XSimpleRegistry >() ); if (test_adapter( xMgr )) @@ -1058,7 +1062,7 @@ SAL_IMPLEMENT_MAIN() } catch (Exception & rExc) { - fprintf( stderr, "> exception occured: " ); + fprintf( stderr, "> exception occurred: " ); OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "%s\n", aMsg.getStr() ); } @@ -1067,3 +1071,5 @@ SAL_IMPLEMENT_MAIN() return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx index a706f8666fee..9a075333fac6 100644 --- a/stoc/test/testintrosp.cxx +++ b/stoc/test/testintrosp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,8 +35,6 @@ #include <cppuhelper/servicefactory.hxx> #include <osl/diagnose.h> -//#include <vos/dynload.hxx> - #include <ModuleA/XIntroTest.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XIntrospection.hpp> @@ -48,21 +47,14 @@ #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> -//#include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <stdio.h> #include <string.h> - -using namespace rtl; using namespace cppu; -//using namespace vos; 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; @@ -71,6 +63,11 @@ using namespace com::sun::star::reflection; using namespace com::sun::star::container; using namespace com::sun::star::beans::PropertyAttribute; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OUStringToOString; +using ::rtl::OStringToOUString; + typedef WeakImplHelper4< XIntroTest, XPropertySet, XNameAccess, XIndexAccess > ImplIntroTestHelper; typedef WeakImplHelper1< XPropertySetInfo > ImplPropertySetInfoHelper; @@ -85,10 +82,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 *** //************************************************************** @@ -106,7 +99,7 @@ Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XMultiS if( !xRefl.is() ) { xRefl = Reference< XIdlReflection >( xMgr->createInstance( - OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY ); + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ), UNO_QUERY ); OSL_ENSURE( xRefl.is(), "### no corereflection!" ); } xRetClass = xRefl->forName( sOWName ); @@ -130,32 +123,28 @@ OUString AnyToString( const Any& aValue, sal_Bool bIncludeType, const Reference< OUString aRetStr; switch( eType ) { - case TypeClass_TYPE: aRetStr = OUString::createFromAscii("TYPE TYPE"); break; - case TypeClass_INTERFACE: aRetStr = OUString::createFromAscii("TYPE INTERFACE"); break; - case TypeClass_SERVICE: aRetStr = OUString::createFromAscii("TYPE SERVICE"); break; - case TypeClass_STRUCT: aRetStr = OUString::createFromAscii("TYPE STRUCT"); break; - case TypeClass_TYPEDEF: aRetStr = OUString::createFromAscii("TYPE TYPEDEF"); break; - case TypeClass_UNION: aRetStr = OUString::createFromAscii("TYPE UNION"); break; - case TypeClass_ENUM: aRetStr = OUString::createFromAscii("TYPE ENUM"); break; - case TypeClass_EXCEPTION: aRetStr = OUString::createFromAscii("TYPE EXCEPTION"); break; - case TypeClass_ARRAY: aRetStr = OUString::createFromAscii("TYPE ARRAY"); break; - case TypeClass_SEQUENCE: aRetStr = OUString::createFromAscii("TYPE SEQUENCE"); break; - case TypeClass_VOID: aRetStr = OUString::createFromAscii("TYPE void"); break; - case TypeClass_ANY: aRetStr = OUString::createFromAscii("TYPE any"); break; - case TypeClass_UNKNOWN: aRetStr = OUString::createFromAscii("TYPE unknown"); break; + case TypeClass_TYPE: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE TYPE")); break; + case TypeClass_INTERFACE: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE INTERFACE")); break; + case TypeClass_SERVICE: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE SERVICE")); break; + case TypeClass_STRUCT: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE STRUCT")); break; + case TypeClass_TYPEDEF: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE TYPEDEF")); break; + case TypeClass_UNION: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE UNION")); break; + case TypeClass_ENUM: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE ENUM")); break; + case TypeClass_EXCEPTION: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE EXCEPTION")); break; + case TypeClass_ARRAY: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE ARRAY")); break; + case TypeClass_SEQUENCE: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE SEQUENCE")); break; + case TypeClass_VOID: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE void")); break; + case TypeClass_ANY: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE any")); break; + case TypeClass_UNKNOWN: aRetStr = OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE unknown")); break; 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; } @@ -201,76 +190,17 @@ 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: ; } if( bIncludeType ) { Reference< XIdlClass > xIdlClass = TypeToIdlClass( aValType, xMgr ); - aRetStr = aRetStr + OUString( OUString::createFromAscii(" (Typ: ") ) + xIdlClass->getName() + OUString::createFromAscii(")"); + aRetStr = aRetStr + OUString( OUString(RTL_CONSTASCII_USTRINGPARAM(" (Typ: ")) ) + xIdlClass->getName() + OUString(RTL_CONSTASCII_USTRINGPARAM(")")); } 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 *** //***************************************** @@ -284,15 +214,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( ) @@ -301,35 +222,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,25 +236,19 @@ Sequence< Property > ImplPropertySetInfo::getProperties(void) pSeq = new Sequence<Property>( 3 ); Property * pAry = pSeq->getArray(); - pAry[0].Name = OUString::createFromAscii("Factor"); + 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::createFromAscii("MyCount"); + 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::createFromAscii("Info"); + 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. @@ -396,13 +285,7 @@ sal_Bool ImplPropertySetInfo::hasPropertyByName(const OUString& Name) return sal_False; } - - - //***************************************************************** - - - class ImplIntroTest : public ImplIntroTestHelper { Reference< XMultiServiceFactory > mxMgr; @@ -412,9 +295,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; @@ -454,24 +334,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( ) @@ -493,19 +359,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) @@ -515,7 +368,7 @@ public: virtual OUString SAL_CALL getFirstName() throw(RuntimeException); virtual OUString SAL_CALL getLastName() throw(RuntimeException) - { return OUString( OUString::createFromAscii("Meyer") ); } + { return OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("Meyer")) ); } virtual sal_Int16 SAL_CALL getAge() throw(RuntimeException) { return m_nMarkusAge; } virtual sal_Int16 SAL_CALL getChildrenCount() throw(RuntimeException) @@ -578,8 +431,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 @@ -589,10 +440,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 @@ -600,28 +447,20 @@ 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 static sal_Int32 nObjCount = 0; - OUString aName( OUString::createFromAscii("IntroTest-Obj Nr. ") ); + OUString aName( RTL_CONSTASCII_USTRINGPARAM("IntroTest-Obj Nr. ") ); aName += OUString::valueOf( nObjCount ); setObjectName( aName ); // Properties initialisieren aAnyArray[0] <<= 3.14; aAnyArray[1] <<= (sal_Int32)42; - aAnyArray[2] <<= OUString( OUString::createFromAscii("Hallo") ); - - // Output-Interface - //m_pOutput = NULL; + aAnyArray[2] <<= OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")) ); // Einmal fuer den internen Gebrauch die PropertySetInfo abholen m_xMyInfo = getPropertySetInfo(); @@ -640,12 +479,12 @@ void ImplIntroTest::Init( void ) // String-Sequence intitialisieren aStringSeq.realloc( 3 ); OUString* pStr = aStringSeq.getArray(); - pStr[ 0 ] = OUString( OUString::createFromAscii("String 0") ); - pStr[ 1 ] = OUString( OUString::createFromAscii("String 1") ); - pStr[ 2 ] = OUString( OUString::createFromAscii("String 2") ); + pStr[ 0 ] = OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("String 0")) ); + pStr[ 1 ] = OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("String 1")) ); + pStr[ 2 ] = OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("String 2")) ); // structs initialisieren - m_aFirstStruct.Name = OUString::createFromAscii("FirstStruct-Name"); + m_aFirstStruct.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("FirstStruct-Name")); m_aFirstStruct.Handle = 77777; //XIdlClassRef Type; m_aFirstStruct.Attributes = -222; @@ -663,36 +502,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) { @@ -700,16 +509,10 @@ Reference< XPropertySetInfo > ImplIntroTest::getPropertySetInfo() // Alle Objekt haben die gleichen Properties, deshalb kann // die Info fr 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 ) { @@ -717,9 +520,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 ) @@ -728,9 +528,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 ); } @@ -746,8 +543,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(); @@ -763,7 +558,7 @@ Any ImplIntroTest::getPropertyValue( const OUString& PropertyName ) OUString ImplIntroTest::getFirstName(void) throw(RuntimeException) { - return OUString( OUString::createFromAscii("Markus") ); + return OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("Markus")) ); } void ImplIntroTest::writeln( const OUString& Text ) @@ -771,21 +566,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 ); @@ -795,7 +580,6 @@ Reference< XIntroTest > ImplIntroTest::getIntroTest() // Methoden von XElementAccess Type ImplIntroTest::getElementType( ) throw(RuntimeException) -//XIdlClassRef ImplIntroTest::getElementType(void) const THROWS( (UsrSystemException) ) { // TODO Type aRetType; @@ -806,7 +590,6 @@ Type ImplIntroTest::getElementType( ) sal_Bool ImplIntroTest::hasElements( ) throw(RuntimeException) -//BOOL ImplIntroTest::hasElements(void) const THROWS( (UsrSystemException) ) { return sal_True; } @@ -815,7 +598,7 @@ sal_Bool ImplIntroTest::hasElements( ) sal_Int32 getIndexForName( const OUString& ItemName ) { OUString aLeftStr = ItemName.copy( 0, 4 ); - if( aLeftStr == OUString::createFromAscii("Item") ) + if( aLeftStr == OUString(RTL_CONSTASCII_USTRINGPARAM("Item")) ) { // TODO OUString aNumStr = ItemName.copy( 4 ); @@ -829,8 +612,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; @@ -843,33 +624,27 @@ Any ImplIntroTest::getByName( const OUString& aName ) if( !pNameAccessTab[iIndex].is() ) { ImplIntroTest* p = new ImplIntroTest( mxMgr ); - OUString aName2( OUString::createFromAscii("IntroTest by Name-Access, Index = ") ); + 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(); for( sal_Int32 i = 0 ; i < DEFAULT_NAME_ACCESS_COUNT ; i++ ) { - OUString aName( OUString::createFromAscii("Item") ); + OUString aName( RTL_CONSTASCII_USTRINGPARAM("Item") ); aName += OUString::valueOf( i ); - //aName = aName + StringToUString( i, CHARSET_SYSTEM ); pStr[i] = aName; } return aStrSeq; @@ -877,7 +652,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 ); } @@ -885,15 +659,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; @@ -905,9 +676,8 @@ Any ImplIntroTest::getByIndex( sal_Int32 Index ) if( !pNameAccessTab[Index].is() ) { ImplIntroTest* p = new ImplIntroTest( mxMgr ); - OUString aName( OUString::createFromAscii("IntroTest by Index-Access, Index = ") ); + 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; } @@ -920,17 +690,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) ) { } @@ -986,34 +751,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", @@ -1094,8 +831,6 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, "[]type", "[]byte", }; - //is() nDemandedPropCount = 22; - DefItem pMethodDefs[] = { @@ -1149,14 +884,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 ); @@ -1168,16 +896,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 @@ -1187,9 +908,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; @@ -1203,7 +921,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(); @@ -1214,11 +931,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; @@ -1239,27 +951,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 >"; @@ -1268,15 +971,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 >"; @@ -1288,8 +988,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 ) @@ -1298,8 +996,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, { OUString aStr; aPropVal >>= aStr; - //OString aStr = aPropVal.getString(); - aStr = aStr + OUString::createFromAscii(" (Modified!)"); + aStr = aStr + OUString(RTL_CONSTASCII_USTRINGPARAM(" (Modified!)")); aNewVal <<= aStr; break; } @@ -1354,9 +1051,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 ); @@ -1366,7 +1061,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 ); @@ -1380,10 +1074,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 \""; @@ -1391,7 +1081,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 \""; @@ -1400,8 +1089,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) { @@ -1418,9 +1105,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 ) @@ -1437,13 +1121,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 ); @@ -1464,8 +1143,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 ) { @@ -1476,15 +1153,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 \""; @@ -1492,7 +1166,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 \""; @@ -1501,7 +1174,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) @@ -1517,8 +1189,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++ ) @@ -1528,66 +1198,52 @@ 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; } SAL_IMPLEMENT_MAIN() { - Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString::createFromAscii("stoctest.rdb") ) ); + Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString(RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb")) ) ); sal_Bool bSucc = sal_False; try { Reference< XImplementationRegistration > xImplReg( - xMgr->createInstance( OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY ); + xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration")) ), UNO_QUERY ); OSL_ENSURE( xImplReg.is(), "### no impl reg!" ); // Register services OUString libName( RTL_CONSTASCII_USTRINGPARAM( "reflection.uno" SAL_DLLEXTENSION) ); -// ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("corefl"), libName); fprintf(stderr, "1\n" ); - xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), + xImplReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), libName, Reference< XSimpleRegistry >() ); fprintf(stderr, "2\n" ); - Reference< XIdlReflection > xRefl( xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY ); + Reference< XIdlReflection > xRefl( xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ), UNO_QUERY ); OSL_ENSURE( xRefl.is(), "### no corereflection!" ); // Introspection - libName = OUString::createFromAscii( - "introspection.uno" SAL_DLLEXTENSION); -// ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("insp"), libName); + libName = OUString(RTL_CONSTASCII_USTRINGPARAM( + "introspection.uno" SAL_DLLEXTENSION)); fprintf(stderr, "3\n" ); - xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), + xImplReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), libName, Reference< XSimpleRegistry >() ); fprintf(stderr, "4\n" ); - Reference< XIntrospection > xIntrosp( xMgr->createInstance( OUString::createFromAscii("com.sun.star.beans.Introspection") ), UNO_QUERY ); + Reference< XIntrospection > xIntrosp( xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) ), UNO_QUERY ); OSL_ENSURE( xRefl.is(), "### no corereflection!" ); 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) { - OSL_ENSURE( sal_False, "### exception occured!" ); + OSL_ENSURE( sal_False, "### exception occurred!" ); OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "### exception occured: " ); + OSL_TRACE( "### exception occurred: " ); OSL_TRACE( aMsg.getStr() ); OSL_TRACE( "\n" ); } @@ -1598,20 +1254,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: */ diff --git a/stoc/test/testloader.cxx b/stoc/test/testloader.cxx index a0ef275565e0..e6830dec36e4 100644 --- a/stoc/test/testloader.cxx +++ b/stoc/test/testloader.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <stdio.h> #include <sal/main.h> -#ifndef _OSL_MODULE_H_ #include <osl/module.hxx> -#endif #include <osl/diagnose.h> #include <com/sun/star/loader/XImplementationLoader.hpp> @@ -53,9 +52,10 @@ using namespace com::sun::star::uno; using namespace com::sun::star::loader; using namespace com::sun::star::lang; using namespace osl; -using namespace rtl; using namespace cppu; +using ::rtl::OUString; + #if OSL_DEBUG_LEVEL > 0 #define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) #else @@ -92,7 +92,7 @@ SAL_IMPLEMENT_MAIN() { // try to get provider from module component_getFactoryFunc pCompFactoryFunc = (component_getFactoryFunc) - module.getFunctionSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) ); + module.getFunctionSymbol( OUString(RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY)) ); if (pCompFactoryFunc) { @@ -135,3 +135,4 @@ SAL_IMPLEMENT_MAIN() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testproxyfac.cxx b/stoc/test/testproxyfac.cxx index 38ab9eef51d2..991eff6b6a3e 100644 --- a/stoc/test/testproxyfac.cxx +++ b/stoc/test/testproxyfac.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,7 +77,7 @@ public: // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw (RuntimeException) - { return OUString::createFromAscii( "target" ); } + { return OUString(RTL_CONSTASCII_USTRINGPARAM("target")); } virtual sal_Bool SAL_CALL supportsService( const OUString & /*rServiceName*/ ) throw (RuntimeException) { return sal_False; } @@ -140,7 +141,7 @@ public: // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw (RuntimeException) - { return OUString::createFromAscii( "master" ); } + { return OUString(RTL_CONSTASCII_USTRINGPARAM("master")); } virtual sal_Bool SAL_CALL supportsService( const OUString & /*rServiceName*/ ) throw (RuntimeException) { return sal_False; } @@ -283,8 +284,8 @@ SAL_IMPLEMENT_MAIN() Reference< reflection::XProxyFactory > xProxyFac( xMgr->createInstance( - OUString::createFromAscii( - "com.sun.star.reflection.ProxyFactory") ), + OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.reflection.ProxyFactory")) ), UNO_QUERY_THROW ); Reference< XAggregation > x( @@ -377,3 +378,4 @@ SAL_IMPLEMENT_MAIN() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx index 7be7136933e7..50c8e34c08e3 100644 --- a/stoc/test/testregistry.cxx +++ b/stoc/test/testregistry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,9 +60,12 @@ using namespace com::sun::star::uno; using namespace com::sun::star::registry; using namespace com::sun::star::lang; using namespace com::sun::star::beans; -using namespace rtl; using namespace osl; +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; + #if OSL_DEBUG_LEVEL > 0 #define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) #else @@ -71,35 +75,35 @@ using namespace osl; namespace stoc_impreg { void SAL_CALL mergeKeys( - Reference< registry::XRegistryKey > const & xDest, - Reference< registry::XRegistryKey > const & xSource ) - SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ); +Reference< registry::XRegistryKey > const & xDest, +Reference< registry::XRegistryKey > const & xSource ) +SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ); } static void mergeKeys( - Reference< registry::XSimpleRegistry > const & xDest, - OUString const & rBaseNode, - OUString const & rURL ) - SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ) +Reference< registry::XSimpleRegistry > const & xDest, +OUString const & rBaseNode, +OUString const & rURL ) +SAL_THROW( (registry::InvalidRegistryException, registry::MergeConflictException) ) { - Reference< registry::XRegistryKey > xDestRoot( xDest->getRootKey() ); - Reference< registry::XRegistryKey > xDestKey; - if (rBaseNode.getLength()) - { - xDestKey = xDestRoot->createKey( rBaseNode ); - xDestRoot->closeKey(); - } - else - { - xDestKey = xDestRoot; - } - Reference< registry::XSimpleRegistry > xSimReg( ::cppu::createSimpleRegistry() ); - xSimReg->open( rURL, sal_True, sal_False ); - OSL_ASSERT( xSimReg->isValid() ); - Reference< registry::XRegistryKey > xSourceKey( xSimReg->getRootKey() ); - ::stoc_impreg::mergeKeys( xDestKey, xSourceKey ); - xSourceKey->closeKey(); - xSimReg->close(); - xDestKey->closeKey(); +Reference< registry::XRegistryKey > xDestRoot( xDest->getRootKey() ); +Reference< registry::XRegistryKey > xDestKey; +if (rBaseNode.getLength()) +{ +xDestKey = xDestRoot->createKey( rBaseNode ); +xDestRoot->closeKey(); +} +else +{ +xDestKey = xDestRoot; +} +Reference< registry::XSimpleRegistry > xSimReg( ::cppu::createSimpleRegistry() ); +xSimReg->open( rURL, sal_True, sal_False ); +OSL_ASSERT( xSimReg->isValid() ); +Reference< registry::XRegistryKey > xSourceKey( xSimReg->getRootKey() ); +::stoc_impreg::mergeKeys( xDestKey, xSourceKey ); +xSourceKey->closeKey(); +xSimReg->close(); +xDestKey->closeKey(); } @@ -107,33 +111,33 @@ OString userRegEnv("STAR_USER_REGISTRY="); OUString getExePath() { - OUString exe; - OSL_VERIFY( osl_getExecutableFile( &exe.pData ) == osl_Process_E_None); +OUString exe; +OSL_VERIFY( osl_getExecutableFile( &exe.pData ) == osl_Process_E_None); #if defined(WIN32) || defined(__OS2__) || defined(WNT) - exe = exe.copy(0, exe.getLength() - 16); +exe = exe.copy(0, exe.getLength() - 16); #else - exe = exe.copy(0, exe.getLength() - 12); +exe = exe.copy(0, exe.getLength() - 12); #endif - return exe; +return exe; } void setStarUserRegistry() { - Registry *myRegistry = new Registry(); +Registry *myRegistry = new Registry(); - RegistryKey rootKey, rKey, rKey2; +RegistryKey rootKey, rKey, rKey2; - OUString userReg = getExePath(); - userReg += OUString::createFromAscii("user.rdb"); - if(myRegistry->open(userReg, REG_READWRITE)) - { - TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1"); - } +OUString userReg = getExePath(); +userReg += OUString(RTL_CONSTASCII_USTRINGPARAM("user.rdb")); +if(myRegistry->open(userReg, REG_READWRITE)) +{ +TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1"); +} - TEST_ENSHURE(!myRegistry->close(), "setStarUserRegistry error 9"); - delete myRegistry; +TEST_ENSHURE(!myRegistry->close(), "setStarUserRegistry error 9"); +delete myRegistry; - userRegEnv += OUStringToOString(userReg, RTL_TEXTENCODING_ASCII_US); +userRegEnv += OUStringToOString(userReg, RTL_TEXTENCODING_ASCII_US); putenv((char *)userRegEnv.getStr()); } @@ -144,7 +148,7 @@ void setLinkInDefaultRegistry(const OUString& linkName, const OUString& linkTarg RegistryKey rootKey; OUString appReg = getExePath(); - appReg += OUString::createFromAscii("stoctest.rdb"); + appReg += OUString(RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb")); TEST_ENSHURE(!myRegistry->open(appReg, REG_READWRITE), "setLinkInDefaultRegistry error 1"); TEST_ENSHURE(!myRegistry->openRootKey(rootKey), "setLinkInDefaultRegistry error 2"); @@ -173,7 +177,7 @@ void test_SimpleRegistry( { // try to get provider from module component_getFactoryFunc pCompFactoryFunc = (component_getFactoryFunc) - module.getFunctionSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) ); + module.getFunctionSymbol( OUString(RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY)) ); if (pCompFactoryFunc) { @@ -457,11 +461,11 @@ void test_DefaultRegistry( OUString userRdb(exePath); OUString applicatRdb(exePath); - userRdb += OUString::createFromAscii("user.rdb"); - applicatRdb += OUString::createFromAscii("stoctest.rdb"); + userRdb += OUString(RTL_CONSTASCII_USTRINGPARAM("user.rdb")); + applicatRdb += OUString(RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb")); Reference < XMultiServiceFactory > rSMgr = ::cppu::createRegistryServiceFactory( userRdb, applicatRdb, sal_False, OUString()); - //OUString::createFromAscii("//./e:/src596/stoc/wntmsci3/bin") ); + //OUString(RTL_CONSTASCII_USTRINGPARAM("//./e:/src596/stoc/wntmsci3/bin")) ); Reference< XPropertySet > xPropSet( rSMgr, UNO_QUERY); TEST_ENSHURE( xPropSet.is(), "test_DefaultRegistry error0"); @@ -668,8 +672,8 @@ void test_DefaultRegistry( SAL_IMPLEMENT_MAIN() { // setStarUserRegistry(); - setLinkInDefaultRegistry(OUString::createFromAscii("/Test/DefaultLink"), - OUString::createFromAscii("/Test/FifthKey/MyFirstLink")); + setLinkInDefaultRegistry(OUString(RTL_CONSTASCII_USTRINGPARAM("/Test/DefaultLink")), + OUString(RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink"))); OUString reg1( RTL_CONSTASCII_USTRINGPARAM("testreg1.rdb") ); OUString reg2( RTL_CONSTASCII_USTRINGPARAM("testreg2.rdb") ); @@ -694,3 +698,4 @@ SAL_IMPLEMENT_MAIN() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testsmgr.cxx b/stoc/test/testsmgr.cxx index afa1291db8e3..60b8467f753a 100644 --- a/stoc/test/testsmgr.cxx +++ b/stoc/test/testsmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,7 +80,7 @@ void setStarUserRegistry() RegistryKey rootKey, rKey, rKey2; OUString userReg = getExePath(); - userReg += OUString::createFromAscii("user.rdb"); + userReg += OUString(RTL_CONSTASCII_USTRINGPARAM("user.rdb")); if(myRegistry->open(userReg, REG_READWRITE)) { TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1"); @@ -103,3 +104,5 @@ SAL_IMPLEMENT_MAIN() printf( "ServiceManagerTest : OK\n" ); return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testsmgr2.cxx b/stoc/test/testsmgr2.cxx index b04f188c10f9..f3027ed84cd7 100644 --- a/stoc/test/testsmgr2.cxx +++ b/stoc/test/testsmgr2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -116,3 +117,5 @@ SAL_IMPLEMENT_MAIN() return 1; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/testsmgr_cpnt.cxx b/stoc/test/testsmgr_cpnt.cxx index aecdbc55514f..741f23b15954 100644 --- a/stoc/test/testsmgr_cpnt.cxx +++ b/stoc/test/testsmgr_cpnt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,9 +75,12 @@ using namespace com::sun::star::registry; using namespace com::sun::star::lang; using namespace com::sun::star::container; using namespace osl; -using namespace rtl; using namespace cppu; +using ::rtl::OUString; +using ::rtl::OUStringToOString; +using ::rtl::OString; + Reference<XMultiServiceFactory> getProcessServiceManager() { @@ -85,7 +89,7 @@ Reference<XMultiServiceFactory> getProcessServiceManager() { MutexGuard aGuard( Mutex::getGlobalMutex() ); if (! s_x.is()) - s_x = createRegistryServiceFactory( OUString::createFromAscii( "stoctest.rdb" ), sal_False ); + s_x = createRegistryServiceFactory( OUString(RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb")), sal_False ); } return s_x; } @@ -149,7 +153,7 @@ Reference < XInterface > SAL_CALL Test_Manager_Impl_CreateInstance( // OUString Test_Manager_Impl::getImplementationName() throw() { - return OUString::createFromAscii(IMPLEMENTATION_NAME); + return OUString(RTL_CONSTASCII_USTRINGPARAM(IMPLEMENTATION_NAME)); } //************************************************************************* @@ -179,8 +183,8 @@ Sequence< OUString > Test_Manager_Impl::getSupportedServiceNames(void) throw () Sequence< OUString > Test_Manager_Impl::getSupportedServiceNames_Static(void) throw () { Sequence< OUString > aSNS( 2 ); - aSNS.getArray()[0] = OUString::createFromAscii(SERVICE_NAME); - aSNS.getArray()[1] = OUString::createFromAscii("com.sun.star.bridge.Bridge"); + aSNS.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME)); + aSNS.getArray()[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.Bridge")); return aSNS; } @@ -217,7 +221,7 @@ extern "C" void SAL_CALL test_ServiceManager() Reference<XContentEnumerationAccess> xContEnum(xSMgr, UNO_QUERY); TEST_ENSHURE( xContEnum.is() , "query on XContentEnumerationAccess failed" ); - Reference<XEnumeration > xEnum(xContEnum->createContentEnumeration(OUString::createFromAscii("com.sun.star.registry.SimpleRegistry"))); + Reference<XEnumeration > xEnum(xContEnum->createContentEnumeration(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry")))); TEST_ENSHURE( xEnum.is() , "createContentEnumeration failed" ); sal_Int32 nLen = 0; while( xEnum->hasMoreElements() ) @@ -242,33 +246,33 @@ extern "C" void SAL_CALL test_ServiceManager() TEST_ENSHURE( nLen == 8, "more than 6 factories" ); // try to get an instance for a unknown service - TEST_ENSHURE( !xSMgr->createInstance(OUString::createFromAscii("bla.blup.Q")).is(), "unknown service provider found" ); + TEST_ENSHURE( !xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("bla.blup.Q"))).is(), "unknown service provider found" ); // // First test : register service via the internal function of the component itself // { Reference< XImplementationRegistration > - xInst( xSMgr->createInstance(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration")), UNO_QUERY ); + xInst( xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))), UNO_QUERY ); TEST_ENSHURE( xInst.is(), "no ImplementationRegistration" ); try { // register the services via writeComponentRegInfo (see at end of this file) - xInst->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), atUModule2, Reference< XSimpleRegistry >() ); + xInst->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), atUModule2, Reference< XSimpleRegistry >() ); } catch( CannotRegisterImplementationException e ) { TEST_ENSHURE( 0, "register implementation failed" ); } // getImplementations() check - Sequence<OUString> seqImpl = xInst->getImplementations(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), atUModule2); + Sequence<OUString> seqImpl = xInst->getImplementations(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), atUModule2); TEST_ENSHURE( seqImpl.getLength() == 1, "count of implementantions is wrong" ); - TEST_ENSHURE( seqImpl.getConstArray()[0] == OUString::createFromAscii("com.sun.star.DummyService.V10"), "implementation name is not equal" ); + TEST_ENSHURE( seqImpl.getConstArray()[0] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.DummyService.V10")), "implementation name is not equal" ); // tests, if a service provider can be instantiated. - Reference< XInterface > xIFace(xSMgr->createInstance(OUString::createFromAscii("com.sun.star.ts.TestManagerImpl"))); + Reference< XInterface > xIFace(xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ts.TestManagerImpl")))); TEST_ENSHURE( xIFace.is(), "loadable service not found" ); // remove the service @@ -276,129 +280,6 @@ extern "C" void SAL_CALL test_ServiceManager() "revoke implementation failed" ); } - -// Reference < XSimpleRegistry > xSReg( xSMgr->createInstance(OUString::createFromAscii("com::sun::star.uno.repos.SimpleRegistry")), UNO_QUERY ); -// TEST_ENSHURE( xSReg.is() , "Simple registry couldn't be instantiated" ); - -// xSReg->open(OUString::createFromAscii("dummy.reg"), sal_False, sal_True); -// xSReg->close(); - - // laut dbo : C-API muss nicht mehr unterstuezt werden - //TEST_ENSHURE( registerExternService(atModule, "dummy.reg"), "install failed" ); - //TEST_ENSHURE( deregisterExternService(atModule, "dummy.reg"), "deinstall failed" ); - - -// UNO_INTERFACE(XMultiServiceFactory) xUnoSMgr = {0,0}; -// smart2uno(xSMgr, xUnoSMgr); - -// TEST_ENSHURE(registerExternImplementation(xUnoSMgr, "com::sun::star.loader.SharedLibrary", atModule2, "dummy.reg"), "install failed" ); -// TEST_ENSHURE(revokeExternImplementation(xUnoSMgr, atModule2, "dummy.reg"), "deinstall failed" ); - -// TEST_ENSHURE(registerExternImplementation(xUnoSMgr, "com::sun::star.loader.SharedLibrary", atModule2, "dummy2.reg"), "install failed" ); - -//TODO : Java loader test -// String testUrl(getTestJarUrl()); -// TEST_ENSHURE(registerExternImplementation(xUnoSMgr, "com::sun::star.loader.Java", testUrl, "dummy.reg"), "install failed" ); -// TEST_ENSHURE(revokeExternImplementation(xUnoSMgr, testUrl, "dummy.reg"), "deinstall failed" ); - -// if (!UNO_isNull((UNO_Ifc*)&xUnoSMgr)) -// xUnoSMgr.m_pVmt->release(xUnoSMgr.m_pCtx); - -// xSReg->open(OUString::createFromAscii("dummy.reg"), sal_True, sal_False); -// TEST_ENSHURE(!xSReg->getRootKey()->openKey(OUString::createFromAscii("/SERVICES/com::sun::star/ts/TestManagerImpl/URL")).is(), -// "deinstall failed" ); - -// xSReg->close(); - -// xSReg->open(OUString::createFromAscii("dummy.reg"), sal_False, sal_False); -// xSReg->destroy(); -// xSReg->open(OUString::createFromAscii("dummy2.reg"), sal_False, sal_False); -// xSReg->destroy(); - - - // Test initialisieren -/* - XServiceProviderRef xSiSP1 = createSimpleServiceProvider( OUString::createFromAscii("com::sun::star.usr.Test_Manager_Impl1"), Test_Manager_Impl_getReflection ); - XServiceProviderRef xSiSP11 = createSimpleServiceProvider( OUString::createFromAscii("com::sun::star.usr.Test_Manager_Impl1"), Test_Manager_Impl_getReflection ); - XServiceProviderRef xSiSP2 = createSimpleServiceProvider( OUString::createFromAscii("com::sun::star.usr.Test_Manager_Impl2"), Test_Manager_Impl_getReflection ); -*/ -/* - // second test - // create XServiceProvider via createSingleFactory and write them directly into the registry - // For this is needed a sequence of supported servicenames and a createComponent function pointer - { - Reference< XServiceProvider > xSiSP1(createSingleFactory( - xSMgr, - OUString::createFromAscii("com::sun::star.usr.Test_Manager_Impl1), - Test_Manager_Impl_CreateInstance, - Test_Manager_Impl::getSupportedServiceNames_Static() ), UNO_QUERY); - Reference< XServiceProvider > xSiSP11(createSingleFactory( - xSMgr, - OUString::createFromAscii("com::sun::star.usr.Test_Manager_Impl1"), - Test_Manager_Impl_CreateInstance, - Test_Manager_Impl::getSupportedServiceNames_Static() ),UNO_QUERY); - Reference< XServiceProvider > xSiSP2(createSingleFactory( - xSMgr, - L"com::sun::star.usr.Test_Manager_Impl2", - Test_Manager_Impl_CreateInstance, - Test_Manager_Impl::getSupportedServiceNames_Static() ), UNO_QUERY); - - // put the service providers into the registry - xReg->registerServiceProvider( L"com::sun::star.test.TestManager1", xSiSP1 ); - xReg->registerServiceProvider( L"com::sun::star.test.TestManager1", xSiSP11 ); - xReg->registerServiceProvider( L"com::sun::star.test.TestManager2", xSiSP2 ); - - // TestManager1 - Reference< XServiceProvider > xProv = xSMgr->queryServiceProvider( L"com::sun::star.test.TestManager1"); - Reference< XSingleServiceFactory > xFact( xProv, UNO_QUERY ); - TEST_ENSHURE( xFact.is(), "Service com::sun::star.test.TestManager1 not found" ); - - Reference< XInterface > xTest1 = xFact->createInstance(); - TEST_ENSHURE( nInstanceCount == 1, "wrong service instanciated" ); - - // TestManager2 - xProv = xSMgr->queryServiceProvider( L"com::sun::star.test.TestManager2"); - xFact = Reference < XSingleServiceFactory > ( xProv , UNO_QUERY ); - TEST_ENSHURE( xFact.is(), "Service com::sun::star.test.TestManager2 not found" ); - - Reference < XInterface > xTest2 = xFact->createInstance(); - TEST_ENSHURE( nInstanceCount == 2, "wrong service instanciated" ); - - xTest1 = Reference< XInterface >(); - xTest2 = Reference< XInterface >(); - TEST_ENSHURE( nInstanceCount == 0, "wrong service deleted" ); - - Reference< XEnumeration > xEnum = xSMgr->createProviderEnumeration( L"com::sun::star.test.TestManager1"); - TEST_ENSHURE( xEnum.is() , "no provider enumeration" ); - - sal_Int32 nSPTestManagerImplLen2 = 0; - - while (xEnum.is() && xEnum->hasMoreElements()) - { - nSPTestManagerImplLen2++; - xEnum->nextElement(); - - } - TEST_ENSHURE( nSPTestManagerImplLen2 == 2, "queryServiceProviders() wrong length" ); - - sal_Int32 nCount = 0; - xEnum = xSMgr->createProviderEnumeration( L"com::sun::star.test.TestManager1"); - while (xEnum->hasMoreElements()) - { - Reference< XServiceProvider > xProv; - xEnum->nextElement() >>= xProv; - if (xProv == xSiSP1 || xProv == xSiSP11) - nCount++; - } - - TEST_ENSHURE( nCount == 2 , "not all com::sun::star.testimpl.TestManagerImpl registered" ); -*/ -/* - { - Reference< XMultiServiceFactory > xTestManager(createRegistryServiceManager(L"testmanager.rdb")); - TEST_ENSHURE( xTestManager.is(), "create Test ServiceManager failed!" ); - } -*/ Reference<XComponent> xComp(xSMgr, UNO_QUERY); xComp->dispose(); @@ -470,3 +351,4 @@ void * SAL_CALL component_getFactory( +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/test/uriproc/test_uriproc.cxx b/stoc/test/uriproc/test_uriproc.cxx index a7ad8d9abf94..34ac40b504de 100644 --- a/stoc/test/uriproc/test_uriproc.cxx +++ b/stoc/test/uriproc/test_uriproc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,6 +55,7 @@ #include "rtl/ustrbuf.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" +#include <sal/macros.h> #include <cstdlib> @@ -204,7 +206,7 @@ void Test::testParse() { "/", false, 1, "", "", "", "", "", 0, 0 }, { "////", 0, "////", true, "", "//", false, 2, "", "", "", "", "", 0, 0 } }; - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { css::uno::Reference< css::uri::XUriReference > uriRef( m_uriFactory->parse( rtl::OUString::createFromAscii(data[i].uriReference))); @@ -251,7 +253,7 @@ void Test::testParse() { data[i].pathSegmentCount, uriRef->getPathSegmentCount()); TEST_ASSERT_EQUAL( "testParse", i, data[i].uriReference, - rtl::OUString::createFromAscii(""), uriRef->getPathSegment(-1)); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")), uriRef->getPathSegment(-1)); TEST_ASSERT_EQUAL( "testParse", i, data[i].uriReference, rtl::OUString::createFromAscii(data[i].pathSegment0), @@ -274,7 +276,7 @@ void Test::testParse() { uriRef->getPathSegment(4)); TEST_ASSERT_EQUAL( "testParse", i, data[i].uriReference, - rtl::OUString::createFromAscii(""), uriRef->getPathSegment(5)); + rtl::OUString(), uriRef->getPathSegment(5)); TEST_ASSERT_EQUAL( "testParse", i, data[i].uriReference, data[i].query != 0, uriRef->hasQuery()); @@ -594,7 +596,7 @@ void Test::testMakeAbsolute() { css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a#s" }, { "scheme://a#s1", "#s2", true, css::uri::RelativeUriExcessParentSegments_ERROR, "scheme://a#s2" } }; - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { css::uno::Reference< css::uri::XUriReference > baseUriRef( m_uriFactory->parse( rtl::OUString::createFromAscii(data[i].baseUriReference))); @@ -699,7 +701,7 @@ void Test::testMakeRelative() { 0 }, { "scheme://auth/a/b", "scheme://auth/c/d", true, false, false, "../c/d", 0 } }; - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { css::uno::Reference< css::uri::XUriReference > baseUriRef( m_uriFactory->parse( rtl::OUString::createFromAscii(data[i].baseUriReference))); @@ -752,7 +754,7 @@ void Test::testVndSunStarExpand() { RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))), css::uno::UNO_QUERY_THROW); - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { css::uno::Reference< css::uri::XUriReference > uriRef( m_uriFactory->parse( rtl::OUString::createFromAscii(data[i].uriReference))); @@ -792,7 +794,7 @@ void Test::testVndSunStarScript() { { "vnd.sun.star.script:name?a=&", 0, true, {} }, { "vnd.sun.star.script:name?key1=&%26=%3D&key1=hello", "name", true, { { "key1", "" }, { "key2", 0 }, { "&", "=" } } } }; - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { css::uno::Reference< css::uri::XUriReference > uriRef( m_uriFactory->parse( rtl::OUString::createFromAscii(data[i].uriReference))); @@ -848,7 +850,7 @@ void Test::testVndSunStarScript() { "testVndSunStarScript", static_cast< double >(i) + static_cast< double >(j) / 10.0, - ::rtl::OUString::createFromAscii("setParameter"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setParameter")), originalReference, uriRef->getUriReference()); } @@ -860,7 +862,7 @@ void Test::testVndSunStarScript() { TEST_ASSERT_EQUAL( "testVndSunStarScript", i, - ::rtl::OUString::createFromAscii("setName"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setName")), originalReference, uriRef->getUriReference()); } @@ -902,8 +904,8 @@ void Test::testVndSunStarScript() { } TEST_ASSERT_EQUAL( "testVndSunStarScript", - ::rtl::OUString::createFromAscii("illegal arguments"), - ::rtl::OUString::createFromAscii("name"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("illegal arguments")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")), caughtExpected, true); @@ -911,15 +913,15 @@ void Test::testVndSunStarScript() { try { scriptUrl->setParameter( ::rtl::OUString(), - ::rtl::OUString::createFromAscii("non-empty")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("non-empty"))); } catch( const css::lang::IllegalArgumentException& ) { caughtExpected = true; } TEST_ASSERT_EQUAL( "testVndSunStarScript", - ::rtl::OUString::createFromAscii("illegal arguments"), - ::rtl::OUString::createFromAscii("parameter"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("illegal arguments")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("parameter")), caughtExpected, true); } @@ -949,7 +951,7 @@ void Test::testTranslator() { { "file:///abc/%25ef", "file:///abc/%25ef", true } }; css::uno::Reference< css::uri::XExternalUriReferenceTranslator > translator(css::uri::ExternalUriReferenceTranslator::create(m_context)); - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { if (data[i].toInternal) { TEST_ASSERT_EQUAL( "testTranslator, translateToInternal", i, @@ -980,7 +982,7 @@ void Test::testPkgUrlFactory() { "vnd.sun.star.pkg://file:%2F%2F%2Fa%2525b%252fc%2Fd~e&f@g%3Fh" } }; css::uno::Reference< css::uri::XVndSunStarPkgUrlReferenceFactory > factory( css::uri::VndSunStarPkgUrlReferenceFactory::create(m_context)); - for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { css::uno::Reference< css::uri::XUriReference > url( factory->createVndSunStarPkgUrlReference( m_uriFactory->parse( @@ -1002,3 +1004,5 @@ CPPUNIT_TEST_SUITE_REGISTRATION(Test); } CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |