1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_stoc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySet.hpp" 32*cdf0e10cSrcweir #include "com/sun/star/container/XHierarchicalNameAccess.hpp" 33*cdf0e10cSrcweir #include "com/sun/star/lang/XMain.hpp" 34*cdf0e10cSrcweir #include "com/sun/star/lang/XSingleComponentFactory.hpp" 35*cdf0e10cSrcweir #include "com/sun/star/reflection/XCompoundTypeDescription.hpp" 36*cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp" 37*cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp" 38*cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp" 39*cdf0e10cSrcweir #include "com/sun/star/reflection/XInterfaceTypeDescription2.hpp" 40*cdf0e10cSrcweir #include "com/sun/star/reflection/XPublished.hpp" 41*cdf0e10cSrcweir #include "com/sun/star/reflection/XServiceTypeDescription2.hpp" 42*cdf0e10cSrcweir #include "com/sun/star/reflection/XSingletonTypeDescription2.hpp" 43*cdf0e10cSrcweir #include "com/sun/star/reflection/XStructTypeDescription.hpp" 44*cdf0e10cSrcweir #include "com/sun/star/reflection/XTypeDescription.hpp" 45*cdf0e10cSrcweir #include "com/sun/star/registry/InvalidRegistryException.hpp" 46*cdf0e10cSrcweir #include "com/sun/star/registry/XRegistryKey.hpp" 47*cdf0e10cSrcweir #include "com/sun/star/uno/Any.hxx" 48*cdf0e10cSrcweir #include "com/sun/star/uno/Exception.hpp" 49*cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx" 50*cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp" 51*cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx" 52*cdf0e10cSrcweir #include "com/sun/star/uno/TypeClass.hpp" 53*cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp" 54*cdf0e10cSrcweir #include "com/sun/star/uno/XInterface.hpp" 55*cdf0e10cSrcweir #include "cppuhelper/factory.hxx" 56*cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx" 57*cdf0e10cSrcweir #include "cppuhelper/weak.hxx" 58*cdf0e10cSrcweir #include "rtl/textenc.h" 59*cdf0e10cSrcweir #include "rtl/ustring.h" 60*cdf0e10cSrcweir #include "rtl/ustring.hxx" 61*cdf0e10cSrcweir #include "sal/types.h" 62*cdf0e10cSrcweir #include "uno/environment.h" 63*cdf0e10cSrcweir #include "uno/lbnames.h" 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #include /*MSVC trouble: <cstdlib>*/ <stdlib.h> 66*cdf0e10cSrcweir #include <iostream> 67*cdf0e10cSrcweir #include <ostream> 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir namespace css = com::sun::star; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir namespace { 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir class Service: public cppu::WeakImplHelper1< css::lang::XMain > { 74*cdf0e10cSrcweir public: 75*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 76*cdf0e10cSrcweir run(css::uno::Sequence< rtl::OUString > const & arguments) 77*cdf0e10cSrcweir throw (css::uno::RuntimeException); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir static rtl::OUString getImplementationName(); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir static css::uno::Sequence< rtl::OUString > getSupportedServiceNames(); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir static css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( 84*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > const & context) 85*cdf0e10cSrcweir throw (css::uno::Exception); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir private: 88*cdf0e10cSrcweir explicit Service( 89*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > const & context): 90*cdf0e10cSrcweir m_context(context) 91*cdf0e10cSrcweir {} 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > m_context; 94*cdf0e10cSrcweir }; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir namespace { 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir std::ostream & operator <<(std::ostream & out, rtl::OUString const & value) { 101*cdf0e10cSrcweir return out << rtl::OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr(); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir void assertTrue(bool argument) { 105*cdf0e10cSrcweir if (!argument) { 106*cdf0e10cSrcweir std::cerr 107*cdf0e10cSrcweir << "assertTrue(" << argument << ") failed" << std::endl; 108*cdf0e10cSrcweir /*MSVC trouble: std::*/abort(); 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir void assertFalse(bool argument) { 113*cdf0e10cSrcweir if (argument) { 114*cdf0e10cSrcweir std::cerr 115*cdf0e10cSrcweir << "assertFalse(" << argument << ") failed" << std::endl; 116*cdf0e10cSrcweir /*MSVC trouble: std::*/abort(); 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir template< typename T > void assertEqual(T const & value, T const & argument) { 121*cdf0e10cSrcweir if (argument != value) { 122*cdf0e10cSrcweir std::cerr 123*cdf0e10cSrcweir << "assertEqual(" << value << ", " << argument << ") failed" 124*cdf0e10cSrcweir << std::endl; 125*cdf0e10cSrcweir /*MSVC trouble: std::*/abort(); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const &) 132*cdf0e10cSrcweir throw (css::uno::RuntimeException) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiComponentFactory > factory( 135*cdf0e10cSrcweir m_context->getServiceManager()); 136*cdf0e10cSrcweir assertTrue(factory.is()); 137*cdf0e10cSrcweir css::uno::Sequence< css::uno::Any > args(1); 138*cdf0e10cSrcweir args[0] = css::uno::Reference< css::beans::XPropertySet >( 139*cdf0e10cSrcweir factory, css::uno::UNO_QUERY_THROW)->getPropertyValue( 140*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Registry"))); 141*cdf0e10cSrcweir css::uno::Reference< css::container::XHierarchicalNameAccess > provider( 142*cdf0e10cSrcweir factory->createInstanceWithArgumentsAndContext( 143*cdf0e10cSrcweir rtl::OUString( 144*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 145*cdf0e10cSrcweir "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider")), 146*cdf0e10cSrcweir args, m_context), 147*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir // The following assumes that interface members are sorted by increasing 150*cdf0e10cSrcweir // values of XInterfaceMemberTypeDescription.getPosition, the exceptions 151*cdf0e10cSrcweir // of interface attributes and interface methods, the constructors of 152*cdf0e10cSrcweir // services, and the exceptions of service constructors are sorted as given 153*cdf0e10cSrcweir // in the UNOIDL source code: 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir assertEqual< bool >( 156*cdf0e10cSrcweir false, 157*cdf0e10cSrcweir provider->hasByHierarchicalName( 158*cdf0e10cSrcweir rtl::OUString( 159*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("[][]boolean")))); 160*cdf0e10cSrcweir assertEqual< bool >( 161*cdf0e10cSrcweir false, 162*cdf0e10cSrcweir provider->hasByHierarchicalName( 163*cdf0e10cSrcweir rtl::OUString( 164*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 165*cdf0e10cSrcweir "test.registrytdprovider.Struct3<boolean,boolean>")))); 166*cdf0e10cSrcweir assertEqual< bool >( 167*cdf0e10cSrcweir false, 168*cdf0e10cSrcweir provider->hasByHierarchicalName( 169*cdf0e10cSrcweir rtl::OUString( 170*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 171*cdf0e10cSrcweir "com.sun.star.uno.XComponentContext::getValueByName")))); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir css::uno::Reference< css::reflection::XCompoundTypeDescription > exception; 174*cdf0e10cSrcweir exception 175*cdf0e10cSrcweir = css::uno::Reference< css::reflection::XCompoundTypeDescription >( 176*cdf0e10cSrcweir provider->getByHierarchicalName( 177*cdf0e10cSrcweir rtl::OUString( 178*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception"))), 179*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 180*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_EXCEPTION, exception->getTypeClass()); 181*cdf0e10cSrcweir assertEqual( 182*cdf0e10cSrcweir rtl::OUString( 183*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")), 184*cdf0e10cSrcweir exception->getName()); 185*cdf0e10cSrcweir assertFalse(exception->getBaseType().is()); 186*cdf0e10cSrcweir exception 187*cdf0e10cSrcweir = css::uno::Reference< css::reflection::XCompoundTypeDescription >( 188*cdf0e10cSrcweir provider->getByHierarchicalName( 189*cdf0e10cSrcweir rtl::OUString( 190*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 191*cdf0e10cSrcweir "com.sun.star.uno.RuntimeException"))), 192*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 193*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_EXCEPTION, exception->getTypeClass()); 194*cdf0e10cSrcweir assertEqual( 195*cdf0e10cSrcweir rtl::OUString( 196*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")), 197*cdf0e10cSrcweir exception->getName()); 198*cdf0e10cSrcweir assertEqual( 199*cdf0e10cSrcweir rtl::OUString( 200*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")), 201*cdf0e10cSrcweir exception->getBaseType()->getName()); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir css::uno::Reference< css::reflection::XStructTypeDescription > structure; 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir structure = css::uno::Reference< css::reflection::XStructTypeDescription >( 206*cdf0e10cSrcweir provider->getByHierarchicalName( 207*cdf0e10cSrcweir rtl::OUString( 208*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 209*cdf0e10cSrcweir "test.registrytdprovider.Struct2"))), 210*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 211*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_STRUCT, structure->getTypeClass()); 212*cdf0e10cSrcweir assertEqual( 213*cdf0e10cSrcweir rtl::OUString( 214*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct2")), 215*cdf0e10cSrcweir structure->getName()); 216*cdf0e10cSrcweir assertFalse(structure->getBaseType().is()); 217*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, structure->getMemberTypes().getLength()); 218*cdf0e10cSrcweir assertEqual( 219*cdf0e10cSrcweir rtl::OUString( 220*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct1")), 221*cdf0e10cSrcweir structure->getMemberTypes()[0]->getName()); 222*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, structure->getMemberNames().getLength()); 223*cdf0e10cSrcweir assertEqual( 224*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s1")), 225*cdf0e10cSrcweir structure->getMemberNames()[0]); 226*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, structure->getTypeParameters().getLength()); 227*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength()); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir structure = css::uno::Reference< css::reflection::XStructTypeDescription >( 230*cdf0e10cSrcweir provider->getByHierarchicalName( 231*cdf0e10cSrcweir rtl::OUString( 232*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 233*cdf0e10cSrcweir "test.registrytdprovider.Struct3"))), 234*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 235*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_STRUCT, structure->getTypeClass()); 236*cdf0e10cSrcweir assertEqual( 237*cdf0e10cSrcweir rtl::OUString( 238*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct3")), 239*cdf0e10cSrcweir structure->getName()); 240*cdf0e10cSrcweir assertFalse(structure->getBaseType().is()); 241*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, structure->getMemberTypes().getLength()); 242*cdf0e10cSrcweir assertEqual( 243*cdf0e10cSrcweir css::uno::TypeClass_UNKNOWN, 244*cdf0e10cSrcweir structure->getMemberTypes()[0]->getTypeClass()); 245*cdf0e10cSrcweir assertEqual( 246*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("U")), 247*cdf0e10cSrcweir structure->getMemberTypes()[0]->getName()); 248*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, structure->getMemberNames().getLength()); 249*cdf0e10cSrcweir assertEqual( 250*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s2")), 251*cdf0e10cSrcweir structure->getMemberNames()[0]); 252*cdf0e10cSrcweir assertEqual< sal_Int32 >(2, structure->getTypeParameters().getLength()); 253*cdf0e10cSrcweir assertEqual( 254*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("T")), 255*cdf0e10cSrcweir structure->getTypeParameters()[0]); 256*cdf0e10cSrcweir assertEqual( 257*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("U")), 258*cdf0e10cSrcweir structure->getTypeParameters()[1]); 259*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength()); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir structure = css::uno::Reference< css::reflection::XStructTypeDescription >( 262*cdf0e10cSrcweir provider->getByHierarchicalName( 263*cdf0e10cSrcweir rtl::OUString( 264*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 265*cdf0e10cSrcweir "test.registrytdprovider.Struct4"))), 266*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 267*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_STRUCT, structure->getTypeClass()); 268*cdf0e10cSrcweir assertEqual( 269*cdf0e10cSrcweir rtl::OUString( 270*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct4")), 271*cdf0e10cSrcweir structure->getName()); 272*cdf0e10cSrcweir assertEqual( 273*cdf0e10cSrcweir rtl::OUString( 274*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Struct2")), 275*cdf0e10cSrcweir structure->getBaseType()->getName()); 276*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, structure->getMemberTypes().getLength()); 277*cdf0e10cSrcweir assertEqual( 278*cdf0e10cSrcweir rtl::OUString( 279*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 280*cdf0e10cSrcweir "test.registrytdprovider.Struct3<" 281*cdf0e10cSrcweir "test.registrytdprovider.Struct2," 282*cdf0e10cSrcweir "test.registrytdprovider.Struct3<boolean,any>>")), 283*cdf0e10cSrcweir structure->getMemberTypes()[0]->getName()); 284*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, structure->getMemberNames().getLength()); 285*cdf0e10cSrcweir assertEqual( 286*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s2")), 287*cdf0e10cSrcweir structure->getMemberNames()[0]); 288*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, structure->getTypeParameters().getLength()); 289*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, structure->getTypeArguments().getLength()); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > 292*cdf0e10cSrcweir interface; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir interface 295*cdf0e10cSrcweir = css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >( 296*cdf0e10cSrcweir provider->getByHierarchicalName( 297*cdf0e10cSrcweir rtl::OUString( 298*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 299*cdf0e10cSrcweir "test.registrytdprovider.XTest1"))), 300*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 301*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_INTERFACE, interface->getTypeClass()); 302*cdf0e10cSrcweir assertEqual( 303*cdf0e10cSrcweir rtl::OUString( 304*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")), 305*cdf0e10cSrcweir interface->getName()); 306*cdf0e10cSrcweir css::uno::Sequence< 307*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription > > bases( 308*cdf0e10cSrcweir interface->getBaseTypes()); 309*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, bases.getLength()); 310*cdf0e10cSrcweir assertEqual( 311*cdf0e10cSrcweir rtl::OUString( 312*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")), 313*cdf0e10cSrcweir bases[0]->getName()); 314*cdf0e10cSrcweir css::uno::Sequence< 315*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription > > 316*cdf0e10cSrcweir optionalBases(interface->getOptionalBaseTypes()); 317*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, optionalBases.getLength()); 318*cdf0e10cSrcweir assertEqual( 319*cdf0e10cSrcweir rtl::OUString( 320*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XBase")), 321*cdf0e10cSrcweir optionalBases[0]->getName()); 322*cdf0e10cSrcweir css::uno::Sequence< 323*cdf0e10cSrcweir css::uno::Reference< 324*cdf0e10cSrcweir css::reflection::XInterfaceMemberTypeDescription > > members( 325*cdf0e10cSrcweir interface->getMembers()); 326*cdf0e10cSrcweir assertEqual< sal_Int32 >(5, members.getLength()); 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir css::uno::Reference< css::reflection::XInterfaceAttributeTypeDescription2 > 329*cdf0e10cSrcweir attribute; 330*cdf0e10cSrcweir css::uno::Sequence< 331*cdf0e10cSrcweir css::uno::Reference< css::reflection::XCompoundTypeDescription > > 332*cdf0e10cSrcweir getExceptions; 333*cdf0e10cSrcweir css::uno::Sequence< 334*cdf0e10cSrcweir css::uno::Reference< css::reflection::XCompoundTypeDescription > > 335*cdf0e10cSrcweir setExceptions; 336*cdf0e10cSrcweir css::uno::Reference< css::reflection::XInterfaceMethodTypeDescription > 337*cdf0e10cSrcweir method; 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir attribute = css::uno::Reference< 340*cdf0e10cSrcweir css::reflection::XInterfaceAttributeTypeDescription2 >( 341*cdf0e10cSrcweir members[0], css::uno::UNO_QUERY_THROW); 342*cdf0e10cSrcweir assertEqual( 343*cdf0e10cSrcweir css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass()); 344*cdf0e10cSrcweir assertEqual( 345*cdf0e10cSrcweir rtl::OUString( 346*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::a1")), 347*cdf0e10cSrcweir attribute->getName()); 348*cdf0e10cSrcweir assertEqual( 349*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a1")), 350*cdf0e10cSrcweir attribute->getMemberName()); 351*cdf0e10cSrcweir assertEqual< sal_Int32 >(3, attribute->getPosition()); 352*cdf0e10cSrcweir assertEqual< bool >(false, attribute->isReadOnly()); 353*cdf0e10cSrcweir assertEqual( 354*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("short")), 355*cdf0e10cSrcweir attribute->getType()->getName()); 356*cdf0e10cSrcweir assertEqual< bool >(true, attribute->isBound()); 357*cdf0e10cSrcweir getExceptions = attribute->getGetExceptions(); 358*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, getExceptions.getLength()); 359*cdf0e10cSrcweir setExceptions = attribute->getSetExceptions(); 360*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, setExceptions.getLength()); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir attribute = css::uno::Reference< 363*cdf0e10cSrcweir css::reflection::XInterfaceAttributeTypeDescription2 >( 364*cdf0e10cSrcweir members[1], css::uno::UNO_QUERY_THROW); 365*cdf0e10cSrcweir assertEqual( 366*cdf0e10cSrcweir css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass()); 367*cdf0e10cSrcweir assertEqual( 368*cdf0e10cSrcweir rtl::OUString( 369*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::a2")), 370*cdf0e10cSrcweir attribute->getName()); 371*cdf0e10cSrcweir assertEqual( 372*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a2")), 373*cdf0e10cSrcweir attribute->getMemberName()); 374*cdf0e10cSrcweir assertEqual< sal_Int32 >(4, attribute->getPosition()); 375*cdf0e10cSrcweir assertEqual< bool >(false, attribute->isReadOnly()); 376*cdf0e10cSrcweir assertEqual( 377*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("long")), 378*cdf0e10cSrcweir attribute->getType()->getName()); 379*cdf0e10cSrcweir assertEqual< bool >(false, attribute->isBound()); 380*cdf0e10cSrcweir getExceptions = attribute->getGetExceptions(); 381*cdf0e10cSrcweir assertEqual< sal_Int32 >(2, getExceptions.getLength()); 382*cdf0e10cSrcweir assertEqual( 383*cdf0e10cSrcweir rtl::OUString( 384*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 385*cdf0e10cSrcweir "com.sun.star.lang.WrappedTargetException")), 386*cdf0e10cSrcweir getExceptions[0]->getName()); 387*cdf0e10cSrcweir assertEqual( 388*cdf0e10cSrcweir rtl::OUString( 389*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")), 390*cdf0e10cSrcweir getExceptions[1]->getName()); 391*cdf0e10cSrcweir setExceptions = attribute->getSetExceptions(); 392*cdf0e10cSrcweir assertEqual< sal_Int32 >(2, setExceptions.getLength()); 393*cdf0e10cSrcweir assertEqual( 394*cdf0e10cSrcweir rtl::OUString( 395*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")), 396*cdf0e10cSrcweir setExceptions[0]->getName()); 397*cdf0e10cSrcweir assertEqual( 398*cdf0e10cSrcweir rtl::OUString( 399*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 400*cdf0e10cSrcweir "com.sun.star.lang.WrappedTargetException")), 401*cdf0e10cSrcweir setExceptions[1]->getName()); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir attribute = css::uno::Reference< 404*cdf0e10cSrcweir css::reflection::XInterfaceAttributeTypeDescription2 >( 405*cdf0e10cSrcweir members[2], css::uno::UNO_QUERY_THROW); 406*cdf0e10cSrcweir assertEqual( 407*cdf0e10cSrcweir css::uno::TypeClass_INTERFACE_ATTRIBUTE, attribute->getTypeClass()); 408*cdf0e10cSrcweir assertEqual( 409*cdf0e10cSrcweir rtl::OUString( 410*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::a3")), 411*cdf0e10cSrcweir attribute->getName()); 412*cdf0e10cSrcweir assertEqual( 413*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a3")), 414*cdf0e10cSrcweir attribute->getMemberName()); 415*cdf0e10cSrcweir assertEqual< sal_Int32 >(5, attribute->getPosition()); 416*cdf0e10cSrcweir assertEqual< bool >(true, attribute->isReadOnly()); 417*cdf0e10cSrcweir assertEqual( 418*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hyper")), 419*cdf0e10cSrcweir attribute->getType()->getName()); 420*cdf0e10cSrcweir assertEqual< bool >(true, attribute->isBound()); 421*cdf0e10cSrcweir getExceptions = attribute->getGetExceptions(); 422*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, getExceptions.getLength()); 423*cdf0e10cSrcweir assertEqual( 424*cdf0e10cSrcweir rtl::OUString( 425*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 426*cdf0e10cSrcweir "com.sun.star.lang.WrappedTargetException")), 427*cdf0e10cSrcweir getExceptions[0]->getName()); 428*cdf0e10cSrcweir setExceptions = attribute->getSetExceptions(); 429*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, setExceptions.getLength()); 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir method = css::uno::Reference< 432*cdf0e10cSrcweir css::reflection::XInterfaceMethodTypeDescription >( 433*cdf0e10cSrcweir members[3], css::uno::UNO_QUERY_THROW); 434*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_INTERFACE_METHOD, method->getTypeClass()); 435*cdf0e10cSrcweir assertEqual( 436*cdf0e10cSrcweir rtl::OUString( 437*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::f1")), 438*cdf0e10cSrcweir method->getName()); 439*cdf0e10cSrcweir assertEqual( 440*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("f1")), 441*cdf0e10cSrcweir method->getMemberName()); 442*cdf0e10cSrcweir assertEqual< sal_Int32 >(6, method->getPosition()); 443*cdf0e10cSrcweir assertEqual< bool >(false, method->isOneway()); 444*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, method->getParameters().getLength()); 445*cdf0e10cSrcweir assertEqual( 446*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("p")), 447*cdf0e10cSrcweir method->getParameters()[0]->getName()); 448*cdf0e10cSrcweir assertEqual( 449*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), 450*cdf0e10cSrcweir method->getParameters()[0]->getType()->getName()); 451*cdf0e10cSrcweir assertEqual< bool >(false, method->getParameters()[0]->isIn()); 452*cdf0e10cSrcweir assertEqual< bool >(true, method->getParameters()[0]->isOut()); 453*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, method->getParameters()[0]->getPosition()); 454*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, method->getExceptions().getLength()); 455*cdf0e10cSrcweir assertEqual( 456*cdf0e10cSrcweir rtl::OUString( 457*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")), 458*cdf0e10cSrcweir method->getExceptions()[0]->getName()); 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir method = css::uno::Reference< 461*cdf0e10cSrcweir css::reflection::XInterfaceMethodTypeDescription >( 462*cdf0e10cSrcweir members[4], css::uno::UNO_QUERY_THROW); 463*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_INTERFACE_METHOD, method->getTypeClass()); 464*cdf0e10cSrcweir assertEqual( 465*cdf0e10cSrcweir rtl::OUString( 466*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1::f2")), 467*cdf0e10cSrcweir method->getName()); 468*cdf0e10cSrcweir assertEqual( 469*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("f2")), 470*cdf0e10cSrcweir method->getMemberName()); 471*cdf0e10cSrcweir assertEqual< sal_Int32 >(7, method->getPosition()); 472*cdf0e10cSrcweir assertEqual< bool >(true, method->isOneway()); 473*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, method->getParameters().getLength()); 474*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, method->getExceptions().getLength()); 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir interface 477*cdf0e10cSrcweir = css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >( 478*cdf0e10cSrcweir provider->getByHierarchicalName( 479*cdf0e10cSrcweir rtl::OUString( 480*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 481*cdf0e10cSrcweir "test.registrytdprovider.XTest2"))), 482*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 483*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_INTERFACE, interface->getTypeClass()); 484*cdf0e10cSrcweir assertEqual( 485*cdf0e10cSrcweir rtl::OUString( 486*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest2")), 487*cdf0e10cSrcweir interface->getName()); 488*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, interface->getBaseTypes().getLength()); 489*cdf0e10cSrcweir assertEqual( 490*cdf0e10cSrcweir rtl::OUString( 491*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Typedef2")), 492*cdf0e10cSrcweir interface->getBaseTypes()[0]->getName()); 493*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, interface->getOptionalBaseTypes().getLength()); 494*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, interface->getMembers().getLength()); 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir css::uno::Reference< css::reflection::XServiceTypeDescription2 > service; 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >( 499*cdf0e10cSrcweir provider->getByHierarchicalName( 500*cdf0e10cSrcweir rtl::OUString( 501*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 502*cdf0e10cSrcweir "test.registrytdprovider.Service1"))), 503*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 504*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_SERVICE, service->getTypeClass()); 505*cdf0e10cSrcweir assertEqual( 506*cdf0e10cSrcweir rtl::OUString( 507*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service1")), 508*cdf0e10cSrcweir service->getName()); 509*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getMandatoryServices().getLength()); 510*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getOptionalServices().getLength()); 511*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getMandatoryInterfaces().getLength()); 512*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getOptionalInterfaces().getLength()); 513*cdf0e10cSrcweir assertEqual< bool >(true, service->isSingleInterfaceBased()); 514*cdf0e10cSrcweir assertEqual( 515*cdf0e10cSrcweir rtl::OUString( 516*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")), 517*cdf0e10cSrcweir service->getInterface()->getName()); 518*cdf0e10cSrcweir assertEqual< sal_Int32 >(2, service->getConstructors().getLength()); 519*cdf0e10cSrcweir assertEqual( 520*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c1")), 521*cdf0e10cSrcweir service->getConstructors()[0]->getName()); 522*cdf0e10cSrcweir assertEqual< sal_Int32 >( 523*cdf0e10cSrcweir 0, service->getConstructors()[0]->getParameters().getLength()); 524*cdf0e10cSrcweir assertEqual< sal_Int32 >( 525*cdf0e10cSrcweir 0, service->getConstructors()[0]->getExceptions().getLength()); 526*cdf0e10cSrcweir assertEqual( 527*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c2")), 528*cdf0e10cSrcweir service->getConstructors()[1]->getName()); 529*cdf0e10cSrcweir assertEqual< sal_Int32 >( 530*cdf0e10cSrcweir 1, service->getConstructors()[1]->getParameters().getLength()); 531*cdf0e10cSrcweir assertEqual( 532*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("p")), 533*cdf0e10cSrcweir service->getConstructors()[1]->getParameters()[0]->getName()); 534*cdf0e10cSrcweir assertEqual( 535*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), 536*cdf0e10cSrcweir (service->getConstructors()[1]->getParameters()[0]->getType()-> 537*cdf0e10cSrcweir getName())); 538*cdf0e10cSrcweir assertEqual< bool >( 539*cdf0e10cSrcweir true, service->getConstructors()[1]->getParameters()[0]->isIn()); 540*cdf0e10cSrcweir assertEqual< bool >( 541*cdf0e10cSrcweir false, service->getConstructors()[1]->getParameters()[0]->isOut()); 542*cdf0e10cSrcweir assertEqual< sal_Int32 >( 543*cdf0e10cSrcweir 0, service->getConstructors()[1]->getParameters()[0]->getPosition()); 544*cdf0e10cSrcweir assertEqual< bool >( 545*cdf0e10cSrcweir true, 546*cdf0e10cSrcweir service->getConstructors()[1]->getParameters()[0]->isRestParameter()); 547*cdf0e10cSrcweir assertEqual< sal_Int32 >( 548*cdf0e10cSrcweir 1, service->getConstructors()[1]->getExceptions().getLength()); 549*cdf0e10cSrcweir assertEqual( 550*cdf0e10cSrcweir rtl::OUString( 551*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")), 552*cdf0e10cSrcweir service->getConstructors()[1]->getExceptions()[0]->getName()); 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >( 555*cdf0e10cSrcweir provider->getByHierarchicalName( 556*cdf0e10cSrcweir rtl::OUString( 557*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 558*cdf0e10cSrcweir "test.registrytdprovider.Service2"))), 559*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 560*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_SERVICE, service->getTypeClass()); 561*cdf0e10cSrcweir assertEqual( 562*cdf0e10cSrcweir rtl::OUString( 563*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service2")), 564*cdf0e10cSrcweir service->getName()); 565*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getMandatoryServices().getLength()); 566*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getOptionalServices().getLength()); 567*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, service->getMandatoryInterfaces().getLength()); 568*cdf0e10cSrcweir assertEqual( 569*cdf0e10cSrcweir rtl::OUString( 570*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")), 571*cdf0e10cSrcweir service->getMandatoryInterfaces()[0]->getName()); 572*cdf0e10cSrcweir assertEqual< sal_Int32 >(1, service->getOptionalInterfaces().getLength()); 573*cdf0e10cSrcweir assertEqual( 574*cdf0e10cSrcweir rtl::OUString( 575*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XBase")), 576*cdf0e10cSrcweir service->getOptionalInterfaces()[0]->getName()); 577*cdf0e10cSrcweir assertEqual< bool >(false, service->isSingleInterfaceBased()); 578*cdf0e10cSrcweir assertFalse(service->getInterface().is()); 579*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getConstructors().getLength()); 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir service = css::uno::Reference< css::reflection::XServiceTypeDescription2 >( 582*cdf0e10cSrcweir provider->getByHierarchicalName( 583*cdf0e10cSrcweir rtl::OUString( 584*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 585*cdf0e10cSrcweir "test.registrytdprovider.Service3"))), 586*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 587*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_SERVICE, service->getTypeClass()); 588*cdf0e10cSrcweir assertEqual( 589*cdf0e10cSrcweir rtl::OUString( 590*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service3")), 591*cdf0e10cSrcweir service->getName()); 592*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getMandatoryServices().getLength()); 593*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getOptionalServices().getLength()); 594*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getMandatoryInterfaces().getLength()); 595*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getOptionalInterfaces().getLength()); 596*cdf0e10cSrcweir assertEqual< bool >(true, service->isSingleInterfaceBased()); 597*cdf0e10cSrcweir assertEqual( 598*cdf0e10cSrcweir rtl::OUString( 599*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Typedef2")), 600*cdf0e10cSrcweir service->getInterface()->getName()); 601*cdf0e10cSrcweir assertEqual< sal_Int32 >(0, service->getConstructors().getLength()); 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir css::uno::Reference< css::reflection::XSingletonTypeDescription2 > 604*cdf0e10cSrcweir singleton; 605*cdf0e10cSrcweir 606*cdf0e10cSrcweir singleton = css::uno::Reference< 607*cdf0e10cSrcweir css::reflection::XSingletonTypeDescription2 >( 608*cdf0e10cSrcweir provider->getByHierarchicalName( 609*cdf0e10cSrcweir rtl::OUString( 610*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 611*cdf0e10cSrcweir "test.registrytdprovider.Singleton1"))), 612*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 613*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_SINGLETON, singleton->getTypeClass()); 614*cdf0e10cSrcweir assertEqual( 615*cdf0e10cSrcweir rtl::OUString( 616*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Singleton1")), 617*cdf0e10cSrcweir singleton->getName()); 618*cdf0e10cSrcweir assertFalse(singleton->getService().is()); 619*cdf0e10cSrcweir assertEqual< bool >(true, singleton->isInterfaceBased()); 620*cdf0e10cSrcweir assertEqual( 621*cdf0e10cSrcweir rtl::OUString( 622*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.XTest1")), 623*cdf0e10cSrcweir singleton->getInterface()->getName()); 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir singleton = css::uno::Reference< 626*cdf0e10cSrcweir css::reflection::XSingletonTypeDescription2 >( 627*cdf0e10cSrcweir provider->getByHierarchicalName( 628*cdf0e10cSrcweir rtl::OUString( 629*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 630*cdf0e10cSrcweir "test.registrytdprovider.Singleton2"))), 631*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 632*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_SINGLETON, singleton->getTypeClass()); 633*cdf0e10cSrcweir assertEqual( 634*cdf0e10cSrcweir rtl::OUString( 635*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Singleton2")), 636*cdf0e10cSrcweir singleton->getName()); 637*cdf0e10cSrcweir assertEqual( 638*cdf0e10cSrcweir rtl::OUString( 639*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Service1")), 640*cdf0e10cSrcweir singleton->getService()->getName()); 641*cdf0e10cSrcweir assertEqual< bool >(false, singleton->isInterfaceBased()); 642*cdf0e10cSrcweir assertFalse(singleton->getInterface().is()); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir singleton = css::uno::Reference< 645*cdf0e10cSrcweir css::reflection::XSingletonTypeDescription2 >( 646*cdf0e10cSrcweir provider->getByHierarchicalName( 647*cdf0e10cSrcweir rtl::OUString( 648*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 649*cdf0e10cSrcweir "test.registrytdprovider.Singleton3"))), 650*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 651*cdf0e10cSrcweir assertEqual(css::uno::TypeClass_SINGLETON, singleton->getTypeClass()); 652*cdf0e10cSrcweir assertEqual( 653*cdf0e10cSrcweir rtl::OUString( 654*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Singleton3")), 655*cdf0e10cSrcweir singleton->getName()); 656*cdf0e10cSrcweir assertFalse(singleton->getService().is()); 657*cdf0e10cSrcweir assertEqual< bool >(true, singleton->isInterfaceBased()); 658*cdf0e10cSrcweir assertEqual( 659*cdf0e10cSrcweir rtl::OUString( 660*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider.Typedef2")), 661*cdf0e10cSrcweir singleton->getInterface()->getName()); 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir css::uno::Reference< css::reflection::XPublished > published; 664*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 665*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 666*cdf0e10cSrcweir provider->getByHierarchicalName( 667*cdf0e10cSrcweir rtl::OUString( 668*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 669*cdf0e10cSrcweir "test.registrytdprovider.Enum1"))), 670*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 671*cdf0e10cSrcweir css::uno::UNO_QUERY); 672*cdf0e10cSrcweir assertTrue(published.is()); 673*cdf0e10cSrcweir assertTrue(published->isPublished()); 674*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 675*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 676*cdf0e10cSrcweir provider->getByHierarchicalName( 677*cdf0e10cSrcweir rtl::OUString( 678*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 679*cdf0e10cSrcweir "test.registrytdprovider.Enum2"))), 680*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 681*cdf0e10cSrcweir css::uno::UNO_QUERY); 682*cdf0e10cSrcweir assertTrue(published.is()); 683*cdf0e10cSrcweir assertFalse(published->isPublished()); 684*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 685*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 686*cdf0e10cSrcweir provider->getByHierarchicalName( 687*cdf0e10cSrcweir rtl::OUString( 688*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 689*cdf0e10cSrcweir "test.registrytdprovider.Struct1"))), 690*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 691*cdf0e10cSrcweir css::uno::UNO_QUERY); 692*cdf0e10cSrcweir assertTrue(published.is()); 693*cdf0e10cSrcweir assertTrue(published->isPublished()); 694*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 695*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 696*cdf0e10cSrcweir provider->getByHierarchicalName( 697*cdf0e10cSrcweir rtl::OUString( 698*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 699*cdf0e10cSrcweir "test.registrytdprovider.Struct2"))), 700*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 701*cdf0e10cSrcweir css::uno::UNO_QUERY); 702*cdf0e10cSrcweir assertTrue(published.is()); 703*cdf0e10cSrcweir assertFalse(published->isPublished()); 704*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 705*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 706*cdf0e10cSrcweir provider->getByHierarchicalName( 707*cdf0e10cSrcweir rtl::OUString( 708*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 709*cdf0e10cSrcweir "test.registrytdprovider.Struct3"))), 710*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 711*cdf0e10cSrcweir css::uno::UNO_QUERY); 712*cdf0e10cSrcweir assertTrue(published.is()); 713*cdf0e10cSrcweir assertTrue(published->isPublished()); 714*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 715*cdf0e10cSrcweir css::uno::Reference< css::reflection::XStructTypeDescription >( 716*cdf0e10cSrcweir provider->getByHierarchicalName( 717*cdf0e10cSrcweir rtl::OUString( 718*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 719*cdf0e10cSrcweir "test.registrytdprovider.Struct3"))), 720*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW)->getMemberTypes()[0], 721*cdf0e10cSrcweir css::uno::UNO_QUERY); 722*cdf0e10cSrcweir assertFalse(published.is()); 723*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 724*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 725*cdf0e10cSrcweir provider->getByHierarchicalName( 726*cdf0e10cSrcweir rtl::OUString( 727*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 728*cdf0e10cSrcweir "test.registrytdprovider.Struct3a"))), 729*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 730*cdf0e10cSrcweir css::uno::UNO_QUERY); 731*cdf0e10cSrcweir assertTrue(published.is()); 732*cdf0e10cSrcweir assertFalse(published->isPublished()); 733*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 734*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 735*cdf0e10cSrcweir provider->getByHierarchicalName( 736*cdf0e10cSrcweir rtl::OUString( 737*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 738*cdf0e10cSrcweir "test.registrytdprovider.Exception1"))), 739*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 740*cdf0e10cSrcweir css::uno::UNO_QUERY); 741*cdf0e10cSrcweir assertTrue(published.is()); 742*cdf0e10cSrcweir assertTrue(published->isPublished()); 743*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 744*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 745*cdf0e10cSrcweir provider->getByHierarchicalName( 746*cdf0e10cSrcweir rtl::OUString( 747*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 748*cdf0e10cSrcweir "test.registrytdprovider.Exception2"))), 749*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 750*cdf0e10cSrcweir css::uno::UNO_QUERY); 751*cdf0e10cSrcweir assertTrue(published.is()); 752*cdf0e10cSrcweir assertFalse(published->isPublished()); 753*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 754*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 755*cdf0e10cSrcweir provider->getByHierarchicalName( 756*cdf0e10cSrcweir rtl::OUString( 757*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 758*cdf0e10cSrcweir "test.registrytdprovider.XTest1"))), 759*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 760*cdf0e10cSrcweir css::uno::UNO_QUERY); 761*cdf0e10cSrcweir assertTrue(published.is()); 762*cdf0e10cSrcweir assertTrue(published->isPublished()); 763*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 764*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 765*cdf0e10cSrcweir provider->getByHierarchicalName( 766*cdf0e10cSrcweir rtl::OUString( 767*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 768*cdf0e10cSrcweir "test.registrytdprovider.XTest2"))), 769*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 770*cdf0e10cSrcweir css::uno::UNO_QUERY); 771*cdf0e10cSrcweir assertTrue(published.is()); 772*cdf0e10cSrcweir assertFalse(published->isPublished()); 773*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 774*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 775*cdf0e10cSrcweir provider->getByHierarchicalName( 776*cdf0e10cSrcweir rtl::OUString( 777*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 778*cdf0e10cSrcweir "test.registrytdprovider.Typedef1"))), 779*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 780*cdf0e10cSrcweir css::uno::UNO_QUERY); 781*cdf0e10cSrcweir assertTrue(published.is()); 782*cdf0e10cSrcweir assertTrue(published->isPublished()); 783*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 784*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 785*cdf0e10cSrcweir provider->getByHierarchicalName( 786*cdf0e10cSrcweir rtl::OUString( 787*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 788*cdf0e10cSrcweir "test.registrytdprovider.Typedef2"))), 789*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 790*cdf0e10cSrcweir css::uno::UNO_QUERY); 791*cdf0e10cSrcweir assertTrue(published.is()); 792*cdf0e10cSrcweir assertFalse(published->isPublished()); 793*cdf0e10cSrcweir //TODO: check constants test.registrytdprovider.Const1 (published), 794*cdf0e10cSrcweir // test.registrytdprovider.Const2 (unpublished), and 795*cdf0e10cSrcweir // test.registrytdprovider.Consts1.C (no XPublished), which are not 796*cdf0e10cSrcweir // accessible via provider->getByHierarchicalName (see #i31428) 797*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 798*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 799*cdf0e10cSrcweir provider->getByHierarchicalName( 800*cdf0e10cSrcweir rtl::OUString( 801*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 802*cdf0e10cSrcweir "test.registrytdprovider.Consts1"))), 803*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 804*cdf0e10cSrcweir css::uno::UNO_QUERY); 805*cdf0e10cSrcweir assertTrue(published.is()); 806*cdf0e10cSrcweir assertTrue(published->isPublished()); 807*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 808*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 809*cdf0e10cSrcweir provider->getByHierarchicalName( 810*cdf0e10cSrcweir rtl::OUString( 811*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 812*cdf0e10cSrcweir "test.registrytdprovider.Consts2"))), 813*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 814*cdf0e10cSrcweir css::uno::UNO_QUERY); 815*cdf0e10cSrcweir assertTrue(published.is()); 816*cdf0e10cSrcweir assertFalse(published->isPublished()); 817*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 818*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 819*cdf0e10cSrcweir provider->getByHierarchicalName( 820*cdf0e10cSrcweir rtl::OUString( 821*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("test.registrytdprovider"))), 822*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 823*cdf0e10cSrcweir css::uno::UNO_QUERY); 824*cdf0e10cSrcweir assertFalse(published.is()); 825*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 826*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 827*cdf0e10cSrcweir provider->getByHierarchicalName( 828*cdf0e10cSrcweir rtl::OUString( 829*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 830*cdf0e10cSrcweir "test.registrytdprovider.Service1"))), 831*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 832*cdf0e10cSrcweir css::uno::UNO_QUERY); 833*cdf0e10cSrcweir assertTrue(published.is()); 834*cdf0e10cSrcweir assertTrue(published->isPublished()); 835*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 836*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 837*cdf0e10cSrcweir provider->getByHierarchicalName( 838*cdf0e10cSrcweir rtl::OUString( 839*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 840*cdf0e10cSrcweir "test.registrytdprovider.Service2"))), 841*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 842*cdf0e10cSrcweir css::uno::UNO_QUERY); 843*cdf0e10cSrcweir assertTrue(published.is()); 844*cdf0e10cSrcweir assertFalse(published->isPublished()); 845*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 846*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 847*cdf0e10cSrcweir provider->getByHierarchicalName( 848*cdf0e10cSrcweir rtl::OUString( 849*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 850*cdf0e10cSrcweir "test.registrytdprovider.Singleton2"))), 851*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 852*cdf0e10cSrcweir css::uno::UNO_QUERY); 853*cdf0e10cSrcweir assertTrue(published.is()); 854*cdf0e10cSrcweir assertTrue(published->isPublished()); 855*cdf0e10cSrcweir published = css::uno::Reference< css::reflection::XPublished >( 856*cdf0e10cSrcweir css::uno::Reference< css::reflection::XTypeDescription >( 857*cdf0e10cSrcweir provider->getByHierarchicalName( 858*cdf0e10cSrcweir rtl::OUString( 859*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 860*cdf0e10cSrcweir "test.registrytdprovider.Singleton1"))), 861*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW), 862*cdf0e10cSrcweir css::uno::UNO_QUERY); 863*cdf0e10cSrcweir assertTrue(published.is()); 864*cdf0e10cSrcweir assertFalse(published->isPublished()); 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir return 0; 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir rtl::OUString Service::getImplementationName() { 870*cdf0e10cSrcweir return rtl::OUString::createFromAscii("test.registrytdprovider.impl"); 871*cdf0e10cSrcweir } 872*cdf0e10cSrcweir 873*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames() { 874*cdf0e10cSrcweir return css::uno::Sequence< rtl::OUString >(); 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > Service::createInstance( 878*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > const & context) 879*cdf0e10cSrcweir throw (css::uno::Exception) 880*cdf0e10cSrcweir { 881*cdf0e10cSrcweir return static_cast< cppu::OWeakObject * >(new Service(context)); 882*cdf0e10cSrcweir } 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir extern "C" void SAL_CALL component_getImplementationEnvironment( 885*cdf0e10cSrcweir char const ** envTypeName, uno_Environment **) 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir if (envTypeName != 0) { 888*cdf0e10cSrcweir *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir } 891*cdf0e10cSrcweir 892*cdf0e10cSrcweir extern "C" void * SAL_CALL component_getFactory(char const * implName, 893*cdf0e10cSrcweir void * serviceManager, void *) { 894*cdf0e10cSrcweir void * p = 0; 895*cdf0e10cSrcweir if (serviceManager != 0) { 896*cdf0e10cSrcweir css::uno::Reference< css::lang::XSingleComponentFactory > f; 897*cdf0e10cSrcweir if (Service::getImplementationName().equalsAscii(implName)) { 898*cdf0e10cSrcweir f = cppu::createSingleComponentFactory( 899*cdf0e10cSrcweir &Service::createInstance, Service::getImplementationName(), 900*cdf0e10cSrcweir Service::getSupportedServiceNames()); 901*cdf0e10cSrcweir } 902*cdf0e10cSrcweir if (f.is()) { 903*cdf0e10cSrcweir f->acquire(); 904*cdf0e10cSrcweir p = f.get(); 905*cdf0e10cSrcweir } 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir return p; 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir namespace { 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir bool writeInfo(void * registryKey, rtl::OUString const & implementationName, 913*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > const & serviceNames) { 914*cdf0e10cSrcweir rtl::OUString keyName(rtl::OUString::createFromAscii("/")); 915*cdf0e10cSrcweir keyName += implementationName; 916*cdf0e10cSrcweir keyName += rtl::OUString::createFromAscii("/UNO/SERVICES"); 917*cdf0e10cSrcweir css::uno::Reference< css::registry::XRegistryKey > key; 918*cdf0e10cSrcweir try { 919*cdf0e10cSrcweir key = static_cast< css::registry::XRegistryKey * >(registryKey)-> 920*cdf0e10cSrcweir createKey(keyName); 921*cdf0e10cSrcweir } catch (css::registry::InvalidRegistryException &) {} 922*cdf0e10cSrcweir if (!key.is()) { 923*cdf0e10cSrcweir return false; 924*cdf0e10cSrcweir } 925*cdf0e10cSrcweir bool success = true; 926*cdf0e10cSrcweir for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) { 927*cdf0e10cSrcweir try { 928*cdf0e10cSrcweir key->createKey(serviceNames[i]); 929*cdf0e10cSrcweir } catch (css::registry::InvalidRegistryException &) { 930*cdf0e10cSrcweir success = false; 931*cdf0e10cSrcweir break; 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir } 934*cdf0e10cSrcweir return success; 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * registryKey) { 940*cdf0e10cSrcweir return registryKey 941*cdf0e10cSrcweir && writeInfo(registryKey, Service::getImplementationName(), 942*cdf0e10cSrcweir Service::getSupportedServiceNames()); 943*cdf0e10cSrcweir } 944