Files
libreoffice/include/cppuhelper/typeprovider.hxx

222 lines
10 KiB
C++
Raw Normal View History

/* -*- 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_CPPUHELPER_TYPEPROVIDER_HXX
#define INCLUDED_CPPUHELPER_TYPEPROVIDER_HXX
2000-09-18 14:29:57 +00:00
#include <rtl/alloc.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/cppuhelperdllapi.h>
2000-09-18 14:29:57 +00:00
namespace cppu
{
/** Helper class to implement com::sun::star::lang::XTypeProvider. Construct a static object
2001-11-09 12:49:16 +00:00
of this class with your UNO object's supported types.
*/
class CPPUHELPER_DLLPUBLIC OTypeCollection
2000-09-18 14:29:57 +00:00
{
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > _aTypes;
public:
/// @cond INTERNAL
// these are here to force memory de/allocation to sal lib.
inline static void * SAL_CALL operator new( size_t nSize )
{ return ::rtl_allocateMemory( nSize ); }
inline static void SAL_CALL operator delete( void * pMem )
{ ::rtl_freeMemory( pMem ); }
inline static void * SAL_CALL operator new( size_t, void * pMem )
{ return pMem; }
inline static void SAL_CALL operator delete( void *, void * )
{}
/// @endcond
2001-11-09 12:49:16 +00:00
inline OTypeCollection( const OTypeCollection & rCollection )
2000-09-18 14:29:57 +00:00
: _aTypes( rCollection._aTypes )
{}
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Type & rType7,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Type & rType7,
const ::com::sun::star::uno::Type & rType8,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Type & rType7,
const ::com::sun::star::uno::Type & rType8,
const ::com::sun::star::uno::Type & rType9,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Type & rType7,
const ::com::sun::star::uno::Type & rType8,
const ::com::sun::star::uno::Type & rType9,
const ::com::sun::star::uno::Type & rType10,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Type & rType7,
const ::com::sun::star::uno::Type & rType8,
const ::com::sun::star::uno::Type & rType9,
const ::com::sun::star::uno::Type & rType10,
const ::com::sun::star::uno::Type & rType11,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
OTypeCollection(
const ::com::sun::star::uno::Type & rType1,
const ::com::sun::star::uno::Type & rType2,
const ::com::sun::star::uno::Type & rType3,
const ::com::sun::star::uno::Type & rType4,
const ::com::sun::star::uno::Type & rType5,
const ::com::sun::star::uno::Type & rType6,
const ::com::sun::star::uno::Type & rType7,
const ::com::sun::star::uno::Type & rType8,
const ::com::sun::star::uno::Type & rType9,
const ::com::sun::star::uno::Type & rType10,
const ::com::sun::star::uno::Type & rType11,
const ::com::sun::star::uno::Type & rType12,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
2000-09-18 14:29:57 +00:00
2001-11-09 12:49:16 +00:00
/** Called upon XTypeProvider::getTypes().
@return type collection
*/
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
2000-09-18 14:29:57 +00:00
{ return _aTypes; }
};
/** Helper class to implement IDs for XUnoTunnel. Construct a static object
2001-11-09 12:49:16 +00:00
of this class for your UNO object's implementation id.
*/
class CPPUHELPER_DLLPUBLIC OImplementationId
2000-09-18 14:29:57 +00:00
{
mutable ::com::sun::star::uno::Sequence< sal_Int8 > * _pSeq;
sal_Bool _bUseEthernetAddress;
public:
/// @cond INTERNAL
2000-09-18 14:29:57 +00:00
// these are here to force memory de/allocation to sal lib.
inline static void * SAL_CALL operator new( size_t nSize )
2000-09-18 14:29:57 +00:00
{ return ::rtl_allocateMemory( nSize ); }
inline static void SAL_CALL operator delete( void * pMem )
2000-09-18 14:29:57 +00:00
{ ::rtl_freeMemory( pMem ); }
inline static void * SAL_CALL operator new( size_t, void * pMem )
{ return pMem; }
inline static void SAL_CALL operator delete( void *, void * )
{}
2000-09-18 14:29:57 +00:00
~OImplementationId();
/// @endcond
2001-11-09 12:49:16 +00:00
/** Constructor.
@param bUseEthernetAddress whether an ethernet mac address should be taken into account
*/
inline OImplementationId( bool bUseEthernetAddress = true )
2000-09-18 14:29:57 +00:00
: _pSeq( 0 )
, _bUseEthernetAddress( bUseEthernetAddress )
{}
2001-11-09 12:49:16 +00:00
/** Constructor giving implementation id.
@param rSeq implementation id
*/
inline OImplementationId( const ::com::sun::star::uno::Sequence< sal_Int8 > & rSeq )
2000-09-18 14:29:57 +00:00
: _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rSeq ) )
, _bUseEthernetAddress( false )
2000-09-18 14:29:57 +00:00
{}
inline OImplementationId( const OImplementationId & rId )
2000-09-18 14:29:57 +00:00
: _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
, _bUseEthernetAddress( false )
2000-09-18 14:29:57 +00:00
{}
/** Get implementation id.
2001-11-09 12:49:16 +00:00
@return implementation id
*/
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() const;
2000-09-18 14:29:57 +00:00
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */