From da40cdd0e8a2a4ce2b3636f39c91b7129f1a6ed4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 19 Aug 2013 16:27:13 +0200 Subject: Remove com.sun.star.comp.stoc.RegistryTypeDescriptionProvider ...which had become unused with the new cppuhelper/source/typemanager.cxx. Change-Id: Ic84d11cc9ecd1e7d73aa2757c14ffd46fa21e890 --- stoc/Library_bootstrap.mk | 15 - stoc/inc/bootstrapservices.hxx | 7 - stoc/source/bootstrap/services.cxx | 6 - stoc/source/registry_tdprovider/base.hxx | 618 --------------------- .../registry_tdprovider/functiondescription.cxx | 103 ---- .../registry_tdprovider/functiondescription.hxx | 80 --- .../registry_tdprovider/methoddescription.cxx | 133 ----- .../registry_tdprovider/methoddescription.hxx | 76 --- .../registry_tdprovider/rdbtdp_tdenumeration.cxx | 615 -------------------- .../registry_tdprovider/rdbtdp_tdenumeration.hxx | 109 ---- .../registry_tdprovider/structtypedescription.cxx | 129 ----- .../registry_tdprovider/structtypedescription.hxx | 98 ---- stoc/source/registry_tdprovider/td.cxx | 67 --- stoc/source/registry_tdprovider/tdcomp.cxx | 177 ------ stoc/source/registry_tdprovider/tdconsts.cxx | 100 ---- stoc/source/registry_tdprovider/tdef.cxx | 70 --- stoc/source/registry_tdprovider/tdenum.cxx | 125 ----- stoc/source/registry_tdprovider/tdiface.cxx | 565 ------------------- stoc/source/registry_tdprovider/tdmodule.cxx | 115 ---- stoc/source/registry_tdprovider/tdprop.cxx | 57 -- stoc/source/registry_tdprovider/tdprovider.cxx | 605 -------------------- stoc/source/registry_tdprovider/tdservice.cxx | 513 ----------------- stoc/source/registry_tdprovider/tdsingleton.cxx | 119 ---- stoc/util/bootstrap.component | 2 - 24 files changed, 4504 deletions(-) delete mode 100644 stoc/source/registry_tdprovider/base.hxx delete mode 100644 stoc/source/registry_tdprovider/functiondescription.cxx delete mode 100644 stoc/source/registry_tdprovider/functiondescription.hxx delete mode 100644 stoc/source/registry_tdprovider/methoddescription.cxx delete mode 100644 stoc/source/registry_tdprovider/methoddescription.hxx delete mode 100644 stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx delete mode 100644 stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx delete mode 100644 stoc/source/registry_tdprovider/structtypedescription.cxx delete mode 100644 stoc/source/registry_tdprovider/structtypedescription.hxx delete mode 100644 stoc/source/registry_tdprovider/td.cxx delete mode 100644 stoc/source/registry_tdprovider/tdcomp.cxx delete mode 100644 stoc/source/registry_tdprovider/tdconsts.cxx delete mode 100644 stoc/source/registry_tdprovider/tdef.cxx delete mode 100644 stoc/source/registry_tdprovider/tdenum.cxx delete mode 100644 stoc/source/registry_tdprovider/tdiface.cxx delete mode 100644 stoc/source/registry_tdprovider/tdmodule.cxx delete mode 100644 stoc/source/registry_tdprovider/tdprop.cxx delete mode 100644 stoc/source/registry_tdprovider/tdprovider.cxx delete mode 100644 stoc/source/registry_tdprovider/tdservice.cxx delete mode 100644 stoc/source/registry_tdprovider/tdsingleton.cxx (limited to 'stoc') diff --git a/stoc/Library_bootstrap.mk b/stoc/Library_bootstrap.mk index 7615a5c2026e..a636917dfcb1 100644 --- a/stoc/Library_bootstrap.mk +++ b/stoc/Library_bootstrap.mk @@ -47,21 +47,6 @@ $(eval $(call gb_Library_add_exception_objects,bootstrap,\ stoc/source/implementationregistration/implreg \ stoc/source/implementationregistration/mergekeys \ stoc/source/loader/dllcomponentloader \ - stoc/source/registry_tdprovider/functiondescription \ - stoc/source/registry_tdprovider/methoddescription \ - stoc/source/registry_tdprovider/rdbtdp_tdenumeration \ - stoc/source/registry_tdprovider/structtypedescription \ - stoc/source/registry_tdprovider/td \ - stoc/source/registry_tdprovider/tdcomp \ - stoc/source/registry_tdprovider/tdconsts \ - stoc/source/registry_tdprovider/tdef \ - stoc/source/registry_tdprovider/tdenum \ - stoc/source/registry_tdprovider/tdiface \ - stoc/source/registry_tdprovider/tdmodule \ - stoc/source/registry_tdprovider/tdprop \ - stoc/source/registry_tdprovider/tdprovider \ - stoc/source/registry_tdprovider/tdservice \ - stoc/source/registry_tdprovider/tdsingleton \ stoc/source/security/access_controller \ stoc/source/security/file_policy \ stoc/source/security/permissions \ diff --git a/stoc/inc/bootstrapservices.hxx b/stoc/inc/bootstrapservices.hxx index a754d13a543c..43a10bab02ca 100644 --- a/stoc/inc/bootstrapservices.hxx +++ b/stoc/inc/bootstrapservices.hxx @@ -84,13 +84,6 @@ namespace stoc_bootstrap throw(::com::sun::star::uno::Exception); ::com::sun::star::uno::Sequence< OUString > loader_getSupportedServiceNames(); OUString loader_getImplementationName(); - - //registry_tdprovider - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ProviderImpl_create( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ) - throw(::com::sun::star::uno::Exception); - ::com::sun::star::uno::Sequence< OUString > rdbtdp_getSupportedServiceNames(); - OUString rdbtdp_getImplementationName(); } // namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx index b35295facc7a..e1295cb09f4d 100644 --- a/stoc/source/bootstrap/services.cxx +++ b/stoc/source/bootstrap/services.cxx @@ -88,12 +88,6 @@ static struct ImplementationEntry g_entries[] = loader_getSupportedServiceNames, createSingleComponentFactory, 0, 0 }, - //registry_tdprovider - { - ProviderImpl_create, rdbtdp_getImplementationName, - rdbtdp_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, //end { 0, 0, 0, 0, 0, 0 } }; diff --git a/stoc/source/registry_tdprovider/base.hxx b/stoc/source/registry_tdprovider/base.hxx deleted file mode 100644 index a4328b7fe6a0..000000000000 --- a/stoc/source/registry_tdprovider/base.hxx +++ /dev/null @@ -1,618 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _STOC_RDBTDP_BASE_HXX -#define _STOC_RDBTDP_BASE_HXX - -#include -#include -#include -#include -#include -#include - -#include "registry/refltype.hxx" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace osl; -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::container; -using namespace com::sun::star::reflection; - -//-------------------------------------------------------------------------------------------------- - -namespace stoc_rdbtdp -{ - -com::sun::star::uno::Reference< XTypeDescription > resolveTypedefs( - com::sun::star::uno::Reference< XTypeDescription > const & type); - - -::osl::Mutex & getMutex(); - -//-------------------------------------------------------------------------------------------------- - -typedef ::std::list< ::com::sun::star::uno::Reference< - ::com::sun::star::registry::XRegistryKey > > RegistryKeyList; - -//-------------------------------------------------------------------------------------------------- - -class RegistryKeyCloser -{ -public: - RegistryKeyCloser( const ::com::sun::star::uno::Reference< - ::com::sun::star::registry::XRegistryKey > & xKey ) - : m_xKey( xKey ) {} - ~RegistryKeyCloser() - { if ( m_xKey.is() ) { try { if ( m_xKey->isValid() ) m_xKey->closeKey(); } catch (...) {} } } - - void reset() { m_xKey.clear(); } -private: - ::com::sun::star::uno::Reference< - ::com::sun::star::registry::XRegistryKey > m_xKey; -}; - -//-------------------------------------------------------------------------------------------------- - -// helper to create XTypeDescription instances using typereg::Reader -// (used from Type Provider and Type Description Enumeration implementation) -::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XTypeDescription > -createTypeDescription( - const ::com::sun::star::uno::Sequence< sal_Int8 > & rData, - const ::com::sun::star::uno::Reference< - ::com::sun::star::container::XHierarchicalNameAccess > & xNameAccess, - bool bReturnEmptyRefForUnknownType ); - - -//-------------------------------------------------------------------------------------------------- -inline sal_Int32 getRTValueAsInt32( const RTConstValue & rVal ) -{ - switch (rVal.m_type) - { - case RT_TYPE_BYTE: - return rVal.m_value.aByte; - case RT_TYPE_INT16: - return rVal.m_value.aShort; - case RT_TYPE_UINT16: - return rVal.m_value.aUShort; - case RT_TYPE_INT32: - return rVal.m_value.aLong; - case RT_TYPE_UINT32: - return rVal.m_value.aULong; - default: - OSL_FAIL( "### unexpected value type!" ); - return 0; - } -} -//-------------------------------------------------------------------------------------------------- -inline Any getRTValue( const RTConstValue & rVal ) -{ - switch (rVal.m_type) - { - case RT_TYPE_BOOL: - return Any( &rVal.m_value.aBool, ::getCppuBooleanType() ); - case RT_TYPE_BYTE: - return Any( &rVal.m_value.aByte, ::getCppuType( (const sal_Int8 *)0 ) ); - case RT_TYPE_INT16: - return Any( &rVal.m_value.aShort, ::getCppuType( (const sal_Int16 *)0 ) ); - case RT_TYPE_UINT16: - return Any( &rVal.m_value.aUShort, ::getCppuType( (const sal_uInt16 *)0 ) ); - case RT_TYPE_INT32: - return Any( &rVal.m_value.aLong, ::getCppuType( (const sal_Int32 *)0 ) ); - case RT_TYPE_UINT32: - return Any( &rVal.m_value.aULong, ::getCppuType( (const sal_uInt32 *)0 ) ); - case RT_TYPE_INT64: - return Any( &rVal.m_value.aHyper, ::getCppuType( (const sal_Int64 *)0 ) ); - case RT_TYPE_UINT64: - return Any( &rVal.m_value.aUHyper, ::getCppuType( (const sal_uInt64 *)0 ) ); - case RT_TYPE_FLOAT: - return Any( &rVal.m_value.aFloat, ::getCppuType( (const float *)0 ) ); - case RT_TYPE_DOUBLE: - return Any( &rVal.m_value.aDouble, ::getCppuType( (const double *)0 ) ); - case RT_TYPE_STRING: - { - OUString aStr( rVal.m_value.aString ); - return Any( &aStr, ::getCppuType( (const OUString *)0 ) ); - } - default: - OSL_FAIL( "### unexpected RTValue!" ); - return Any(); - } -} - -//================================================================================================== -class TypeDescriptionImpl : public WeakImplHelper1< XTypeDescription > -{ - TypeClass _eTypeClass; - OUString _aName; - -public: - TypeDescriptionImpl( TypeClass eTypeClass, const OUString & rName ) - : _eTypeClass( eTypeClass ) - , _aName( rName ) - {} - virtual ~TypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); -}; - -//================================================================================================== -class InterfaceTypeDescriptionImpl: - public WeakImplHelper2< XInterfaceTypeDescription2, XPublished > -{ - com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr; - Sequence< sal_Int8 > _aBytes; - - OUString _aName; - - Sequence< OUString > _aBaseTypes; - Sequence< com::sun::star::uno::Reference< XTypeDescription > > _xBaseTDs; - Sequence< OUString > _aOptionalBaseTypes; - Sequence< com::sun::star::uno::Reference< XTypeDescription > > - _xOptionalBaseTDs; - - sal_Int32 _nBaseOffset; - Sequence< - com::sun::star::uno::Reference< XInterfaceMemberTypeDescription > > - _members; - bool _membersInit; - - bool _published; - - void checkInterfaceType( - com::sun::star::uno::Reference< XTypeDescription > const & type); - -public: - InterfaceTypeDescriptionImpl( - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & - xTDMgr, - const OUString & rName, const Sequence< OUString > & rBaseTypes, - const Sequence< OUString > & rOptionalBaseTypes, - const Sequence< sal_Int8 > & rBytes, bool published ); - virtual ~InterfaceTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XInterfaceTypeDescription2 - virtual Uik SAL_CALL getUik() throw(::com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL - getBaseType() throw(::com::sun::star::uno::RuntimeException); - virtual - Sequence< - com::sun::star::uno::Reference< XInterfaceMemberTypeDescription > > - SAL_CALL getMembers() throw(::com::sun::star::uno::RuntimeException); - - virtual Sequence< com::sun::star::uno::Reference< XTypeDescription > > - SAL_CALL getBaseTypes() throw (RuntimeException); - - virtual Sequence< com::sun::star::uno::Reference< XTypeDescription > > - SAL_CALL getOptionalBaseTypes() throw (RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } -}; - -//================================================================================================== -class CompoundTypeDescriptionImpl: - public WeakImplHelper2< XCompoundTypeDescription, XPublished > -{ - com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr; - TypeClass _eTypeClass; - Sequence< sal_Int8 > _aBytes; - OUString _aName; - - OUString _aBaseType; - com::sun::star::uno::Reference< XTypeDescription > _xBaseTD; - - Sequence< com::sun::star::uno::Reference< XTypeDescription > > * _pMembers; - Sequence< OUString > * _pMemberNames; - - bool _published; - -public: - CompoundTypeDescriptionImpl( - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & - xTDMgr, - TypeClass eTypeClass, - const OUString & rName, const OUString & rBaseName, - const Sequence< sal_Int8 > & rBytes, - bool published ) - : _xTDMgr( xTDMgr ) - , _eTypeClass( eTypeClass ) - , _aBytes( rBytes ) - , _aName( rName ) - , _aBaseType( rBaseName ) - , _pMembers( 0 ) - , _pMemberNames( 0 ) - , _published( published ) - {} - virtual ~CompoundTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XCompoundTypeDescription - virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL - getBaseType() throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< com::sun::star::uno::Reference< XTypeDescription > > - SAL_CALL getMemberTypes() throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< OUString > SAL_CALL getMemberNames() throw(::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } -}; - -//================================================================================================== -class EnumTypeDescriptionImpl: - public WeakImplHelper2< XEnumTypeDescription, XPublished > -{ - com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr; - Sequence< sal_Int8 > _aBytes; - - OUString _aName; - sal_Int32 _nDefaultValue; - - Sequence< OUString > * _pEnumNames; - Sequence< sal_Int32 > * _pEnumValues; - - bool _published; - -public: - EnumTypeDescriptionImpl( - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & - xTDMgr, - const OUString & rName, sal_Int32 nDefaultValue, - const Sequence< sal_Int8 > & rBytes, bool published ) - : _xTDMgr( xTDMgr ) - , _aBytes( rBytes ) - , _aName( rName ) - , _nDefaultValue( nDefaultValue ) - , _pEnumNames( 0 ) - , _pEnumValues( 0 ) - , _published( published ) - {} - virtual ~EnumTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XEnumTypeDescription - virtual sal_Int32 SAL_CALL getDefaultEnumValue() throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< OUString > SAL_CALL getEnumNames() throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< sal_Int32 > SAL_CALL getEnumValues() throw(::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } -}; - -//================================================================================================== -class TypedefTypeDescriptionImpl: - public WeakImplHelper2< XIndirectTypeDescription, XPublished > -{ - com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr; - OUString _aName; - - OUString _aRefName; - com::sun::star::uno::Reference< XTypeDescription > _xRefTD; - - bool _published; - -public: - TypedefTypeDescriptionImpl( - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & - xTDMgr, - const OUString & rName, const OUString & rRefName, bool published ) - : _xTDMgr( xTDMgr ) - , _aName( rName ) - , _aRefName( rRefName ) - , _published( published ) - {} - virtual ~TypedefTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XIndirectTypeDescription - virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL - getReferencedType() throw(::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } -}; - -//================================================================================================== -class ServiceTypeDescriptionImpl: - public WeakImplHelper2< XServiceTypeDescription2, XPublished > -{ - OUString _aName; - Sequence< sal_Int8 > _aBytes; - com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr; - bool _bInitReferences; - - com::sun::star::uno::Reference< XTypeDescription > _xInterfaceTD; - std::auto_ptr< - Sequence< - com::sun::star::uno::Reference< XServiceConstructorDescription > > > - _pCtors; - Sequence< com::sun::star::uno::Reference< XServiceTypeDescription > > - _aMandatoryServices; - Sequence< com::sun::star::uno::Reference< XServiceTypeDescription > > - _aOptionalServices; - Sequence< com::sun::star::uno::Reference< XInterfaceTypeDescription > > - _aMandatoryInterfaces; - Sequence< com::sun::star::uno::Reference< XInterfaceTypeDescription > > - _aOptionalInterfaces; - std::auto_ptr< - Sequence< com::sun::star::uno::Reference< XPropertyTypeDescription > > > - _pProps; - - bool _published; - -public: - ServiceTypeDescriptionImpl( - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & - xTDMgr, - const OUString & rName, const Sequence< sal_Int8 > & rBytes, - bool published) - : _aName( rName ), _aBytes( rBytes ), _xTDMgr( xTDMgr ), - _bInitReferences( false ), _published( published ) - {} - virtual ~ServiceTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL - getTypeClass() - throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL - getName() - throw(::com::sun::star::uno::RuntimeException); - - // XServiceTypeDescription - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XServiceTypeDescription > > SAL_CALL - getMandatoryServices() - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XServiceTypeDescription > > SAL_CALL - getOptionalServices() - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XInterfaceTypeDescription > > SAL_CALL - getMandatoryInterfaces() - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XInterfaceTypeDescription > > SAL_CALL - getOptionalInterfaces() - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XPropertyTypeDescription > > SAL_CALL - getProperties() - throw (::com::sun::star::uno::RuntimeException); - - // XServiceTypeDescription2 - virtual sal_Bool SAL_CALL isSingleInterfaceBased() - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< XTypeDescription > SAL_CALL - getInterface() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XServiceConstructorDescription > > - SAL_CALL getConstructors() - throw (::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } - -private: - void getReferences() - throw (::com::sun::star::uno::RuntimeException); -}; - -//================================================================================================== -class ModuleTypeDescriptionImpl : public WeakImplHelper1< XModuleTypeDescription > -{ - OUString _aName; - com::sun::star::uno::Reference< XTypeDescriptionEnumerationAccess > _xTDMgr; - - Sequence< com::sun::star::uno::Reference< XTypeDescription > > * _pMembers; - -public: - ModuleTypeDescriptionImpl( - const com::sun::star::uno::Reference< - XTypeDescriptionEnumerationAccess > & xTDMgr, - const OUString & rName ) - : _aName( rName ), _xTDMgr( xTDMgr ), _pMembers( 0 ) - {} - virtual ~ModuleTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL - getTypeClass() - throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString SAL_CALL - getName() - throw( ::com::sun::star::uno::RuntimeException ); - - // XModuleTypeDescription - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XTypeDescription > > SAL_CALL - getMembers() - throw ( ::com::sun::star::uno::RuntimeException ); -}; - -//================================================================================================== -class ConstantTypeDescriptionImpl : public WeakImplHelper1< XConstantTypeDescription > -{ - OUString _aName; - Any _aValue; - -public: - ConstantTypeDescriptionImpl( const OUString & rName, - const Any & rValue ) - : _aName( rName ), _aValue( rValue ) - {} - virtual ~ConstantTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL - getTypeClass() - throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString SAL_CALL - getName() - throw( ::com::sun::star::uno::RuntimeException ); - - // XConstantTypeDescription - virtual ::com::sun::star::uno::Any SAL_CALL - getConstantValue() - throw ( ::com::sun::star::uno::RuntimeException ); -}; - -//================================================================================================== -class ConstantsTypeDescriptionImpl: - public WeakImplHelper2< XConstantsTypeDescription, XPublished > -{ - OUString _aName; - Sequence< sal_Int8 > _aBytes; - Sequence< com::sun::star::uno::Reference< XConstantTypeDescription > > * - _pMembers; - - bool _published; - -public: - ConstantsTypeDescriptionImpl( const OUString & rName, - const Sequence< sal_Int8 > & rBytes, - bool published ) - : _aName( rName ), _aBytes( rBytes), _pMembers( 0 ), _published( published ) - {} - virtual ~ConstantsTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL - getTypeClass() - throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString SAL_CALL - getName() - throw( ::com::sun::star::uno::RuntimeException ); - - // XConstantsTypeDescription - virtual - Sequence< com::sun::star::uno::Reference< XConstantTypeDescription > > - SAL_CALL getConstants() throw ( RuntimeException ); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } -}; - -//================================================================================================== -class SingletonTypeDescriptionImpl: - public WeakImplHelper2< XSingletonTypeDescription2, XPublished > -{ - OUString _aName; - OUString _aBaseName; - com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr; - com::sun::star::uno::Reference< XTypeDescription > _xInterfaceTD; - com::sun::star::uno::Reference< XServiceTypeDescription > _xServiceTD; - - bool _published; - - void init(); - -public: - SingletonTypeDescriptionImpl( - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & - xTDMgr, - const OUString & rName, const OUString & rBaseName, bool published ) - : _aName( rName ), _aBaseName( rBaseName), _xTDMgr( xTDMgr ), - _published( published ) - {} - virtual ~SingletonTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL - getTypeClass() - throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString SAL_CALL - getName() - throw( ::com::sun::star::uno::RuntimeException ); - - // XSingletonTypeDescription - virtual com::sun::star::uno::Reference< XServiceTypeDescription > SAL_CALL - getService() throw ( ::com::sun::star::uno::RuntimeException ); - - // XSingletonTypeDescription2 - virtual sal_Bool SAL_CALL isInterfaceBased() - throw (::com::sun::star::uno::RuntimeException); - virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL - getInterface() throw (::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return _published; } -}; - -} - -#endif /* _STOC_RDBTDP_BASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/functiondescription.cxx b/stoc/source/registry_tdprovider/functiondescription.cxx deleted file mode 100644 index bbdb3aa51568..000000000000 --- a/stoc/source/registry_tdprovider/functiondescription.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "functiondescription.hxx" - -#include "com/sun/star/container/NoSuchElementException.hpp" -#include "com/sun/star/container/XHierarchicalNameAccess.hpp" -#include "com/sun/star/reflection/XCompoundTypeDescription.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/TypeClass.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/implbase1.hxx" -#include "osl/diagnose.h" -#include "osl/mutex.hxx" -#include "registry/reader.hxx" -#include "registry/version.h" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -using stoc::registry_tdprovider::FunctionDescription; - -FunctionDescription::FunctionDescription( - css::uno::Reference< css::container::XHierarchicalNameAccess > const & - manager, - com::sun::star::uno::Sequence< sal_Int8 > const & bytes, - sal_uInt16 index): - m_manager(manager), m_bytes(bytes), m_index(index), m_exceptionsInit(false) -{} - -FunctionDescription::~FunctionDescription() {} - -css::uno::Sequence< - css::uno::Reference< css::reflection::XCompoundTypeDescription > > -FunctionDescription::getExceptions() const { - { - osl::MutexGuard guard(m_mutex); - if (m_exceptionsInit) { - return m_exceptions; - } - } - typereg::Reader reader(getReader()); - sal_uInt16 n = reader.getMethodExceptionCount(m_index); - css::uno::Sequence< - css::uno::Reference< css::reflection::XCompoundTypeDescription > > - exceptions(n); - for (sal_uInt16 i = 0; i < n; ++i) { - OUString name( - reader.getMethodExceptionTypeName(m_index, i).replace('/', '.')); - css::uno::Any any; - try { - any = m_manager->getByHierarchicalName(name); - } catch (const css::container::NoSuchElementException & e) { - throw css::uno::RuntimeException( - (OUString( - "com.sun.star.container.NoSuchElementException: ") - + e.Message), - css::uno::Reference< css::uno::XInterface >()); //TODO - } - if (!(any >>= exceptions[i]) - || exceptions[i]->getTypeClass() != css::uno::TypeClass_EXCEPTION) - { - throw css::uno::RuntimeException( - (OUString("not an exception type: ") - + name), - css::uno::Reference< css::uno::XInterface >()); //TODO - } - OSL_ASSERT(exceptions[i].is()); - } - osl::MutexGuard guard(m_mutex); - if (!m_exceptionsInit) { - m_exceptions = exceptions; - m_exceptionsInit = true; - } - return m_exceptions; -} - -typereg::Reader FunctionDescription::getReader() const { - return typereg::Reader( - m_bytes.getConstArray(), m_bytes.getLength(), false, TYPEREG_VERSION_1); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/functiondescription.hxx b/stoc/source/registry_tdprovider/functiondescription.hxx deleted file mode 100644 index 3d59136768f1..000000000000 --- a/stoc/source/registry_tdprovider/functiondescription.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_stoc_source_registry_tdprovider_functiondescription_hxx -#define INCLUDED_stoc_source_registry_tdprovider_functiondescription_hxx - -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/Sequence.hxx" -#include "osl/mutex.hxx" -#include "sal/types.h" - -namespace com { namespace sun { namespace star { - namespace container { - class XHierarchicalNameAccess; - } - namespace reflection { - class XCompoundTypeDescription; - } -} } } -namespace typereg { class Reader; } - -namespace stoc { namespace registry_tdprovider { - -class FunctionDescription { -public: - FunctionDescription( - com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > const & - manager, - com::sun::star::uno::Sequence< sal_Int8 > const & bytes, - sal_uInt16 index); - - ~FunctionDescription(); - - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::reflection::XCompoundTypeDescription > > - getExceptions() const; - -protected: - typereg::Reader getReader() const; - - com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > m_manager; - com::sun::star::uno::Sequence< sal_Int8 > m_bytes; - sal_uInt16 m_index; - - mutable osl::Mutex m_mutex; - mutable com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::reflection::XCompoundTypeDescription > > - m_exceptions; - mutable bool m_exceptionsInit; - -private: - FunctionDescription(FunctionDescription &); // not implemented - void operator =(FunctionDescription); // not implemented -}; - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/methoddescription.cxx b/stoc/source/registry_tdprovider/methoddescription.cxx deleted file mode 100644 index 80e0cc507810..000000000000 --- a/stoc/source/registry_tdprovider/methoddescription.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "methoddescription.hxx" - -#include "com/sun/star/container/NoSuchElementException.hpp" -#include "com/sun/star/container/XHierarchicalNameAccess.hpp" -#include "com/sun/star/reflection/XParameter.hpp" -#include "com/sun/star/reflection/XTypeDescription.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/weak.hxx" -#include "osl/mutex.hxx" -#include "registry/reader.hxx" -#include "registry/types.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -using stoc::registry_tdprovider::MethodDescription; - -namespace { - -class Parameter: public cppu::WeakImplHelper1< css::reflection::XParameter > { -public: - Parameter( - css::uno::Reference< css::container::XHierarchicalNameAccess > const & - manager, - OUString const & name, OUString const & typeName, - RTParamMode mode, sal_Int32 position): - m_manager(manager), m_name(name), - m_typeName(typeName.replace('/', '.')), m_mode(mode), - m_position(position) {} - - virtual ~Parameter() {} - - virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException) - { return m_name; } - - virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL - getType() throw (css::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isIn() throw (css::uno::RuntimeException) - { return (m_mode & RT_PARAM_IN) != 0; } - - virtual sal_Bool SAL_CALL isOut() throw (css::uno::RuntimeException) - { return (m_mode & RT_PARAM_OUT) != 0; } - - virtual sal_Int32 SAL_CALL getPosition() throw (css::uno::RuntimeException) - { return m_position; } - - virtual sal_Bool SAL_CALL isRestParameter() - throw (css::uno::RuntimeException) - { return (m_mode & RT_PARAM_REST) != 0; } - -private: - Parameter(Parameter &); // not implemented - void operator =(Parameter); // not implemented - - css::uno::Reference< css::container::XHierarchicalNameAccess > m_manager; - OUString m_name; - OUString m_typeName; - RTParamMode m_mode; - sal_Int32 m_position; -}; - -css::uno::Reference< css::reflection::XTypeDescription > Parameter::getType() - throw (css::uno::RuntimeException) -{ - try { - return css::uno::Reference< css::reflection::XTypeDescription >( - m_manager->getByHierarchicalName(m_typeName), - css::uno::UNO_QUERY_THROW); - } catch (const css::container::NoSuchElementException & e) { - throw css::uno::RuntimeException( - (OUString( - "com.sun.star.container.NoSuchElementException: ") - + e.Message), - static_cast< cppu::OWeakObject * >(this)); - } -} - -} - -MethodDescription::MethodDescription( - css::uno::Reference< css::container::XHierarchicalNameAccess > const & - manager, - OUString const & name, - com::sun::star::uno::Sequence< sal_Int8 > const & bytes, - sal_uInt16 index): - FunctionDescription(manager, bytes, index), m_name(name), - m_parametersInit(false) -{} - -MethodDescription::~MethodDescription() {} - -css::uno::Sequence< css::uno::Reference< css::reflection::XParameter > > -MethodDescription::getParameters() const { - osl::MutexGuard guard(m_mutex); - if (!m_parametersInit) { - typereg::Reader reader(getReader()); - sal_uInt16 n = reader.getMethodParameterCount(m_index); - m_parameters.realloc(n); - for (sal_uInt16 i = 0; i < n; ++i) { - m_parameters[i] = new Parameter( - m_manager, reader.getMethodParameterName(m_index, i), - reader.getMethodParameterTypeName(m_index, i), - reader.getMethodParameterFlags(m_index, i), i); - } - m_parametersInit = true; - } - return m_parameters; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/methoddescription.hxx b/stoc/source/registry_tdprovider/methoddescription.hxx deleted file mode 100644 index 12d2512b0808..000000000000 --- a/stoc/source/registry_tdprovider/methoddescription.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_stoc_source_registry_tdprovider_methoddescription_hxx -#define INCLUDED_stoc_source_registry_tdprovider_methoddescription_hxx - -#include "functiondescription.hxx" - -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/Sequence.hxx" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -namespace com { namespace sun { namespace star { - namespace container { - class XHierarchicalNameAccess; - } - namespace reflection { - class XParameter; - } -} } } -namespace typereg { class Reader; } - -namespace stoc { namespace registry_tdprovider { - -class MethodDescription: public FunctionDescription { -public: - MethodDescription( - com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > const & - manager, - OUString const & name, - com::sun::star::uno::Sequence< sal_Int8 > const & bytes, - sal_uInt16 index); - - ~MethodDescription(); - - OUString getName() const { return m_name; } - - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::reflection::XParameter > > - getParameters() const; - -private: - MethodDescription(MethodDescription &); // not implemented - void operator =(MethodDescription); // not implemented - - OUString m_name; - mutable com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::reflection::XParameter > > m_parameters; - mutable bool m_parametersInit; -}; - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx deleted file mode 100644 index 8b68aee345ef..000000000000 --- a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx +++ /dev/null @@ -1,615 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -//========================================================================= -// Todo: -// -// - closeKey() calls (according to JSC not really needed because XRegistry -// implementation closes key in it's dtor. -// -//========================================================================= -#include -#include -#include "com/sun/star/reflection/XPublished.hpp" -#include "cppuhelper/implbase1.hxx" -#include "registry/reader.hxx" -#include "registry/version.h" -#include "base.hxx" -#include "rdbtdp_tdenumeration.hxx" - -using namespace com::sun::star; - -namespace { - -class IndividualConstantTypeDescriptionImpl: - public cppu::ImplInheritanceHelper1< - stoc_rdbtdp::ConstantTypeDescriptionImpl, - com::sun::star::reflection::XPublished > -{ -public: - IndividualConstantTypeDescriptionImpl( - OUString const & name, com::sun::star::uno::Any const & value, - bool published): - cppu::ImplInheritanceHelper1< - stoc_rdbtdp::ConstantTypeDescriptionImpl, - com::sun::star::reflection::XPublished >(name, value), - m_published(published) {} - - virtual sal_Bool SAL_CALL isPublished() - throw (::com::sun::star::uno::RuntimeException) - { return m_published; } - -private: - bool m_published; -}; - -} - -namespace stoc_rdbtdp -{ - -//========================================================================= -//========================================================================= -// -// TypeDescriptionEnumerationImpl Implementation. -// -//========================================================================= -//========================================================================= - -// static -rtl::Reference< TypeDescriptionEnumerationImpl > -TypeDescriptionEnumerationImpl::createInstance( - const uno::Reference< container::XHierarchicalNameAccess > & xTDMgr, - const OUString & rModuleName, - const uno::Sequence< uno::TypeClass > & rTypes, - reflection::TypeDescriptionSearchDepth eDepth, - const RegistryKeyList & rBaseKeys ) - throw ( reflection::NoSuchTypeNameException, - reflection::InvalidTypeNameException, - uno::RuntimeException ) -{ - if ( rModuleName.isEmpty() ) - { - // Enumeration for root requested. - return rtl::Reference< TypeDescriptionEnumerationImpl >( - new TypeDescriptionEnumerationImpl( - xTDMgr, rBaseKeys, rTypes, eDepth ) ); - } - - RegistryKeyList aModuleKeys; - - OUString aKey( rModuleName.replace( '.', '/' ) ); - - bool bOpenKeySucceeded = false; - - const RegistryKeyList::const_iterator end = rBaseKeys.end(); - RegistryKeyList::const_iterator it = rBaseKeys.begin(); - - while ( it != end ) - { - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = (*it)->openKey( aKey ); - if ( xKey.is() ) - { - // closes key in it's dtor (which is - // called even in case of exceptions). - RegistryKeyCloser aCloser( xKey ); - - if ( xKey->isValid() ) - { - bOpenKeySucceeded = true; - - if ( xKey->getValueType() - == registry::RegistryValueType_BINARY ) - { - uno::Sequence< sal_Int8 > aBytes( - xKey->getBinaryValue() ); - - typereg::Reader aReader( - aBytes.getConstArray(), aBytes.getLength(), false, - TYPEREG_VERSION_1); - - if ( aReader.getTypeClass() == RT_TYPE_MODULE ) - { - // Do not close xKey! - aCloser.reset(); - - aModuleKeys.push_back( xKey ); - } - } - } - else - { - OSL_FAIL( - "TypeDescriptionEnumerationImpl::createInstance " - "- Invalid registry key!" ); - } - } - } - catch ( registry::InvalidRegistryException const & ) - { - // openKey, getValueType, getBinaryValue - - OSL_FAIL( "TypeDescriptionEnumerationImpl::createInstance " - "- Caught InvalidRegistryException!" ); - } - - ++it; - } - - if ( !bOpenKeySucceeded ) - throw reflection::NoSuchTypeNameException(); - - if ( aModuleKeys.empty() ) - throw reflection::InvalidTypeNameException(); - - return rtl::Reference< TypeDescriptionEnumerationImpl >( - new TypeDescriptionEnumerationImpl( - xTDMgr, aModuleKeys, rTypes, eDepth ) ); -} - -//========================================================================= -TypeDescriptionEnumerationImpl::TypeDescriptionEnumerationImpl( - const uno::Reference< container::XHierarchicalNameAccess > & xTDMgr, - const RegistryKeyList & rModuleKeys, - const uno::Sequence< uno::TypeClass > & rTypes, - reflection::TypeDescriptionSearchDepth eDepth ) -: m_aModuleKeys( rModuleKeys ), - m_aTypes( rTypes ), - m_eDepth( eDepth ), - m_xTDMgr( xTDMgr ) -{} - -//========================================================================= -// virtual -TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl() -{ - RegistryKeyList::const_iterator it = m_aModuleKeys.begin(); - RegistryKeyList::const_iterator end = m_aModuleKeys.end(); -/* - @@@ in case we enumerate root and queryMore was never called, then - m_aModuleKeys contains open root keys which where passed from - tdprov and must not be closed by us. - - while ( it != end ) - { - try - { - if ( (*it)->isValid() ) - (*it)->closeKey(); - } - catch (...) - { - // No exceptions from dtors, please! - OSL_FAIL( "TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl " - "- Caught exception!" ); - } - - it++; - } -*/ - it = m_aCurrentModuleSubKeys.begin(); - end = m_aCurrentModuleSubKeys.end(); - while ( it != end ) - { - try - { - if ( (*it)->isValid() ) - (*it)->closeKey(); - } - catch (Exception &) - { - // No exceptions from dtors, please! - OSL_FAIL( "TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl " - "- Caught exception!" ); - } - - ++it; - } -} - -//========================================================================= -// -// XEnumeration (base of XTypeDescriptionEnumeration) methods -// -//========================================================================= - -// virtual -sal_Bool SAL_CALL TypeDescriptionEnumerationImpl::hasMoreElements() - throw ( uno::RuntimeException ) -{ - return queryMore(); -} - -//========================================================================= -// virtual -uno::Any SAL_CALL TypeDescriptionEnumerationImpl::nextElement() - throw ( container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - return uno::Any( uno::makeAny( nextTypeDescription() ) ); -} - -//========================================================================= -// -// XTypeDescriptionEnumeration methods -// -//========================================================================= - -// virtual -uno::Reference< reflection::XTypeDescription > SAL_CALL -TypeDescriptionEnumerationImpl::nextTypeDescription() - throw ( container::NoSuchElementException, - uno::RuntimeException ) -{ - uno::Reference< reflection::XTypeDescription > xTD( queryNext() ); - - if ( xTD.is() ) - return xTD; - - throw container::NoSuchElementException( - OUString("No further elements in enumeration!"), - static_cast< cppu::OWeakObject * >( this ) ); -} - -//========================================================================= -bool TypeDescriptionEnumerationImpl::match( - RTTypeClass eType1, uno::TypeClass eType2 ) -{ - switch ( eType1 ) - { - case RT_TYPE_INTERFACE: - return eType2 == uno::TypeClass_INTERFACE; - - case RT_TYPE_MODULE: - return eType2 == uno::TypeClass_MODULE; - - case RT_TYPE_STRUCT: - return eType2 == uno::TypeClass_STRUCT; - - case RT_TYPE_ENUM: - return eType2 == uno::TypeClass_ENUM; - - case RT_TYPE_EXCEPTION: - return eType2 == uno::TypeClass_EXCEPTION; - - case RT_TYPE_TYPEDEF: - return eType2 == uno::TypeClass_TYPEDEF; - - case RT_TYPE_SERVICE: - return eType2 == uno::TypeClass_SERVICE; - - case RT_TYPE_SINGLETON: - return eType2 == uno::TypeClass_SINGLETON; - - case RT_TYPE_CONSTANTS: - return eType2 == uno::TypeClass_CONSTANTS; - - case RT_TYPE_UNION: - return eType2 == uno::TypeClass_UNION; - - default: - return false; - } -} - -//========================================================================= -bool TypeDescriptionEnumerationImpl::queryMore() -{ - osl::MutexGuard aGuard( m_aMutex ); - - for (;;) - { - if ( !m_aCurrentModuleSubKeys.empty() || !m_aTypeDescs.empty() ) - { - // Okay, there is at least one more element. - return true; - } - - if ( m_aModuleKeys.empty() ) - { - // No module keys (therefore no elements) left. - return false; - } - - // Note: m_aCurrentModuleSubKeys is always empty AND m_aModuleKeys is - // never empty when ariving here. - // ==> select new module key, fill m_aCurrentModuleSubKeys - - uno::Sequence< uno::Reference< registry::XRegistryKey > > aKeys; - try - { - aKeys = m_aModuleKeys.front()->openKeys(); - for ( sal_Int32 n = 0; n < aKeys.getLength(); ++n ) - { - uno::Reference< registry::XRegistryKey > xKey = aKeys[ n ]; - - // closes key in it's dtor (which is - // called even in case of exceptions). - RegistryKeyCloser aCloser( xKey ); - - try - { - if ( xKey->isValid() ) - { - if ( xKey->getValueType() - == registry::RegistryValueType_BINARY ) - { - bool bIncludeIt = (m_aTypes.getLength() == 0); - bool bNeedTypeClass = - ((m_aTypes.getLength() > 0) || - (m_eDepth - == reflection::TypeDescriptionSearchDepth_INFINITE)); - if ( bNeedTypeClass ) - { - uno::Sequence< sal_Int8 > aBytes( - xKey->getBinaryValue() ); - - typereg::Reader aReader( - aBytes.getConstArray(), aBytes.getLength(), - false, TYPEREG_VERSION_1); - - RTTypeClass eTypeClass = aReader.getTypeClass(); - - // Does key match requested types? Empty - // sequence means include all. - if ( m_aTypes.getLength() > 0 ) - { - for ( sal_Int32 m = 0; - m < m_aTypes.getLength(); - ++m ) - { - if ( match(eTypeClass, m_aTypes[ m ]) ) - { - bIncludeIt = true; - break; - } - } - } - - if ( m_eDepth == - reflection::TypeDescriptionSearchDepth_INFINITE ) - { - if ( eTypeClass == RT_TYPE_MODULE ) - { - // Do not close xKey! - aCloser.reset(); - - // Remember new module key. - m_aModuleKeys.push_back( xKey ); - } - } - } - - if ( bIncludeIt ) - { - // Do not close xKey! - aCloser.reset(); - - m_aCurrentModuleSubKeys.push_back( xKey ); - } - } - } - else - { - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryMore " - "- Invalid registry key!" ); - } - - } - catch ( registry::InvalidRegistryException const & ) - { - // getValueType, getBinaryValue - - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryMore " - "- Caught InvalidRegistryException!" ); - - // Don't stop iterating! - } - } - } - catch ( registry::InvalidRegistryException const & ) - { - // openKeys - - for ( sal_Int32 n = 0; n < aKeys.getLength(); ++n ) - { - try - { - aKeys[ n ]->closeKey(); - } - catch ( registry::InvalidRegistryException const & ) - { - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryMore " - "- Caught InvalidRegistryException!" ); - } - } - } - - ///////////////////////////////////////////////////////////////////// - // Special handling for constants contained directly in module. - ///////////////////////////////////////////////////////////////////// - - // Constants requested? - bool bIncludeConstants = ( m_aTypes.getLength() == 0 ); - if ( !bIncludeConstants ) - { - for ( sal_Int32 m = 0; m < m_aTypes.getLength(); ++m ) - { - if ( m_aTypes[ m ] == uno::TypeClass_CONSTANT ) - { - bIncludeConstants = true; - break; - } - } - - } - - if ( bIncludeConstants ) - { - if ( m_aModuleKeys.front()->getValueType() - == registry::RegistryValueType_BINARY ) - { - try - { - uno::Sequence< sal_Int8 > aBytes( - m_aModuleKeys.front()->getBinaryValue() ); - - typereg::Reader aReader( - aBytes.getConstArray(), aBytes.getLength(), false, - TYPEREG_VERSION_1); - - if ( aReader.getTypeClass() == RT_TYPE_MODULE ) - { - sal_uInt16 nFields = aReader.getFieldCount(); - while ( nFields-- ) - { - OUStringBuffer aName( - aReader.getTypeName().replace( '/', '.' ) ); - aName.appendAscii( "." ); - aName.append( aReader.getFieldName( nFields ) ); - - uno::Any aValue( - getRTValue( - aReader.getFieldValue( nFields ) ) ); - - m_aTypeDescs.push_back( - new IndividualConstantTypeDescriptionImpl( - aName.makeStringAndClear(), aValue, - ( ( aReader.getFieldFlags( nFields ) - & RT_ACCESS_PUBLISHED ) - != 0 ) ) ); - } - } - } - catch ( registry::InvalidRegistryException const & ) - { - // getBinaryValue - - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryMore " - "- Caught InvalidRegistryException!" ); - } - } - } - - ///////////////////////////////////////////////////////////////////// - -/* - @@@ m_aModuleKeys.front() may have open sub keys (may be contained in - both m_aModuleKeys and m_aCurrentModuleSubKeys)! - - try - { - m_aModuleKeys.front()->closeKey(); - } - catch ( registry::InvalidRegistryException const & ) - { - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryMore " - "- Caught InvalidRegistryException!" ); - } -*/ - // We're done with this module key, even if there were errors. - m_aModuleKeys.pop_front(); - } - - // unreachable -} - -//========================================================================= -uno::Reference< reflection::XTypeDescription > -TypeDescriptionEnumerationImpl::queryNext() -{ - osl::MutexGuard aGuard( m_aMutex ); - - for (;;) - { - if ( !queryMore() ) - return uno::Reference< reflection::XTypeDescription >(); - - uno::Reference< reflection::XTypeDescription > xTD; - - if ( !m_aTypeDescs.empty() ) - { - xTD = m_aTypeDescs.front(); - m_aTypeDescs.pop_front(); - return xTD; - } - - // Note: xKey is already opened. - uno::Reference< registry::XRegistryKey > - xKey( m_aCurrentModuleSubKeys.front() ); -/* - @@@ xKey may still be contained in m_aModuleKeys, too - - // closes key in it's dtor (which is - // called even in case of exceptions). - RegistryKeyCloser aCloser( xKey ); -*/ - try - { - { - if ( xKey->isValid() ) - { - if ( xKey->getValueType() - == registry::RegistryValueType_BINARY ) - { - uno::Sequence< sal_Int8 > aBytes( - xKey->getBinaryValue() ); - - xTD = createTypeDescription( aBytes, - m_xTDMgr, - false ); - OSL_ENSURE( xTD.is(), - "TypeDescriptionEnumerationImpl::queryNext " - "- No XTypeDescription created!" ); - } - } - else - { - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryNext " - "- Invalid registry key!" ); - } - } - } - catch ( registry::InvalidRegistryException const & ) - { - // getValueType, getBinaryValue - - OSL_FAIL( "TypeDescriptionEnumerationImpl::queryNext " - "- Caught InvalidRegistryException!" ); - } - - // We're done with this key, even if there were errors. - m_aCurrentModuleSubKeys.pop_front(); - - if ( xTD.is() ) - return xTD; - - // next try... - - } // for (;;) -} - -} // namespace stoc_rdbtdp - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx deleted file mode 100644 index 863d314f611e..000000000000 --- a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _STOC_RDBTDP_TDENUMERATION_HXX -#define _STOC_RDBTDP_TDENUMERATION_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "base.hxx" - -namespace stoc_rdbtdp -{ - -typedef ::std::list< ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XTypeDescription > > TypeDescriptionList; - -class TypeDescriptionEnumerationImpl - : public cppu::WeakImplHelper1< - com::sun::star::reflection::XTypeDescriptionEnumeration > -{ -public: - static rtl::Reference< TypeDescriptionEnumerationImpl > createInstance( - const ::com::sun::star::uno::Reference< - ::com::sun::star::container::XHierarchicalNameAccess > & xTDMgr, - const OUString & rModuleName, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::TypeClass > & rTypes, - ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth, - const RegistryKeyList & rBaseKeys ) - throw ( ::com::sun::star::reflection::NoSuchTypeNameException, - ::com::sun::star::reflection::InvalidTypeNameException, - ::com::sun::star::uno::RuntimeException ); - - virtual ~TypeDescriptionEnumerationImpl(); - - // XEnumeration (base of XTypeDescriptionEnumeration) - virtual sal_Bool SAL_CALL hasMoreElements() - throw ( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Any SAL_CALL nextElement() - throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - // XTypeDescriptionEnumeration - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XTypeDescription > SAL_CALL - nextTypeDescription() - throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException ); - -private: - // Note: keys must be open (XRegistryKey->openKey(...)). - TypeDescriptionEnumerationImpl( - const ::com::sun::star::uno::Reference< - ::com::sun::star::container::XHierarchicalNameAccess > & xTDMgr, - const RegistryKeyList & rModuleKeys, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::TypeClass > & rTypes, - ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth ); - - static bool match( ::RTTypeClass eType1, - ::com::sun::star::uno::TypeClass eType2 ); - bool queryMore(); - ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XTypeDescription > queryNext(); - - // members - osl::Mutex m_aMutex; - RegistryKeyList m_aModuleKeys; - RegistryKeyList m_aCurrentModuleSubKeys; - TypeDescriptionList m_aTypeDescs; - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::TypeClass > m_aTypes; - ::com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth; - ::com::sun::star::uno::Reference< - ::com::sun::star::container::XHierarchicalNameAccess > m_xTDMgr; -}; - -} // namespace stoc_rdbtdp - -#endif /* _STOC_RDBTDP_TDENUMERATION_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/structtypedescription.cxx b/stoc/source/registry_tdprovider/structtypedescription.cxx deleted file mode 100644 index b85b5f4c33d3..000000000000 --- a/stoc/source/registry_tdprovider/structtypedescription.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "structtypedescription.hxx" - -#include "base.hxx" - -#include "com/sun/star/reflection/XTypeDescription.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/TypeClass.hpp" -#include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" -#include "registry/reader.hxx" -#include "registry/types.h" -#include "registry/version.h" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" - -#include - -using stoc::registry_tdprovider::StructTypeDescription; - -StructTypeDescription::StructTypeDescription( - css::uno::Reference< css::container::XHierarchicalNameAccess > const & - manager, - OUString const & name, OUString const & baseTypeName, - css::uno::Sequence< sal_Int8 > const & data, bool published): - m_data(data), - m_base( - new stoc_rdbtdp::CompoundTypeDescriptionImpl( - manager, css::uno::TypeClass_STRUCT, name, baseTypeName, data, - published)) -{} - -StructTypeDescription::~StructTypeDescription() -{} - -css::uno::TypeClass StructTypeDescription::getTypeClass() - throw (css::uno::RuntimeException) -{ - return m_base->getTypeClass(); -} - -OUString StructTypeDescription::getName() - throw (css::uno::RuntimeException) -{ - return m_base->getName(); -} - -css::uno::Reference< css::reflection::XTypeDescription > -StructTypeDescription::getBaseType() throw (css::uno::RuntimeException) -{ - return m_base->getBaseType(); -} - -css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > > -StructTypeDescription::getMemberTypes() throw (css::uno::RuntimeException) -{ - return m_base->getMemberTypes(); -} - -css::uno::Sequence< OUString > StructTypeDescription::getMemberNames() - throw (css::uno::RuntimeException) -{ - return m_base->getMemberNames(); -} - -css::uno::Sequence< OUString > StructTypeDescription::getTypeParameters() - throw (css::uno::RuntimeException) -{ - try { - typereg::Reader reader( - m_data.getConstArray(), m_data.getLength(), false, - TYPEREG_VERSION_1); - OSL_ASSERT(reader.isValid()); - sal_uInt16 n = reader.getReferenceCount(); - css::uno::Sequence< OUString > parameters(n); - for (sal_uInt16 i = 0; i < n; ++i) { - if (reader.getReferenceFlags(i) != RT_ACCESS_INVALID - || reader.getReferenceSort(i) != RT_REF_TYPE_PARAMETER) - { - throw css::uno::RuntimeException( - OUString( - "type parameter of polymorphic struct type template" - " not RT_ACCESS_INVALID/RT_REF_TYPE_PARAMETER"), - static_cast< cppu::OWeakObject * >(this)); - } - parameters[i] = reader.getReferenceTypeName(i); - } - return parameters; - } catch (std::bad_alloc &) { - throw css::uno::RuntimeException( - OUString("std::bad_alloc"), - static_cast< cppu::OWeakObject * >(this)); - } -} - -css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > > -StructTypeDescription::getTypeArguments() throw (css::uno::RuntimeException) -{ - return css::uno::Sequence< - css::uno::Reference< css::reflection::XTypeDescription > >(); -} - -sal_Bool StructTypeDescription::isPublished() throw (css::uno::RuntimeException) -{ - return m_base->isPublished(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/structtypedescription.hxx b/stoc/source/registry_tdprovider/structtypedescription.hxx deleted file mode 100644 index ae8ecbab45e0..000000000000 --- a/stoc/source/registry_tdprovider/structtypedescription.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_stoc_source_registry_tdprovider_structtypedescription_hxx -#define INCLUDED_stoc_source_registry_tdprovider_structtypedescription_hxx - -#include "com/sun/star/reflection/XPublished.hpp" -#include "com/sun/star/reflection/XStructTypeDescription.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/Sequence.hxx" -#include "cppuhelper/implbase2.hxx" -#include "rtl/ref.hxx" -#include "sal/types.h" - -namespace com { namespace sun { namespace star { - namespace container { class XHierarchicalNameAccess; } - namespace reflection { class XCompoundTypeDescription; } -} } } -namespace stoc_rdbtdp { class CompoundTypeDescriptionImpl; } - -namespace stoc { namespace registry_tdprovider { - -class StructTypeDescription: - public cppu::WeakImplHelper2< - com::sun::star::reflection::XStructTypeDescription, - com::sun::star::reflection::XPublished > -{ -public: - StructTypeDescription( - com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > const & - manager, - OUString const & name, OUString const & baseTypeName, - com::sun::star::uno::Sequence< sal_Int8 > const & data, bool published); - - virtual ~StructTypeDescription(); - - virtual com::sun::star::uno::TypeClass SAL_CALL getTypeClass() - throw (com::sun::star::uno::RuntimeException); - - virtual OUString SAL_CALL getName() - throw (com::sun::star::uno::RuntimeException); - - virtual - com::sun::star::uno::Reference< - com::sun::star::reflection::XTypeDescription > - SAL_CALL getBaseType() throw (com::sun::star::uno::RuntimeException); - - virtual - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::reflection::XTypeDescription > > - SAL_CALL getMemberTypes() throw (com::sun::star::uno::RuntimeException); - - virtual com::sun::star::uno::Sequence< OUString > SAL_CALL - getMemberNames() throw (com::sun::star::uno::RuntimeException); - - virtual com::sun::star::uno::Sequence< OUString > SAL_CALL - getTypeParameters() throw (com::sun::star::uno::RuntimeException); - - virtual - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::reflection::XTypeDescription > > - SAL_CALL getTypeArguments() throw (com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isPublished() - throw (com::sun::star::uno::RuntimeException); - -private: - StructTypeDescription(StructTypeDescription &); // not implemented - void operator =(StructTypeDescription); // not implemented - - com::sun::star::uno::Sequence< sal_Int8 > m_data; - rtl::Reference< stoc_rdbtdp::CompoundTypeDescriptionImpl > m_base; -}; - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/td.cxx b/stoc/source/registry_tdprovider/td.cxx deleted file mode 100644 index 6ae85de8a142..000000000000 --- a/stoc/source/registry_tdprovider/td.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "osl/doublecheckedlocking.h" -#include "base.hxx" - -namespace stoc_rdbtdp -{ - -//------------------------------------------------------------------------------ -::osl::Mutex & getMutex() -{ - static ::osl::Mutex * s_pmutex = 0; - if (s_pmutex == 0) - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if (s_pmutex == 0) - { - static ::osl::Mutex s_mutex; - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - s_pmutex = &s_mutex; - } - } - else - { - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - } - return *s_pmutex; -} - -TypeDescriptionImpl::~TypeDescriptionImpl() {} - -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass TypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return _eTypeClass; -} -//__________________________________________________________________________________________________ -OUString TypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdcomp.cxx b/stoc/source/registry_tdprovider/tdcomp.cxx deleted file mode 100644 index cb1284b48c15..000000000000 --- a/stoc/source/registry_tdprovider/tdcomp.cxx +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "base.hxx" - -#include "registry/reader.hxx" -#include "registry/version.h" - -namespace stoc_rdbtdp -{ - -//__________________________________________________________________________________________________ -CompoundTypeDescriptionImpl::~CompoundTypeDescriptionImpl() -{ - delete _pMembers; - delete _pMemberNames; -} - -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass CompoundTypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return _eTypeClass; -} -//__________________________________________________________________________________________________ -OUString CompoundTypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -// XCompoundTypeDescription -//__________________________________________________________________________________________________ -Reference< XTypeDescription > CompoundTypeDescriptionImpl::getBaseType() - throw(::com::sun::star::uno::RuntimeException) -{ - if (!_xBaseTD.is() && !_aBaseType.isEmpty()) - { - try - { - Reference< XTypeDescription > xBaseTD; - if (_xTDMgr->getByHierarchicalName( _aBaseType ) >>= xBaseTD) - { - MutexGuard aGuard( getMutex() ); - if (! _xBaseTD.is()) - _xBaseTD = xBaseTD; - return _xBaseTD; - } - } - catch (NoSuchElementException &) - { - } - // never try again, if no base td was found - _aBaseType = OUString(); - } - return _xBaseTD; -} -//__________________________________________________________________________________________________ - -namespace { - -class TypeParameter: public WeakImplHelper1< XTypeDescription > { -public: - explicit TypeParameter(OUString const & name): m_name(name) {} - - virtual TypeClass SAL_CALL getTypeClass() throw (RuntimeException) - { return TypeClass_UNKNOWN; } - - virtual OUString SAL_CALL getName() throw (RuntimeException) - { return m_name; } - -private: - OUString m_name; -}; - -} - -Sequence< Reference< XTypeDescription > > CompoundTypeDescriptionImpl::getMemberTypes() - throw(::com::sun::star::uno::RuntimeException) -{ - if (! _pMembers) - { - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - - sal_uInt16 nFields = aReader.getFieldCount(); - Sequence< Reference< XTypeDescription > > * pTempMembers = - new Sequence< Reference< XTypeDescription > >( nFields ); - Reference< XTypeDescription > * pMembers = pTempMembers->getArray(); - - while (nFields--) - { - if ((aReader.getFieldFlags(nFields) & RT_ACCESS_PARAMETERIZED_TYPE) - != 0) - { - pMembers[nFields] = new TypeParameter( - aReader.getFieldTypeName(nFields)); - } else { - try { - _xTDMgr->getByHierarchicalName( - aReader.getFieldTypeName(nFields).replace('/', '.')) - >>= pMembers[nFields]; - } catch (NoSuchElementException &) {} - OSL_ENSURE( - pMembers[nFields].is(), "### compound member unknown!"); - } - } - - ClearableMutexGuard aGuard( getMutex() ); - if (_pMembers) - { - aGuard.clear(); - delete pTempMembers; - } - else - { - _pMembers = pTempMembers; - } - } - - return *_pMembers; -} -//__________________________________________________________________________________________________ -Sequence< OUString > CompoundTypeDescriptionImpl::getMemberNames() - throw(::com::sun::star::uno::RuntimeException) -{ - if (! _pMemberNames) - { - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - - sal_uInt16 nFields = aReader.getFieldCount(); - Sequence< OUString > * pTempMemberNames = new Sequence< OUString >( nFields ); - OUString * pMemberNames = pTempMemberNames->getArray(); - - while (nFields--) - { - pMemberNames[nFields] = aReader.getFieldName( nFields ); - } - - ClearableMutexGuard aGuard( getMutex() ); - if (_pMemberNames) - { - aGuard.clear(); - delete pTempMemberNames; - } - else - { - _pMemberNames = pTempMemberNames; - } - } - return *_pMemberNames; -} - -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdconsts.cxx b/stoc/source/registry_tdprovider/tdconsts.cxx deleted file mode 100644 index 7b6e0cbf70e0..000000000000 --- a/stoc/source/registry_tdprovider/tdconsts.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include "registry/reader.hxx" -#include "registry/version.h" -#include "base.hxx" - -namespace stoc_rdbtdp -{ - -//__________________________________________________________________________________________________ -// virtual -ConstantsTypeDescriptionImpl::~ConstantsTypeDescriptionImpl() -{ - delete _pMembers; -} - -// XTypeDescription -//__________________________________________________________________________________________________ -// virtual -TypeClass ConstantsTypeDescriptionImpl::getTypeClass() - throw( RuntimeException ) -{ - return TypeClass_CONSTANTS; -} -//__________________________________________________________________________________________________ -// virtual -OUString ConstantsTypeDescriptionImpl::getName() - throw( RuntimeException ) -{ - return _aName; -} - -// XConstantsTypeDescription -//__________________________________________________________________________________________________ -// virtual -Sequence< Reference< XConstantTypeDescription > > SAL_CALL -ConstantsTypeDescriptionImpl::getConstants() - throw ( RuntimeException ) -{ - if ( !_pMembers ) - { - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - - sal_uInt16 nFields = aReader.getFieldCount(); - Sequence< Reference< XConstantTypeDescription > > * pTempConsts - = new Sequence< Reference< XConstantTypeDescription > >( nFields ); - Reference< XConstantTypeDescription > * pConsts - = pTempConsts->getArray(); - - while ( nFields-- ) - { - OUStringBuffer aName( _aName ); - aName.appendAscii( "." ); - aName.append( aReader.getFieldName( nFields ) ); - - Any aValue( getRTValue( aReader.getFieldValue( nFields ) ) ); - - pConsts[ nFields ] - = new ConstantTypeDescriptionImpl( aName.makeStringAndClear(), - aValue ); - } - - ClearableMutexGuard aGuard( getMutex() ); - if ( _pMembers ) - { - aGuard.clear(); - delete pTempConsts; - } - else - { - _pMembers = pTempConsts; - } - } - return *_pMembers; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdef.cxx b/stoc/source/registry_tdprovider/tdef.cxx deleted file mode 100644 index 34ac11827e4f..000000000000 --- a/stoc/source/registry_tdprovider/tdef.cxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "base.hxx" - -namespace stoc_rdbtdp -{ -TypedefTypeDescriptionImpl::~TypedefTypeDescriptionImpl() {} - -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass TypedefTypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_TYPEDEF; -} -//__________________________________________________________________________________________________ -OUString TypedefTypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -// XIndirectTypeDescription -//__________________________________________________________________________________________________ -Reference< XTypeDescription > TypedefTypeDescriptionImpl::getReferencedType() - throw(::com::sun::star::uno::RuntimeException) -{ - if (!_xRefTD.is() && !_aRefName.isEmpty()) - { - try - { - Reference< XTypeDescription > xRefTD; - if (_xTDMgr->getByHierarchicalName( _aRefName ) >>= xRefTD) - { - MutexGuard aGuard( getMutex() ); - if (! _xRefTD.is()) - _xRefTD = xRefTD; - return _xRefTD; - } - } - catch (NoSuchElementException &) - { - } - // never try again, if no base td was found - _aRefName = OUString(); - } - return _xRefTD; -} - -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdenum.cxx b/stoc/source/registry_tdprovider/tdenum.cxx deleted file mode 100644 index 65c1ecef1a16..000000000000 --- a/stoc/source/registry_tdprovider/tdenum.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "base.hxx" - -#include "registry/reader.hxx" -#include "registry/version.h" - -namespace stoc_rdbtdp -{ - -//__________________________________________________________________________________________________ -EnumTypeDescriptionImpl::~EnumTypeDescriptionImpl() -{ - delete _pEnumNames; - delete _pEnumValues; -} - -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass EnumTypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_ENUM; -} -//__________________________________________________________________________________________________ -OUString EnumTypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -// XEnumTypeDescription -//__________________________________________________________________________________________________ -sal_Int32 EnumTypeDescriptionImpl::getDefaultEnumValue() - throw(::com::sun::star::uno::RuntimeException) -{ - return _nDefaultValue; -} -//__________________________________________________________________________________________________ -Sequence< OUString > EnumTypeDescriptionImpl::getEnumNames() - throw(::com::sun::star::uno::RuntimeException) -{ - if (! _pEnumNames) - { - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - - sal_uInt16 nFields = aReader.getFieldCount(); - Sequence< OUString > * pTempEnumNames = new Sequence< OUString >( nFields ); - OUString * pEnumNames = pTempEnumNames->getArray(); - - while (nFields--) - { - pEnumNames[nFields] = aReader.getFieldName( nFields ); - } - - ClearableMutexGuard aGuard( getMutex() ); - if (_pEnumNames) - { - aGuard.clear(); - delete pTempEnumNames; - } - else - { - _pEnumNames = pTempEnumNames; - } - } - return *_pEnumNames; -} -//__________________________________________________________________________________________________ -Sequence< sal_Int32 > EnumTypeDescriptionImpl::getEnumValues() - throw(::com::sun::star::uno::RuntimeException) -{ - if (! _pEnumValues) - { - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - - sal_uInt16 nFields = aReader.getFieldCount(); - Sequence< sal_Int32 > * pTempEnumValues = new Sequence< sal_Int32 >( nFields ); - sal_Int32 * pEnumValues = pTempEnumValues->getArray(); - - while (nFields--) - { - pEnumValues[nFields] = getRTValueAsInt32( - aReader.getFieldValue( nFields ) ); - } - - ClearableMutexGuard aGuard( getMutex() ); - if (_pEnumValues) - { - aGuard.clear(); - delete pTempEnumValues; - } - else - { - _pEnumValues = pTempEnumValues; - } - } - return *_pEnumValues; -} - -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdiface.cxx b/stoc/source/registry_tdprovider/tdiface.cxx deleted file mode 100644 index d9a46c42282e..000000000000 --- a/stoc/source/registry_tdprovider/tdiface.cxx +++ /dev/null @@ -1,565 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include "registry/reader.hxx" -#include "registry/version.h" - -#include -#include -#include -#include -#include -#include "com/sun/star/uno/RuntimeException.hpp" -#include "base.hxx" -#include "functiondescription.hxx" -#include "methoddescription.hxx" - -#include -#include - -namespace stoc_rdbtdp -{ - -//================================================================================================== -class InterfaceMethodImpl : public WeakImplHelper1< XInterfaceMethodTypeDescription > -{ - stoc::registry_tdprovider::MethodDescription _desc; - - Reference< XHierarchicalNameAccess > _xTDMgr; - - OUString _aTypeName; - - OUString _aReturnType; - Reference< XTypeDescription > _xReturnTD; - - sal_Bool _bIsOneWay; - sal_Int32 _nPosition; - -public: - InterfaceMethodImpl( const Reference< XHierarchicalNameAccess > & xTDMgr, - const OUString & rTypeName, - const OUString & rMemberName, - const OUString & rReturnType, - const Sequence< sal_Int8 > & rBytes, - sal_uInt16 nMethodIndex, - sal_Bool bIsOneWay, - sal_Int32 nPosition ) - : _desc(xTDMgr, rMemberName, rBytes, nMethodIndex) - , _xTDMgr( xTDMgr ) - , _aTypeName( rTypeName ) - , _aReturnType( rReturnType ) - , _bIsOneWay( bIsOneWay ) - , _nPosition( nPosition ) - {} - virtual ~InterfaceMethodImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XInterfaceMemberTypeDescription - virtual OUString SAL_CALL getMemberName() throw(::com::sun::star::uno::RuntimeException) - { return _desc.getName(); } - virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException); - - // XInterfaceMethodTypeDescription - virtual Reference< XTypeDescription > SAL_CALL getReturnType() throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isOneway() throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< Reference< XMethodParameter > > SAL_CALL getParameters() throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< Reference< XTypeDescription > > SAL_CALL getExceptions() throw(::com::sun::star::uno::RuntimeException); -}; -//__________________________________________________________________________________________________ -InterfaceMethodImpl::~InterfaceMethodImpl() {} - -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass InterfaceMethodImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_INTERFACE_METHOD; -} -//__________________________________________________________________________________________________ -OUString InterfaceMethodImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aTypeName; -} - -// XInterfaceMemberTypeDescription -//__________________________________________________________________________________________________ -sal_Int32 InterfaceMethodImpl::getPosition() - throw(::com::sun::star::uno::RuntimeException) -{ - return _nPosition; -} - -// XInterfaceMethodTypeDescription -//__________________________________________________________________________________________________ -Reference InterfaceMethodImpl::getReturnType() - throw(::com::sun::star::uno::RuntimeException) -{ - if (!_xReturnTD.is() && !_aReturnType.isEmpty()) - { - try - { - Reference< XTypeDescription > xReturnTD; - if (_xTDMgr->getByHierarchicalName( _aReturnType ) >>= xReturnTD) - { - MutexGuard aGuard( getMutex() ); - if (! _xReturnTD.is()) - _xReturnTD = xReturnTD; - return _xReturnTD; - } - } - catch (NoSuchElementException &) - { - } - // never try again, if no td was found - _aReturnType = OUString(); - } - return _xReturnTD; -} -//__________________________________________________________________________________________________ -sal_Bool InterfaceMethodImpl::isOneway() - throw(::com::sun::star::uno::RuntimeException) -{ - return _bIsOneWay; -} -//__________________________________________________________________________________________________ -Sequence > InterfaceMethodImpl::getParameters() - throw(::com::sun::star::uno::RuntimeException) -{ - Sequence< Reference< XParameter > > s1(_desc.getParameters()); - Sequence< Reference< XMethodParameter > > s2(s1.getLength()); - for (sal_Int32 i = 0; i < s1.getLength(); ++i) { - s2[i] = s1[i].get(); - } - return s2; -} -//__________________________________________________________________________________________________ -Sequence > InterfaceMethodImpl::getExceptions() - throw(::com::sun::star::uno::RuntimeException) -{ - Sequence< Reference< XCompoundTypeDescription > > s1( - _desc.getExceptions()); - Sequence< Reference< XTypeDescription > > s2(s1.getLength()); - for (sal_Int32 i = 0; i < s1.getLength(); ++i) { - s2[i] = s1[i].get(); - } - return s2; -} - - -//################################################################################################## -//################################################################################################## -//################################################################################################## - - -//================================================================================================== -class InterfaceAttributeImpl : public WeakImplHelper1< XInterfaceAttributeTypeDescription2 > -{ - Reference< XHierarchicalNameAccess > _xTDMgr; - - OUString _aTypeName; - OUString _aMemberName; - - OUString _aMemberTypeName; - Reference< XTypeDescription > _xMemberTD; - - sal_Bool _bReadOnly; - sal_Bool _bBound; - sal_Int32 _nPosition; - - SAL_WNODEPRECATED_DECLARATIONS_PUSH - std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > _getter; - std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > _setter; - SAL_WNODEPRECATED_DECLARATIONS_POP - -public: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - InterfaceAttributeImpl( - const Reference< XHierarchicalNameAccess > & xTDMgr, - const OUString & rTypeName, - const OUString & rMemberName, - const OUString & rMemberTypeName, - sal_Bool bReadOnly, - sal_Bool bBound, - std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > & - getter, - std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > & - setter, - sal_Int32 nPosition ) - : _xTDMgr( xTDMgr ) - , _aTypeName( rTypeName ) - , _aMemberName( rMemberName ) - , _aMemberTypeName( rMemberTypeName ) - , _bReadOnly( bReadOnly ) - , _bBound( bBound ) - , _nPosition( nPosition ) - , _getter( getter ) - , _setter( setter ) - {} - SAL_WNODEPRECATED_DECLARATIONS_POP - virtual ~InterfaceAttributeImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XInterfaceMemberTypeDescription - virtual OUString SAL_CALL getMemberName() throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException); - - // XInterfaceAttributeTypeDescription2 - virtual sal_Bool SAL_CALL isReadOnly() throw(::com::sun::star::uno::RuntimeException); - virtual Reference< XTypeDescription > SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isBound() throw (RuntimeException) - { return _bBound; } - - virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL - getGetExceptions() throw (RuntimeException) - { - if (_getter.get() != 0) { - return _getter->getExceptions(); - } else { - return Sequence< Reference< XCompoundTypeDescription > >(); - } - } - - virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL - getSetExceptions() throw (RuntimeException) - { - if (_setter.get() != 0) { - return _setter->getExceptions(); - } else { - return Sequence< Reference< XCompoundTypeDescription > >(); - } - } -}; - -InterfaceAttributeImpl::~InterfaceAttributeImpl() {} -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass InterfaceAttributeImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_INTERFACE_ATTRIBUTE; -} -//__________________________________________________________________________________________________ -OUString InterfaceAttributeImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aTypeName; -} - -// XInterfaceMemberTypeDescription -//__________________________________________________________________________________________________ -OUString InterfaceAttributeImpl::getMemberName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aMemberName; -} -//__________________________________________________________________________________________________ -sal_Int32 InterfaceAttributeImpl::getPosition() - throw(::com::sun::star::uno::RuntimeException) -{ - return _nPosition; -} - -// XInterfaceAttributeTypeDescription2 -//__________________________________________________________________________________________________ -sal_Bool InterfaceAttributeImpl::isReadOnly() - throw(::com::sun::star::uno::RuntimeException) -{ - return _bReadOnly; -} -//__________________________________________________________________________________________________ -Reference InterfaceAttributeImpl::getType() - throw(::com::sun::star::uno::RuntimeException) -{ - if (!_xMemberTD.is() && !_aMemberTypeName.isEmpty()) - { - try - { - Reference< XTypeDescription > xMemberTD; - if (_xTDMgr->getByHierarchicalName( _aMemberTypeName ) >>= xMemberTD) - { - MutexGuard aGuard( getMutex() ); - if (! _xMemberTD.is()) - _xMemberTD = xMemberTD; - return _xMemberTD; - } - } - catch (NoSuchElementException &) - { - } - // never try again, if no td was found - _aMemberTypeName = OUString(); - } - return _xMemberTD; -} - - -//################################################################################################## -//################################################################################################## -//################################################################################################## - -void InterfaceTypeDescriptionImpl::checkInterfaceType( - Reference< XTypeDescription > const & type) -{ - if (resolveTypedefs(type)->getTypeClass() != TypeClass_INTERFACE) { - throw RuntimeException( - OUString( - "Interface base is not an interface type"), - static_cast< OWeakObject * >(this)); - } -} - -namespace { - -class BaseOffset { -public: - BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc); - - sal_Int32 get() const { return offset; } - -private: - void calculateBases(Reference< XInterfaceTypeDescription2 > const & desc); - - void calculate(Reference< XInterfaceTypeDescription2 > const & desc); - - std::set< OUString > set; - sal_Int32 offset; -}; - -BaseOffset::BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc) { - offset = 0; - calculateBases(desc); -} - -void BaseOffset::calculateBases( - Reference< XInterfaceTypeDescription2 > const & desc) -{ - Sequence< Reference < XTypeDescription > > bases(desc->getBaseTypes()); - for (sal_Int32 i = 0; i < bases.getLength(); ++i) { - calculate( - Reference< XInterfaceTypeDescription2 >( - resolveTypedefs(bases[i]), UNO_QUERY_THROW)); - } -} - -void BaseOffset::calculate(Reference< XInterfaceTypeDescription2 > const & desc) -{ - if (set.insert(desc->getName()).second) { - calculateBases(desc); - offset += desc->getMembers().getLength(); - } -} - -} - -//__________________________________________________________________________________________________ -InterfaceTypeDescriptionImpl::InterfaceTypeDescriptionImpl( - const Reference< XHierarchicalNameAccess > & xTDMgr, - const OUString & rName, const Sequence< OUString > & rBaseTypes, - const Sequence< OUString > & rOptionalBaseTypes, - const Sequence< sal_Int8 > & rBytes, bool published ) - : _xTDMgr( xTDMgr ) - , _aBytes( rBytes ) - , _aName( rName ) - , _aBaseTypes( rBaseTypes ) - , _aOptionalBaseTypes( rOptionalBaseTypes ) - , _membersInit( false ) - , _published( published ) -{} -//__________________________________________________________________________________________________ -InterfaceTypeDescriptionImpl::~InterfaceTypeDescriptionImpl() {} - -// XTypeDescription -//__________________________________________________________________________________________________ -TypeClass InterfaceTypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_INTERFACE; -} -//__________________________________________________________________________________________________ -OUString InterfaceTypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -// XInterfaceTypeDescription2 -//__________________________________________________________________________________________________ -Reference< XTypeDescription > InterfaceTypeDescriptionImpl::getBaseType() - throw(::com::sun::star::uno::RuntimeException) -{ - Sequence< Reference< XTypeDescription > > aBaseTypes(getBaseTypes()); - return aBaseTypes.getLength() >= 1 ? aBaseTypes[0] : 0; -} -//__________________________________________________________________________________________________ -Uik SAL_CALL InterfaceTypeDescriptionImpl::getUik() - throw(::com::sun::star::uno::RuntimeException) -{ - return Uik(); -} -//__________________________________________________________________________________________________ -Sequence< Reference< XInterfaceMemberTypeDescription > > InterfaceTypeDescriptionImpl::getMembers() - throw(::com::sun::star::uno::RuntimeException) -{ - osl::MutexGuard guard(getMutex()); - if (!_membersInit) { - _nBaseOffset = BaseOffset(this).get(); - typereg::Reader reader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - sal_Int32 count = 0; - sal_uInt16 methodCount = reader.getMethodCount(); - for (sal_uInt16 i = 0; i < methodCount; ++i) { - RTMethodMode flags = reader.getMethodFlags(i); - if (flags != RT_MODE_ATTRIBUTE_GET - && flags != RT_MODE_ATTRIBUTE_SET) - { - ++count; - } - } - sal_uInt16 fieldCount = reader.getFieldCount(); - count += fieldCount; - _members.realloc(count); - sal_Int32 index = 0; - for (sal_uInt16 i = 0; i < fieldCount; ++i) { - OUString name(reader.getFieldName(i)); - OUStringBuffer typeName(getName()); - typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::")); - typeName.append(name); - RTFieldAccess flags = reader.getFieldFlags(i); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > - getter; - std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > - setter; - SAL_WNODEPRECATED_DECLARATIONS_POP - for (sal_uInt16 j = 0; j < methodCount; ++j) { - if (reader.getMethodName(j) == name) { - switch (reader.getMethodFlags(j)) { - case RT_MODE_ATTRIBUTE_GET: - OSL_ASSERT(getter.get() == 0); - getter.reset( - new stoc::registry_tdprovider::FunctionDescription( - _xTDMgr, _aBytes, j)); - break; - - case RT_MODE_ATTRIBUTE_SET: - OSL_ASSERT(setter.get() == 0); - setter.reset( - new stoc::registry_tdprovider::FunctionDescription( - _xTDMgr, _aBytes, j)); - break; - - default: - OSL_ASSERT(false); - break; - } - } - } - _members[index] = new InterfaceAttributeImpl( - _xTDMgr, typeName.makeStringAndClear(), name, - reader.getFieldTypeName(i).replace('/', '.'), - (flags & RT_ACCESS_READONLY) != 0, - (flags & RT_ACCESS_BOUND) != 0, getter, setter, - _nBaseOffset + index); - ++index; - } - for (sal_uInt16 i = 0; i < methodCount; ++i) { - RTMethodMode flags = reader.getMethodFlags(i); - if (flags != RT_MODE_ATTRIBUTE_GET - && flags != RT_MODE_ATTRIBUTE_SET) - { - OUString name(reader.getMethodName(i)); - OUStringBuffer typeName(getName()); - typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::")); - typeName.append(name); - _members[index] = new InterfaceMethodImpl( - _xTDMgr, typeName.makeStringAndClear(), name, - reader.getMethodReturnTypeName(i).replace('/', '.'), - _aBytes, i, flags == RT_MODE_ONEWAY, _nBaseOffset + index); - ++index; - } - } - _membersInit = true; - } - return _members; -} - -Sequence< Reference< XTypeDescription > > -InterfaceTypeDescriptionImpl::getBaseTypes() throw (RuntimeException) { - MutexGuard guard(getMutex()); - if (_xBaseTDs.getLength() == 0 && _aBaseTypes.getLength() != 0) { - Sequence< Reference< XTypeDescription > > tds(_aBaseTypes.getLength()); - for (sal_Int32 i = 0; i < _aBaseTypes.getLength(); ++i) { - try { - _xTDMgr->getByHierarchicalName(_aBaseTypes[i]) >>= tds[i]; - } catch (const NoSuchElementException & e) { - throw RuntimeException( - (OUString( - "com.sun.star.container.NoSuchElementException: ") - + e.Message), - static_cast< OWeakObject * >(this)); - } - OSL_ASSERT(tds[i].is()); - checkInterfaceType(tds[i]); - } - _xBaseTDs = tds; - } - return _xBaseTDs; -} - -Sequence< Reference< XTypeDescription > > -InterfaceTypeDescriptionImpl::getOptionalBaseTypes() throw (RuntimeException) { - MutexGuard guard(getMutex()); - if (_xOptionalBaseTDs.getLength() == 0 - && _aOptionalBaseTypes.getLength() != 0) - { - Sequence< Reference< XTypeDescription > > tds( - _aOptionalBaseTypes.getLength()); - for (sal_Int32 i = 0; i < _aOptionalBaseTypes.getLength(); ++i) { - try { - _xTDMgr->getByHierarchicalName(_aOptionalBaseTypes[i]) - >>= tds[i]; - } catch (const NoSuchElementException & e) { - throw RuntimeException( - (OUString( - "com.sun.star.container.NoSuchElementException: ") - + e.Message), - static_cast< OWeakObject * >(this)); - } - OSL_ASSERT(tds[i].is()); - checkInterfaceType(tds[i]); - } - _xOptionalBaseTDs = tds; - } - return _xOptionalBaseTDs; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdmodule.cxx b/stoc/source/registry_tdprovider/tdmodule.cxx deleted file mode 100644 index 0cd6d29da233..000000000000 --- a/stoc/source/registry_tdprovider/tdmodule.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include -#include -#include "base.hxx" - -namespace stoc_rdbtdp -{ - -//__________________________________________________________________________________________________ -// virtual -ModuleTypeDescriptionImpl::~ModuleTypeDescriptionImpl() -{ - delete _pMembers; -} - -// XTypeDescription -//__________________________________________________________________________________________________ -// virtual -TypeClass ModuleTypeDescriptionImpl::getTypeClass() - throw( RuntimeException ) -{ - return TypeClass_MODULE; -} -//__________________________________________________________________________________________________ -// virtual -OUString ModuleTypeDescriptionImpl::getName() - throw( RuntimeException ) -{ - return _aName; -} - -// XModuleTypeDescription -//__________________________________________________________________________________________________ -// virtual -Sequence< Reference< XTypeDescription > > SAL_CALL -ModuleTypeDescriptionImpl::getMembers() - throw ( RuntimeException ) -{ - if ( !_pMembers ) - { - Reference< XTypeDescriptionEnumeration > xEnum; - try - { - xEnum = _xTDMgr->createTypeDescriptionEnumeration( - _aName, - Sequence< TypeClass >(), - TypeDescriptionSearchDepth_ONE ); - } - catch ( NoSuchTypeNameException const & ) - { - } - catch ( InvalidTypeNameException const & ) - { - } - - OSL_ENSURE( xEnum.is(), - "ModuleTypeDescriptionImpl::getMembers - No enumeration!" ); - - std::vector< Reference< XTypeDescription > > aTDs; - while ( xEnum->hasMoreElements() ) - { - try - { - Reference< XTypeDescription > xTD( - xEnum->nextTypeDescription() ); - aTDs.push_back( xTD ); - } - catch ( NoSuchElementException const & ) - { - OSL_FAIL( "ModuleTypeDescriptionImpl::getMembers - " - " Caught NoSuchElementException!" ); - } - } - - Sequence< Reference< XTypeDescription > > * pMembers - = new Sequence< Reference< XTypeDescription > >( aTDs.size() ); - for ( sal_Int32 n = 0; n < pMembers->getLength(); n++ ) - (*pMembers)[ n ] = aTDs[ n ]; - - ClearableMutexGuard aGuard( getMutex() ); - if ( _pMembers ) - { - aGuard.clear(); - delete pMembers; - } - else - { - _pMembers = pMembers; - } - } - return *_pMembers; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdprop.cxx b/stoc/source/registry_tdprovider/tdprop.cxx deleted file mode 100644 index 9f7ff2f4aff0..000000000000 --- a/stoc/source/registry_tdprovider/tdprop.cxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include "base.hxx" - -namespace stoc_rdbtdp -{ - -//__________________________________________________________________________________________________ -// virtual -ConstantTypeDescriptionImpl::~ConstantTypeDescriptionImpl() {} - -// XTypeDescription -//__________________________________________________________________________________________________ -// virtual -TypeClass ConstantTypeDescriptionImpl::getTypeClass() - throw( RuntimeException ) -{ - return TypeClass_CONSTANT; -} -//__________________________________________________________________________________________________ -// virtual -OUString ConstantTypeDescriptionImpl::getName() - throw( RuntimeException ) -{ - return _aName; -} - -// XConstantTypeDescription -//__________________________________________________________________________________________________ -// virtual -Any SAL_CALL ConstantTypeDescriptionImpl::getConstantValue() - throw( RuntimeException ) -{ - return _aValue; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdprovider.cxx b/stoc/source/registry_tdprovider/tdprovider.cxx deleted file mode 100644 index 9a739f0fc303..000000000000 --- a/stoc/source/registry_tdprovider/tdprovider.cxx +++ /dev/null @@ -1,605 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/uno/RuntimeException.hpp" - -#include "registry/reader.hxx" -#include "registry/version.h" -#include "base.hxx" -#include "rdbtdp_tdenumeration.hxx" -#include "structtypedescription.hxx" - -#define SERVICENAME "com.sun.star.reflection.TypeDescriptionProvider" -#define IMPLNAME "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider" - -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::registry; - -namespace stoc_bootstrap -{ -uno::Sequence< OUString > rdbtdp_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(SERVICENAME); - return seqNames; -} - -OUString rdbtdp_getImplementationName() -{ - return OUString(IMPLNAME); -} -} - -namespace stoc_rdbtdp -{ -struct MutexHolder -{ - Mutex _aComponentMutex; -}; -//================================================================================================== -class ProviderImpl - : public MutexHolder - , public WeakComponentImplHelper4< XServiceInfo, - XHierarchicalNameAccess, - XTypeDescriptionEnumerationAccess, - XInitialization > -{ - // XHierarchicalNameAccess + XTypeDescriptionEnumerationAccess wrapper - // first asking the tdmgr instance, then looking up locally - class TypeDescriptionManagerWrapper - : public ::cppu::WeakImplHelper2< - container::XHierarchicalNameAccess, - reflection::XTypeDescriptionEnumerationAccess> - { - com::sun::star::uno::Reference - m_xTDMgr; - com::sun::star::uno::Reference - m_xThisProvider; - public: - TypeDescriptionManagerWrapper( ProviderImpl * pProvider ) - : m_xTDMgr( pProvider->_xContext->getValueByName( - OUString( - "/singletons/com.sun.star.reflection." - "theTypeDescriptionManager" ) ), - UNO_QUERY_THROW ), - m_xThisProvider( pProvider ) - {} - // XHierarchicalNameAccess - virtual Any SAL_CALL getByHierarchicalName( OUString const & name ) - throw (container::NoSuchElementException, RuntimeException); - virtual sal_Bool SAL_CALL hasByHierarchicalName( OUString const & name ) - throw (RuntimeException); - - // XTypeDescriptionEnumerationAccess - virtual uno::Reference< - reflection::XTypeDescriptionEnumeration > SAL_CALL - createTypeDescriptionEnumeration( - const OUString& moduleName, - const uno::Sequence< uno::TypeClass >& types, - reflection::TypeDescriptionSearchDepth depth ) - throw ( reflection::NoSuchTypeNameException, - reflection::InvalidTypeNameException, - uno::RuntimeException ); - }; - friend class TypeDescriptionManagerWrapper; - - com::sun::star::uno::Reference< XComponentContext > _xContext; - com::sun::star::uno::WeakReference _xTDMgr; - com::sun::star::uno::Reference< XHierarchicalNameAccess > getTDMgr() SAL_THROW(()); - - RegistryKeyList _aBaseKeys; - -protected: - virtual void SAL_CALL disposing(); - -public: - ProviderImpl( const com::sun::star::uno::Reference< XComponentContext > & xContext ); - virtual ~ProviderImpl(); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any > & args ) throw (Exception, RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XHierarchicalNameAccess - Any getByHierarchicalNameImpl( const OUString & rName ); - - virtual Any SAL_CALL getByHierarchicalName( const OUString & rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException); - - // XTypeDescriptionEnumerationAccess - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::reflection::XTypeDescriptionEnumeration > SAL_CALL - createTypeDescriptionEnumeration( - const OUString& moduleName, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::TypeClass >& types, - ::com::sun::star::reflection::TypeDescriptionSearchDepth depth ) - throw ( ::com::sun::star::reflection::NoSuchTypeNameException, - ::com::sun::star::reflection::InvalidTypeNameException, - ::com::sun::star::uno::RuntimeException ); -}; -//__________________________________________________________________________________________________ -ProviderImpl::ProviderImpl( const com::sun::star::uno::Reference< XComponentContext > & xContext ) - : WeakComponentImplHelper4< - XServiceInfo, XHierarchicalNameAccess, - XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex ) - , _xContext( xContext ) -{} -//__________________________________________________________________________________________________ -ProviderImpl::~ProviderImpl() {} - -//______________________________________________________________________________ -Any ProviderImpl::TypeDescriptionManagerWrapper::getByHierarchicalName( - OUString const & name ) throw (container::NoSuchElementException, - RuntimeException) -{ - try - { - // first try tdmgr: - return m_xTDMgr->getByHierarchicalName( name ); - } - catch (container::NoSuchElementException &) - { - // then lookup locally: - return m_xThisProvider->getByHierarchicalName( name ); - } -} - -//______________________________________________________________________________ -sal_Bool ProviderImpl::TypeDescriptionManagerWrapper::hasByHierarchicalName( - OUString const & name ) throw (RuntimeException) -{ - return m_xTDMgr->hasByHierarchicalName( name ) || m_xThisProvider->hasByHierarchicalName( name ); -} - -//______________________________________________________________________________ -uno::Reference< reflection::XTypeDescriptionEnumeration > SAL_CALL -ProviderImpl::TypeDescriptionManagerWrapper::createTypeDescriptionEnumeration( - const OUString& moduleName, - const uno::Sequence< uno::TypeClass >& types, - reflection::TypeDescriptionSearchDepth depth ) - throw ( reflection::NoSuchTypeNameException, - reflection::InvalidTypeNameException, - uno::RuntimeException ) -{ - try - { - // first try tdmgr: - uno::Reference< reflection::XTypeDescriptionEnumerationAccess > xTDEA( - m_xTDMgr, uno::UNO_QUERY_THROW ); - return - xTDEA->createTypeDescriptionEnumeration( moduleName, types, depth ); - } - catch (reflection::NoSuchTypeNameException &) - { - // then lookup locally: - uno::Reference< reflection::XTypeDescriptionEnumerationAccess > xTDEA( - m_xThisProvider, uno::UNO_QUERY_THROW ); - return - xTDEA->createTypeDescriptionEnumeration( moduleName, types, depth ); - } -} - -//__________________________________________________________________________________________________ -com::sun::star::uno::Reference< XHierarchicalNameAccess > ProviderImpl::getTDMgr() - SAL_THROW(()) -{ - // harden weak reference: - com::sun::star::uno::Reference xTDMgr( - _xTDMgr ); - if (! xTDMgr.is()) - { - xTDMgr.set( new TypeDescriptionManagerWrapper(this) ); - { - MutexGuard guard( _aComponentMutex ); - _xTDMgr = xTDMgr; - } - } - return xTDMgr; -} - -//__________________________________________________________________________________________________ -void ProviderImpl::disposing() -{ - _xContext.clear(); - - for ( RegistryKeyList::const_iterator iPos( _aBaseKeys.begin() ); - iPos != _aBaseKeys.end(); ++iPos ) - { - (*iPos)->closeKey(); - } - _aBaseKeys.clear(); -} - -// XInitialization -//__________________________________________________________________________________________________ -void ProviderImpl::initialize( - const Sequence< Any > & args ) - throw (Exception, RuntimeException) -{ - // registries to read from - Any const * pRegistries = args.getConstArray(); - for ( sal_Int32 nPos = 0; nPos < args.getLength(); ++nPos ) - { - com::sun::star::uno::Reference< XSimpleRegistry > xRegistry( pRegistries[ nPos ], UNO_QUERY ); - if (xRegistry.is() && xRegistry->isValid()) - { - com::sun::star::uno::Reference< XRegistryKey > xKey( xRegistry->getRootKey()->openKey( - OUString("/UCR") ) ); - if (xKey.is() && xKey->isValid()) - { - _aBaseKeys.push_back( xKey ); - } - } - } -} - -// XServiceInfo -//__________________________________________________________________________________________________ -OUString ProviderImpl::getImplementationName() - throw(::com::sun::star::uno::RuntimeException) -{ - return stoc_bootstrap::rdbtdp_getImplementationName(); -} -//__________________________________________________________________________________________________ -sal_Bool ProviderImpl::supportsService( const OUString & rServiceName ) - throw(::com::sun::star::uno::RuntimeException) -{ - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - { - if (pArray[nPos] == rServiceName) - return sal_True; - } - return sal_False; -} -//__________________________________________________________________________________________________ -Sequence< OUString > ProviderImpl::getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException) -{ - return stoc_bootstrap::rdbtdp_getSupportedServiceNames(); -} - -// XHierarchicalNameAccess -//__________________________________________________________________________________________________ -Any ProviderImpl::getByHierarchicalNameImpl( const OUString & rName ) -{ - Any aRet; - - // read from registry - OUString aKey( rName.replace( '.', '/' ) ); - for ( RegistryKeyList::const_iterator iPos( _aBaseKeys.begin() ); - !aRet.hasValue() && iPos != _aBaseKeys.end(); ++iPos ) - { - try - { - com::sun::star::uno::Reference< XRegistryKey > xBaseKey( *iPos ); - com::sun::star::uno::Reference< XRegistryKey > xKey( xBaseKey->openKey( aKey ) ); - if (xKey.is()) - { - // closes key in it's dtor (which is - // called even in case of exceptions). - RegistryKeyCloser aCloser( xKey ); - - if ( xKey->isValid() ) - { - if (xKey->getValueType() == RegistryValueType_BINARY) - { - Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() ); - com::sun::star::uno::Reference< XTypeDescription > xTD( - createTypeDescription( aBytes, - getTDMgr(), - true ) ); - if ( xTD.is() ) - aRet <<= xTD; - } - } - } - else // might be a constant - { - sal_Int32 nIndex = aKey.lastIndexOf( '/' ); - if (nIndex > 0) - { - // open module - com::sun::star::uno::Reference< XRegistryKey > xKey2( xBaseKey->openKey( aKey.copy( 0, nIndex ) ) ); - if (xKey2.is()) - { - // closes key in it's dtor (which is - // called even in case of exceptions). - RegistryKeyCloser aCloser( xKey2 ); - - if ( xKey2->isValid() ) - { - if (xKey2->getValueType() == RegistryValueType_BINARY) - { - Sequence< sal_Int8 > aBytes( xKey2->getBinaryValue() ); - typereg::Reader aReader( - aBytes.getConstArray(), aBytes.getLength(), - false, TYPEREG_VERSION_1); - - RTTypeClass tc = aReader.getTypeClass(); - if (tc == RT_TYPE_MODULE || - tc == RT_TYPE_CONSTANTS || - tc == RT_TYPE_ENUM) - { - OUString aFieldName( aKey.copy( nIndex+1, aKey.getLength() - nIndex -1 ) ); - sal_Int16 nPos = aReader.getFieldCount(); - while (nPos--) - { - if (aFieldName.equals( - aReader.getFieldName(nPos))) - break; - } - if (nPos >= 0) - { - aRet = getRTValue( - aReader.getFieldValue(nPos)); - if (tc != RT_TYPE_ENUM) - { - aRet = css::uno::makeAny< - css::uno::Reference< - css::reflection::XTypeDescription > >( - new ConstantTypeDescriptionImpl( - rName, aRet)); - } - } - } - } - } - } - } - } - } - catch ( InvalidRegistryException const & ) - { - OSL_FAIL( "ProviderImpl::getByHierarchicalName " - "- Caught InvalidRegistryException!" ); - - // openKey, closeKey, getValueType, getBinaryValue, isValid - - // Don't stop iteration in this case. - } - catch ( NoSuchElementException const & ) - { - } - } - return aRet; -} - -Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName ) - throw(::com::sun::star::uno::RuntimeException, com::sun::star::container::NoSuchElementException) -{ - Any aRet( getByHierarchicalNameImpl( rName ) ); - - if ( !aRet.hasValue() ) - throw NoSuchElementException( - rName, static_cast< cppu::OWeakObject * >( this ) ); - - return aRet; -} - -//__________________________________________________________________________________________________ -sal_Bool ProviderImpl::hasByHierarchicalName( const OUString & rName ) - throw(::com::sun::star::uno::RuntimeException) -{ - return getByHierarchicalNameImpl( rName ).hasValue(); -} - -// XTypeDescriptionEnumerationAccess -//__________________________________________________________________________________________________ -// virtual -com::sun::star::uno::Reference< XTypeDescriptionEnumeration > SAL_CALL -ProviderImpl::createTypeDescriptionEnumeration( - const OUString & moduleName, - const Sequence< TypeClass > & types, - TypeDescriptionSearchDepth depth ) - throw ( NoSuchTypeNameException, - InvalidTypeNameException, - RuntimeException ) -{ - return com::sun::star::uno::Reference< XTypeDescriptionEnumeration >( - TypeDescriptionEnumerationImpl::createInstance( getTDMgr(), - moduleName, - types, - depth, - _aBaseKeys ).get() ); -} - -//__________________________________________________________________________________________________ -// global helper function - -com::sun::star::uno::Reference< XTypeDescription > resolveTypedefs( - com::sun::star::uno::Reference< XTypeDescription > const & type) -{ - com::sun::star::uno::Reference< XTypeDescription > resolved(type); - while (resolved->getTypeClass() == TypeClass_TYPEDEF) { - resolved = com::sun::star::uno::Reference< XIndirectTypeDescription >( - resolved, UNO_QUERY_THROW)->getReferencedType(); - } - return resolved; -} - -com::sun::star::uno::Reference< XTypeDescription > createTypeDescription( - const Sequence< sal_Int8 > & rData, - const com::sun::star::uno::Reference< XHierarchicalNameAccess > & xNameAccess, - bool bReturnEmptyRefForUnknownType ) -{ - typereg::Reader aReader( - rData.getConstArray(), rData.getLength(), false, TYPEREG_VERSION_1); - - OUString aName( aReader.getTypeName().replace( '/', '.' ) ); - - switch (aReader.getTypeClass()) - { - case RT_TYPE_INTERFACE: - { - sal_uInt16 n = aReader.getSuperTypeCount(); - com::sun::star::uno::Sequence< OUString > aBaseTypeNames(n); - for (sal_uInt16 i = 0; i < n; ++i) { - aBaseTypeNames[i] = aReader.getSuperTypeName(i).replace( - '/', '.'); - } - sal_uInt16 n2 = aReader.getReferenceCount(); - com::sun::star::uno::Sequence< OUString > - aOptionalBaseTypeNames(n2); - for (sal_uInt16 i = 0; i < n2; ++i) { - OSL_ASSERT( - aReader.getReferenceSort(i) == RT_REF_SUPPORTS - && aReader.getReferenceFlags(i) == RT_ACCESS_OPTIONAL); - aOptionalBaseTypeNames[i] = aReader.getReferenceTypeName(i); - } - return com::sun::star::uno::Reference< XTypeDescription >( - new InterfaceTypeDescriptionImpl( xNameAccess, - aName, - aBaseTypeNames, - aOptionalBaseTypeNames, - rData, - aReader.isPublished() ) ); - } - - case RT_TYPE_MODULE: - { - com::sun::star::uno::Reference< - XTypeDescriptionEnumerationAccess > xTDEA( - xNameAccess, UNO_QUERY ); - - OSL_ENSURE( xTDEA.is(), - "No XTypeDescriptionEnumerationAccess!" ); - - return com::sun::star::uno::Reference< XTypeDescription >( - new ModuleTypeDescriptionImpl( xTDEA, aName ) ); - } - - case RT_TYPE_STRUCT: - { - OUString superTypeName; - if (aReader.getSuperTypeCount() == 1) { - superTypeName = aReader.getSuperTypeName(0).replace( - '/', '.'); - } - return com::sun::star::uno::Reference< XTypeDescription >( - new stoc::registry_tdprovider::StructTypeDescription( - xNameAccess, aName, superTypeName, rData, - aReader.isPublished())); - } - - case RT_TYPE_ENUM: - return com::sun::star::uno::Reference< XTypeDescription >( - new EnumTypeDescriptionImpl( xNameAccess, - aName, - getRTValueAsInt32( - aReader.getFieldValue( 0 ) ), - rData, aReader.isPublished() ) ); - - case RT_TYPE_EXCEPTION: - { - OUString superTypeName; - if (aReader.getSuperTypeCount() == 1) { - superTypeName = aReader.getSuperTypeName(0).replace( - '/', '.'); - } - return com::sun::star::uno::Reference< XTypeDescription >( - new CompoundTypeDescriptionImpl( - xNameAccess, TypeClass_EXCEPTION, aName, superTypeName, - rData, aReader.isPublished())); - } - - case RT_TYPE_TYPEDEF: - return com::sun::star::uno::Reference< XTypeDescription >( - new TypedefTypeDescriptionImpl( xNameAccess, - aName, - aReader.getSuperTypeName(0) - .replace( '/', '.' ), - aReader.isPublished() ) ); - case RT_TYPE_SERVICE: - return com::sun::star::uno::Reference< XTypeDescription >( - new ServiceTypeDescriptionImpl( - xNameAccess, aName, rData, aReader.isPublished() ) ); - - case RT_TYPE_CONSTANTS: - return com::sun::star::uno::Reference< XTypeDescription >( - new ConstantsTypeDescriptionImpl( - aName, rData, aReader.isPublished() ) ); - - case RT_TYPE_SINGLETON: - return com::sun::star::uno::Reference< XTypeDescription >( - new SingletonTypeDescriptionImpl( xNameAccess, - aName, - aReader.getSuperTypeName(0) - .replace( '/', '.' ), - aReader.isPublished() ) ); - case RT_TYPE_INVALID: - case RT_TYPE_OBJECT: // deprecated and not used - case RT_TYPE_UNION: // deprecated and not used - OSL_FAIL( "createTypeDescription - Unsupported Type!" ); - break; - - default: - OSL_FAIL( "createTypeDescription - Unknown Type!" ); - break; - } - - // Unknown type. - - if ( bReturnEmptyRefForUnknownType ) - return com::sun::star::uno::Reference< XTypeDescription >(); - - return com::sun::star::uno::Reference< XTypeDescription >( - new TypeDescriptionImpl( TypeClass_UNKNOWN, aName ) ); -} - -} - -namespace stoc_bootstrap -{ -//================================================================================================== -com::sun::star::uno::Reference< XInterface > SAL_CALL ProviderImpl_create( - com::sun::star::uno::Reference< XComponentContext > const & xContext ) - throw(::com::sun::star::uno::Exception) -{ - return com::sun::star::uno::Reference< XInterface >( *new stoc_rdbtdp::ProviderImpl( xContext ) ); -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdservice.cxx b/stoc/source/registry_tdprovider/tdservice.cxx deleted file mode 100644 index 509a058db011..000000000000 --- a/stoc/source/registry_tdprovider/tdservice.cxx +++ /dev/null @@ -1,513 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include -#include -#include "com/sun/star/uno/RuntimeException.hpp" - -#include "registry/reader.hxx" -#include "registry/version.h" -#include "base.hxx" -#include "methoddescription.hxx" - -#include - -using namespace com::sun::star; - -namespace { - -class Constructor: - public cppu::WeakImplHelper1< XServiceConstructorDescription > -{ -public: - Constructor( - Reference< XHierarchicalNameAccess > const & manager, - OUString const & name, Sequence< sal_Int8 > const & bytes, - sal_uInt16 index): - m_desc(manager, name, bytes, index) {} - - virtual ~Constructor() {} - - virtual sal_Bool SAL_CALL isDefaultConstructor() throw (RuntimeException) - { return m_desc.getName().isEmpty(); } - - virtual OUString SAL_CALL getName() throw (RuntimeException) - { return m_desc.getName(); } - - virtual Sequence< Reference< XParameter > > SAL_CALL getParameters() - throw (RuntimeException) - { return m_desc.getParameters(); } - - virtual Sequence< Reference > SAL_CALL - getExceptions() throw (RuntimeException) - { return m_desc.getExceptions(); } - -private: - Constructor(Constructor &); // not implemented - void operator =(Constructor); // not implemented - - stoc::registry_tdprovider::MethodDescription m_desc; -}; - -} - -namespace stoc_rdbtdp -{ - -// PropertyTypeDescriptionImpl - -class PropertyTypeDescriptionImpl : public WeakImplHelper1< XPropertyTypeDescription > -{ - OUString _aName; - Reference< XTypeDescription > _xTD; - sal_Int16 _nFlags; - -public: - PropertyTypeDescriptionImpl( const OUString & rName, - const Reference< XTypeDescription > & xTD, - sal_Int16 nFlags ) - : _aName( rName ), _xTD( xTD ), _nFlags( nFlags ) - {} - virtual ~PropertyTypeDescriptionImpl(); - - // XTypeDescription - virtual TypeClass SAL_CALL getTypeClass() - throw( RuntimeException ); - virtual OUString SAL_CALL getName() - throw( RuntimeException ); - - // XPropertyTypeDescription - virtual sal_Int16 SAL_CALL getPropertyFlags() - throw ( RuntimeException ); - virtual Reference< XTypeDescription > SAL_CALL getPropertyTypeDescription() - throw ( RuntimeException ); -}; - -// virtual -PropertyTypeDescriptionImpl::~PropertyTypeDescriptionImpl() {} - -// XTypeDescription - -// virtual -TypeClass PropertyTypeDescriptionImpl::getTypeClass() - throw ( RuntimeException ) -{ - return TypeClass_PROPERTY; -} - -// virtual -OUString PropertyTypeDescriptionImpl::getName() - throw ( RuntimeException ) -{ - return _aName; -} - -// XPropertyTypeDescription - -// virtual -sal_Int16 SAL_CALL PropertyTypeDescriptionImpl::getPropertyFlags() - throw ( RuntimeException ) -{ - return _nFlags; -} - -// virtual -Reference< XTypeDescription > SAL_CALL -PropertyTypeDescriptionImpl::getPropertyTypeDescription() - throw ( RuntimeException ) -{ - return _xTD; -} - -// ServiceTypeDescriptionImpl - -// virtual -ServiceTypeDescriptionImpl::~ServiceTypeDescriptionImpl() {} - -// XTypeDescription - -// virtual -TypeClass ServiceTypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_SERVICE; -} - -// virtual -OUString ServiceTypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -// XServiceTypeDescription - -// virtual -Sequence< Reference< XServiceTypeDescription > > SAL_CALL -ServiceTypeDescriptionImpl::getMandatoryServices() - throw ( RuntimeException ) -{ - getReferences(); - return _aMandatoryServices; -} - -// virtual -Sequence< Reference< XServiceTypeDescription > > SAL_CALL -ServiceTypeDescriptionImpl::getOptionalServices() - throw ( RuntimeException ) -{ - getReferences(); - return _aOptionalServices; -} - -// virtual -Sequence< Reference< XInterfaceTypeDescription > > SAL_CALL -ServiceTypeDescriptionImpl::getMandatoryInterfaces() - throw ( RuntimeException ) -{ - getReferences(); - return _aMandatoryInterfaces; -} - -// virtual -Sequence< Reference< XInterfaceTypeDescription > > SAL_CALL -ServiceTypeDescriptionImpl::getOptionalInterfaces() - throw ( RuntimeException ) -{ - getReferences(); - return _aOptionalInterfaces; -} - -// virtual -Sequence< Reference< XPropertyTypeDescription > > SAL_CALL -ServiceTypeDescriptionImpl::getProperties() - throw ( RuntimeException ) -{ - { - MutexGuard guard(getMutex()); - if (_pProps.get() != 0) { - return *_pProps; - } - } - - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, TYPEREG_VERSION_1); - - sal_uInt16 nFields = (sal_uInt16)aReader.getFieldCount(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - std::auto_ptr< Sequence< Reference< XPropertyTypeDescription > > > - pTempProps( - new Sequence< Reference< XPropertyTypeDescription > >(nFields)); - SAL_WNODEPRECATED_DECLARATIONS_POP - Reference< XPropertyTypeDescription > * pProps = pTempProps->getArray(); - - while ( nFields-- ) - { - // name - OUStringBuffer aName( _aName ); - aName.appendAscii( "." ); - aName.append( aReader.getFieldName( nFields ) ); - - // type description - Reference< XTypeDescription > xTD; - try - { - _xTDMgr->getByHierarchicalName( - aReader.getFieldTypeName( nFields ).replace( '/', '.' ) ) - >>= xTD; - } - catch ( NoSuchElementException const & ) - { - } - OSL_ENSURE( xTD.is(), "### no type description for property!" ); - - // flags - RTFieldAccess nFlags = aReader.getFieldFlags( nFields ); - - sal_Int16 nAttribs = 0; - if ( nFlags & RT_ACCESS_READONLY ) - nAttribs |= beans::PropertyAttribute::READONLY; - if ( nFlags & RT_ACCESS_OPTIONAL ) - nAttribs |= beans::PropertyAttribute::OPTIONAL; - if ( nFlags & RT_ACCESS_MAYBEVOID ) - nAttribs |= beans::PropertyAttribute::MAYBEVOID; - if ( nFlags & RT_ACCESS_BOUND ) - nAttribs |= beans::PropertyAttribute::BOUND; - if ( nFlags & RT_ACCESS_CONSTRAINED ) - nAttribs |= beans::PropertyAttribute::CONSTRAINED; - if ( nFlags & RT_ACCESS_TRANSIENT ) - nAttribs |= beans::PropertyAttribute::TRANSIENT; - if ( nFlags & RT_ACCESS_MAYBEAMBIGUOUS ) - nAttribs |= beans::PropertyAttribute::MAYBEAMBIGUOUS; - if ( nFlags & RT_ACCESS_MAYBEDEFAULT ) - nAttribs |= beans::PropertyAttribute::MAYBEDEFAULT; - if ( nFlags & RT_ACCESS_REMOVABLE ) - nAttribs |= beans::PropertyAttribute::REMOVABLE; - - OSL_ENSURE( !(nFlags & RT_ACCESS_PROPERTY), - "### RT_ACCESS_PROPERTY is unexpected here!" ); - OSL_ENSURE( !(nFlags & RT_ACCESS_ATTRIBUTE), - "### RT_ACCESS_ATTRIBUTE is unexpected here!" ); - OSL_ENSURE( !(nFlags & RT_ACCESS_CONST), - "### RT_ACCESS_CONST is unexpected here!" ); - // always set, unless RT_ACCESS_READONLY is set. - //OSL_ENSURE( !(nFlags & RT_ACCESS_READWRITE), - // "### RT_ACCESS_READWRITE is unexpected here" ); - OSL_ENSURE( !(nFlags & RT_ACCESS_DEFAULT), - "### RT_ACCESS_DEAFAULT is unexpected here" ); - - pProps[ nFields ] - = new PropertyTypeDescriptionImpl( aName.makeStringAndClear(), - xTD, - nAttribs ); - } - - MutexGuard guard(getMutex()); - if (_pProps.get() == 0) { - _pProps = pTempProps; - } - return *_pProps; -} - -sal_Bool ServiceTypeDescriptionImpl::isSingleInterfaceBased() - throw (RuntimeException) -{ - getReferences(); - return _xInterfaceTD.is(); -} - -Reference< XTypeDescription > ServiceTypeDescriptionImpl::getInterface() - throw (RuntimeException) -{ - getReferences(); - return _xInterfaceTD; -} - -Sequence< Reference< XServiceConstructorDescription > > -ServiceTypeDescriptionImpl::getConstructors() throw (RuntimeException) { - MutexGuard guard(getMutex()); - if (_pCtors.get() == 0) { - typereg::Reader reader( - _aBytes.getConstArray(), _aBytes.getLength(), false, - TYPEREG_VERSION_1); - sal_uInt16 ctorCount = reader.getMethodCount(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - std::auto_ptr< Sequence< Reference< XServiceConstructorDescription > > > - ctors( - new Sequence< Reference< XServiceConstructorDescription > >( - ctorCount)); - SAL_WNODEPRECATED_DECLARATIONS_POP - for (sal_uInt16 i = 0; i < ctorCount; ++i) { - OUString name(reader.getMethodName(i)); - if (reader.getMethodFlags(i) != RT_MODE_TWOWAY - || (reader.getMethodReturnTypeName(i) != "void") - || (name.isEmpty() - && (ctorCount != 1 || reader.getMethodParameterCount(i) != 0 - || reader.getMethodExceptionCount(i) != 0))) - { - throw RuntimeException( - OUString("Service has bad constructors"), - static_cast< OWeakObject * >(this)); - } - (*ctors)[i] = new Constructor( - _xTDMgr, reader.getMethodName(i), _aBytes, i); - } - _pCtors = ctors; - } - return *_pCtors; -} - -void ServiceTypeDescriptionImpl::getReferences() - throw ( RuntimeException ) -{ - { - MutexGuard guard(getMutex()); - if (_bInitReferences) { - return; - } - } - typereg::Reader aReader( - _aBytes.getConstArray(), _aBytes.getLength(), false, TYPEREG_VERSION_1); - sal_uInt16 superTypes = aReader.getSuperTypeCount(); - if (superTypes > 1) { - throw RuntimeException( - OUString("Service has more than one supertype"), - static_cast< OWeakObject * >(this)); - } - if (superTypes == 1) { - OUString aBaseName( aReader.getSuperTypeName(0).replace( '/', '.' ) ); - if ( aReader.getReferenceCount() != 0 - || aReader.getFieldCount() != 0 ) - throw RuntimeException( - OUString("Service is single-interface--based but also has" - " references and/or properties" ), - static_cast< OWeakObject * >( this ) ); - Reference< XTypeDescription > ifc; - try - { - _xTDMgr->getByHierarchicalName( aBaseName ) >>= ifc; - } - catch ( NoSuchElementException const & e ) - { - throw RuntimeException( - OUString("com.sun.star.container.NoSuchElementException: " ) - + e.Message, - static_cast< OWeakObject * >( this ) ); - } - OSL_ASSERT(ifc.is()); - if (resolveTypedefs(ifc)->getTypeClass() != TypeClass_INTERFACE) { - throw RuntimeException( - OUString("Single-interface--based service is not based on" - " interface type" ), - static_cast< OWeakObject * >( this ) ); - } - MutexGuard guard(getMutex()); - if (!_bInitReferences) { - _xInterfaceTD = ifc; - _bInitReferences = true; - } - } - else - { - sal_uInt16 nRefs = aReader.getReferenceCount(); - Sequence< Reference< XServiceTypeDescription > > aMandatoryServices( - nRefs); - Sequence< Reference< XServiceTypeDescription > > aOptionalServices( - nRefs); - Sequence< Reference< XInterfaceTypeDescription > > aMandatoryInterfaces( - nRefs); - Sequence< Reference< XInterfaceTypeDescription > > aOptionalInterfaces( - nRefs); - sal_uInt32 nMS = 0; - sal_uInt32 nOS = 0; - sal_uInt32 nMI = 0; - sal_uInt32 nOI = 0; - - for ( sal_uInt16 nPos = 0; nPos < nRefs; ++nPos ) - { - RTReferenceType eType = aReader.getReferenceSort( nPos ); - switch ( eType ) - { - case RT_REF_EXPORTS: // service - { - uno::Any aTypeDesc; - try - { - aTypeDesc = _xTDMgr->getByHierarchicalName( - aReader.getReferenceTypeName( nPos ).replace( - '/', '.' ) ); - } - catch ( NoSuchElementException const & e ) - { - throw RuntimeException( - OUString("com.sun.star.container.NoSuchElementException: " ) - + e.Message, - static_cast< OWeakObject * >( this ) ); - } - - RTFieldAccess nAccess = aReader.getReferenceFlags( nPos ); - if ( nAccess & RT_ACCESS_OPTIONAL ) - { - // optional service - if ( !( aTypeDesc >>= aOptionalServices[ nOS ] ) ) - throw RuntimeException( - OUString("Service 'export' is not a service" ), - static_cast< OWeakObject * >( this ) ); - nOS++; - } - else - { - // mandatory service - if ( !( aTypeDesc >>= aMandatoryServices[ nMS ] ) ) - throw RuntimeException( - OUString("Service 'export' is not a service" ), - static_cast< OWeakObject * >( this ) ); - nMS++; - } - break; - } - case RT_REF_SUPPORTS: // interface - { - uno::Any aTypeDesc; - try - { - aTypeDesc = _xTDMgr->getByHierarchicalName( - aReader.getReferenceTypeName( nPos ).replace( - '/', '.' ) ); - } - catch ( NoSuchElementException const & e ) - { - throw RuntimeException( - OUString("com.sun.star.container.NoSuchElementException: " ) - + e.Message, - static_cast< OWeakObject * >( this ) ); - } - - RTFieldAccess nAccess = aReader.getReferenceFlags( nPos ); - if ( nAccess & RT_ACCESS_OPTIONAL ) - { - // optional interface - if ( !( aTypeDesc >>= aOptionalInterfaces[ nOI ] ) ) - throw RuntimeException( - OUString("Service 'supports' is not an" - " interface" ), - static_cast< OWeakObject * >( this ) ); - nOI++; - } - else - { - // mandatory interface - if ( !( aTypeDesc >>= aMandatoryInterfaces[ nMI ] ) ) - throw RuntimeException( - OUString("Service 'supports' is not an" - " interface" ), - static_cast< OWeakObject * >( this ) ); - nMI++; - } - break; - } - case RT_REF_OBSERVES: - case RT_REF_NEEDS: - break; - default: - OSL_FAIL( "### unsupported reference type!" ); - break; - } - } - aMandatoryServices.realloc( nMS ); - aOptionalServices.realloc( nOS ); - aMandatoryInterfaces.realloc( nMI ); - aOptionalInterfaces.realloc( nOI ); - - MutexGuard guard(getMutex()); - if (!_bInitReferences) { - _aMandatoryServices = aMandatoryServices; - _aOptionalServices = aOptionalServices; - _aMandatoryInterfaces = aMandatoryInterfaces; - _aOptionalInterfaces = aOptionalInterfaces; - _bInitReferences = true; - } - } -} - - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/registry_tdprovider/tdsingleton.cxx b/stoc/source/registry_tdprovider/tdsingleton.cxx deleted file mode 100644 index d91a8c4bb16a..000000000000 --- a/stoc/source/registry_tdprovider/tdsingleton.cxx +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include "base.hxx" - -#include "com/sun/star/uno/RuntimeException.hpp" - -using namespace com::sun::star; - -namespace stoc_rdbtdp -{ - -void SingletonTypeDescriptionImpl::init() { - { - MutexGuard guard(getMutex()); - if (_xInterfaceTD.is() || _xServiceTD.is()) { - return; - } - } - Reference< XTypeDescription > base; - try { - base = Reference< XTypeDescription >( - _xTDMgr->getByHierarchicalName(_aBaseName), UNO_QUERY_THROW); - } catch (NoSuchElementException const & e) { - throw RuntimeException( - (OUString( - "com.sun.star.container.NoSuchElementException: ") - + e.Message), - static_cast< OWeakObject * >(this)); - } - MutexGuard guard(getMutex()); - if (!_xInterfaceTD.is() && !_xServiceTD.is()) { - if (resolveTypedefs(base)->getTypeClass() == TypeClass_INTERFACE) { - _xInterfaceTD = base; - } else if (base->getTypeClass() == TypeClass_SERVICE) { - _xServiceTD = Reference< XServiceTypeDescription >( - base, UNO_QUERY_THROW); - } else { - throw RuntimeException( - OUString( - "Singleton is based on neither interface nor service"), - static_cast< OWeakObject * >(this)); - } - } - OSL_ASSERT(_xInterfaceTD.is() ^ _xServiceTD.is()); -} - -//__________________________________________________________________________________________________ -// virtual -SingletonTypeDescriptionImpl::~SingletonTypeDescriptionImpl() {} - -// XTypeDescription -//__________________________________________________________________________________________________ -// virtual -TypeClass SingletonTypeDescriptionImpl::getTypeClass() - throw(::com::sun::star::uno::RuntimeException) -{ - return TypeClass_SINGLETON; -} -//__________________________________________________________________________________________________ -// virtual -OUString SingletonTypeDescriptionImpl::getName() - throw(::com::sun::star::uno::RuntimeException) -{ - return _aName; -} - -// XSingletonTypeDescription -//__________________________________________________________________________________________________ -// virtual -Reference< XServiceTypeDescription > SAL_CALL -SingletonTypeDescriptionImpl::getService() - throw(::com::sun::star::uno::RuntimeException) -{ - init(); - return _xServiceTD; -} - -// XSingletonTypeDescription2 -//______________________________________________________________________________ -// virtual -sal_Bool SAL_CALL -SingletonTypeDescriptionImpl::isInterfaceBased() - throw(::com::sun::star::uno::RuntimeException) -{ - init(); - return _xInterfaceTD.is(); -} - -//______________________________________________________________________________ -// virtual -Reference< XTypeDescription > SAL_CALL -SingletonTypeDescriptionImpl::getInterface() - throw(::com::sun::star::uno::RuntimeException) -{ - init(); - return _xInterfaceTD; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component index a1f78591a1f1..f61c85aafead 100644 --- a/stoc/util/bootstrap.component +++ b/stoc/util/bootstrap.component @@ -35,8 +35,6 @@ - -- cgit v1.2.3