update dev300-m58
[ooovba.git] / cppu / inc / uno / dispatcher.hxx
blobf75514f18fb9551d77607c17fc83bf0bead82b4b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dispatcher.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #if ! defined INCLUDED_UNO_DISPATCHER_HXX
32 #define INCLUDED_UNO_DISPATCHER_HXX
34 #include "uno/dispatcher.h"
37 namespace com
39 namespace sun
41 namespace star
43 namespace uno
46 /** C++ holder reference for binary C uno_Interface. Not for public use, may be
47 subject to changes.
49 @see uno_Interface
50 @internal
51 not for public use!
53 class UnoInterfaceReference
55 public:
56 uno_Interface * m_pUnoI;
58 inline bool is() const
59 { return m_pUnoI != 0; }
61 inline ~UnoInterfaceReference();
62 inline UnoInterfaceReference();
63 inline UnoInterfaceReference( uno_Interface * pUnoI, __sal_NoAcquire );
64 inline UnoInterfaceReference( uno_Interface * pUnoI );
65 inline UnoInterfaceReference( UnoInterfaceReference const & ref );
67 inline uno_Interface * get() const
68 { return m_pUnoI; }
70 inline UnoInterfaceReference & set(
71 uno_Interface * pUnoI );
72 inline UnoInterfaceReference & set(
73 uno_Interface * pUnoI, __sal_NoAcquire );
74 inline void clear();
76 inline UnoInterfaceReference & operator = (
77 UnoInterfaceReference const & ref )
78 { return set( ref.m_pUnoI ); }
79 inline UnoInterfaceReference & operator = (
80 uno_Interface * pUnoI )
81 { return set( pUnoI ); }
83 inline void dispatch(
84 struct _typelib_TypeDescription const * pMemberType,
85 void * pReturn, void * pArgs [], uno_Any ** ppException ) const;
87 private:
88 inline bool operator == ( UnoInterfaceReference const & ); // not impl
89 inline bool operator != ( UnoInterfaceReference const & ); // not impl
90 inline bool operator == ( uno_Interface * ); // not impl
91 inline bool operator != ( uno_Interface * ); // not impl
94 //______________________________________________________________________________
95 inline UnoInterfaceReference::~UnoInterfaceReference()
97 if (m_pUnoI != 0)
98 (*m_pUnoI->release)( m_pUnoI );
101 //______________________________________________________________________________
102 inline UnoInterfaceReference::UnoInterfaceReference()
103 : m_pUnoI( 0 )
107 //______________________________________________________________________________
108 inline UnoInterfaceReference::UnoInterfaceReference(
109 uno_Interface * pUnoI, __sal_NoAcquire )
110 : m_pUnoI( pUnoI )
114 //______________________________________________________________________________
115 inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI )
116 : m_pUnoI( pUnoI )
118 if (m_pUnoI != 0)
119 (*m_pUnoI->acquire)( m_pUnoI );
122 //______________________________________________________________________________
123 inline UnoInterfaceReference::UnoInterfaceReference(
124 UnoInterfaceReference const & ref )
125 : m_pUnoI( ref.m_pUnoI )
127 if (m_pUnoI != 0)
128 (*m_pUnoI->acquire)( m_pUnoI );
131 //______________________________________________________________________________
132 inline UnoInterfaceReference & UnoInterfaceReference::set(
133 uno_Interface * pUnoI )
135 if (pUnoI != 0)
136 (*pUnoI->acquire)( pUnoI );
137 if (m_pUnoI != 0)
138 (*m_pUnoI->release)( m_pUnoI );
139 m_pUnoI = pUnoI;
140 return *this;
143 //______________________________________________________________________________
144 inline UnoInterfaceReference & UnoInterfaceReference::set(
145 uno_Interface * pUnoI, __sal_NoAcquire )
147 if (m_pUnoI != 0)
148 (*m_pUnoI->release)( m_pUnoI );
149 m_pUnoI = pUnoI;
150 return *this;
153 //______________________________________________________________________________
154 inline void UnoInterfaceReference::clear()
156 if (m_pUnoI != 0)
158 (*m_pUnoI->release)( m_pUnoI );
159 m_pUnoI = 0;
163 //______________________________________________________________________________
164 inline void UnoInterfaceReference::dispatch(
165 struct _typelib_TypeDescription const * pMemberType,
166 void * pReturn, void * pArgs [], uno_Any ** ppException ) const
168 (*m_pUnoI->pDispatcher)(
169 m_pUnoI, pMemberType, pReturn, pArgs, ppException );
177 #endif