Files
libreoffice/cppuhelper/inc/cppuhelper/compbase2.hxx
Jens-Heiner Rechtien dfab298b5a INTEGRATION: CWS ooo11rc2 (1.7.16); FILE MERGED
2003/07/14 15:18:45 fa 1.7.16.1: Conditionalize OS X + gcc 2.95 hacks for gcc 2.95 only.

http://www.openoffice.org/project/www/issues/show_bug.cgi?id=16611

Dan
fa@ooo
2003-07-16 16:48:48 +00:00

188 lines
9.2 KiB
C++

/*************************************************************************
*
* $RCSfile: compbase2.hxx,v $
*
* $Revision: 1.8 $
*
* last change: $Author: hr $ $Date: 2003-07-16 17:48:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CPPUHELPER_COMPBASE2_HXX_
#define _CPPUHELPER_COMPBASE2_HXX_
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
#if defined( MACOSX ) && ( __GNUC__ < 3 )
/* use old impl helpers for macosx */
#ifndef _CPPUHELPER_COMPBASE_HXX_
#include <cppuhelper/compbase.hxx>
#endif
__DEF_COMPIMPLHELPER( 2 )
#else /* ! MACOSX */
#ifndef _CPPUHELPER_COMPBASE_EX_HXX_
#include <cppuhelper/compbase_ex.hxx>
#endif
/*
__DEF_COMPIMPLHELPER_EX( 2 )
*/
namespace cppu
{
/** Implementation helper supporting ::com::sun::star::lang::XTypeProvider and
::com::sun::star::lang::XComponent. Upon disposing objects of this class, sub-classes
receive a disposing() call. Objects of this class can be held weakly, i.e. by a
::com::sun::star::uno::WeakReference.
@attention
The life-cycle of the passed mutex reference has to be longer than objects of this class.
@derive
Inherit from this class giving your interface(s) to be implemented as template argument(s).
Your sub class defines method implementations for these interface(s).
*/
template< class Ifc1, class Ifc2 >
class SAL_NO_VTABLE WeakComponentImplHelper2
: public WeakComponentImplHelperBase
, public ::com::sun::star::lang::XTypeProvider
, public Ifc1, public Ifc2
{
/** @internal */
static class_data2 s_cd;
public:
inline WeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
: WeakComponentImplHelperBase( rMutex )
{}
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
{ return WeakComponentImplHelper_query( rType, (class_data *)&s_cd, this, (WeakComponentImplHelperBase *)this ); }
virtual void SAL_CALL acquire() throw ()
{ WeakComponentImplHelperBase::acquire(); }
virtual void SAL_CALL release() throw ()
{ WeakComponentImplHelperBase::release(); }
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
{ return WeakComponentImplHelper_getTypes( (class_data *)&s_cd ); }
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
{ return ImplHelper_getImplementationId( (class_data *)&s_cd ); }
};
template< class Ifc1, class Ifc2 >
class_data2 WeakComponentImplHelper2< Ifc1, Ifc2 >::s_cd =
{
2 +1, sal_False, sal_False,
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{
{ (::cppu::fptr_getCppuType)(::com::sun::star::uno::Type const & (SAL_CALL *)( ::com::sun::star::uno::Reference< Ifc1 > const * ))&getCppuType, ((sal_Int32)(Ifc1 *) (WeakComponentImplHelper2< Ifc1, Ifc2 > *) 16) - 16 },
{ (::cppu::fptr_getCppuType)(::com::sun::star::uno::Type const & (SAL_CALL *)( ::com::sun::star::uno::Reference< Ifc2 > const * ))&getCppuType, ((sal_Int32)(Ifc2 *) (WeakComponentImplHelper2< Ifc1, Ifc2 > *) 16) - 16 },
{ (::cppu::fptr_getCppuType)(::com::sun::star::uno::Type const & (SAL_CALL *)( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > const * ))&getCppuType, ((sal_Int32)(::com::sun::star::lang::XTypeProvider *) (WeakComponentImplHelper2< Ifc1, Ifc2 > *) 16) - 16 }
}
};
/** Implementation helper supporting ::com::sun::star::lang::XTypeProvider and
::com::sun::star::lang::XComponent. Upon disposing objects of this class, sub-classes
receive a disposing() call. Objects of this class can be held weakly, i.e. by a
::com::sun::star::uno::WeakReference. Object of this class can be aggregated, i.e.
incoming queryInterface() calls are delegated.
@attention
The life-cycle of the passed mutex reference has to be longer than objects of this class.
@derive
Inherit from this class giving your interface(s) to be implemented as template argument(s).
Your sub class defines method implementations for these interface(s).
*/
template< class Ifc1, class Ifc2 >
class SAL_NO_VTABLE WeakAggComponentImplHelper2
: public WeakAggComponentImplHelperBase
, public ::com::sun::star::lang::XTypeProvider
, public Ifc1, public Ifc2
{
/** @internal */
static class_data2 s_cd;
public:
inline WeakAggComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
: WeakAggComponentImplHelperBase( rMutex )
{}
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
{ return WeakAggComponentImplHelperBase::queryInterface( rType ); }
virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
{ return WeakAggComponentImplHelper_queryAgg( rType, (class_data *)&s_cd, this, (WeakAggComponentImplHelperBase *)this ); }
virtual void SAL_CALL acquire() throw ()
{ WeakAggComponentImplHelperBase::acquire(); }
virtual void SAL_CALL release() throw ()
{ WeakAggComponentImplHelperBase::release(); }
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
{ return WeakAggComponentImplHelper_getTypes( (class_data *)&s_cd ); }
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
{ return ImplHelper_getImplementationId( (class_data *)&s_cd ); }
};
template< class Ifc1, class Ifc2 >
class_data2 WeakAggComponentImplHelper2< Ifc1, Ifc2 >::s_cd =
{
2 +1, sal_False, sal_False,
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{
{ (::cppu::fptr_getCppuType)(::com::sun::star::uno::Type const & (SAL_CALL *)( ::com::sun::star::uno::Reference< Ifc1 > const * ))&getCppuType, ((sal_Int32)(Ifc1 *) (WeakAggComponentImplHelper2< Ifc1, Ifc2 > *) 16) - 16 },
{ (::cppu::fptr_getCppuType)(::com::sun::star::uno::Type const & (SAL_CALL *)( ::com::sun::star::uno::Reference< Ifc2 > const * ))&getCppuType, ((sal_Int32)(Ifc2 *) (WeakAggComponentImplHelper2< Ifc1, Ifc2 > *) 16) - 16 },
{ (::cppu::fptr_getCppuType)(::com::sun::star::uno::Type const & (SAL_CALL *)( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > const * ))&getCppuType, ((sal_Int32)(::com::sun::star::lang::XTypeProvider *) (WeakAggComponentImplHelper2< Ifc1, Ifc2 > *) 16) - 16 }
}
};
}
#endif /* MACOSX */
#endif