Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / cppu / inc / uno / dispatcher.hxx
blobc6573354729f4d04974c5143037e19c791c98fa5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #if ! defined INCLUDED_UNO_DISPATCHER_HXX
30 #define INCLUDED_UNO_DISPATCHER_HXX
32 #include "uno/dispatcher.h"
34 /// @cond INTERNAL
36 namespace com
38 namespace sun
40 namespace star
42 namespace uno
45 /** C++ holder reference for binary C uno_Interface. Not for public use, may be
46 subject to changes.
48 @see uno_Interface
49 @attention
50 not for public use!
52 class UnoInterfaceReference
54 public:
55 uno_Interface * m_pUnoI;
57 inline bool is() const
58 { return m_pUnoI != 0; }
60 inline ~UnoInterfaceReference();
61 inline UnoInterfaceReference();
62 inline UnoInterfaceReference( uno_Interface * pUnoI, __sal_NoAcquire );
63 inline UnoInterfaceReference( uno_Interface * pUnoI );
64 inline UnoInterfaceReference( UnoInterfaceReference const & ref );
66 inline uno_Interface * get() const
67 { return m_pUnoI; }
69 inline UnoInterfaceReference & set(
70 uno_Interface * pUnoI );
71 inline UnoInterfaceReference & set(
72 uno_Interface * pUnoI, __sal_NoAcquire );
73 inline void clear();
75 inline UnoInterfaceReference & operator = (
76 UnoInterfaceReference const & ref )
77 { return set( ref.m_pUnoI ); }
78 inline UnoInterfaceReference & operator = (
79 uno_Interface * pUnoI )
80 { return set( pUnoI ); }
82 inline void dispatch(
83 struct _typelib_TypeDescription const * pMemberType,
84 void * pReturn, void * pArgs [], uno_Any ** ppException ) const;
86 private:
87 inline bool operator == ( UnoInterfaceReference const & ); // not impl
88 inline bool operator != ( UnoInterfaceReference const & ); // not impl
89 inline bool operator == ( uno_Interface * ); // not impl
90 inline bool operator != ( uno_Interface * ); // not impl
93 //______________________________________________________________________________
94 inline UnoInterfaceReference::~UnoInterfaceReference()
96 if (m_pUnoI != 0)
97 (*m_pUnoI->release)( m_pUnoI );
100 //______________________________________________________________________________
101 inline UnoInterfaceReference::UnoInterfaceReference()
102 : m_pUnoI( 0 )
106 //______________________________________________________________________________
107 inline UnoInterfaceReference::UnoInterfaceReference(
108 uno_Interface * pUnoI, __sal_NoAcquire )
109 : m_pUnoI( pUnoI )
113 //______________________________________________________________________________
114 inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI )
115 : m_pUnoI( pUnoI )
117 if (m_pUnoI != 0)
118 (*m_pUnoI->acquire)( m_pUnoI );
121 //______________________________________________________________________________
122 inline UnoInterfaceReference::UnoInterfaceReference(
123 UnoInterfaceReference const & ref )
124 : m_pUnoI( ref.m_pUnoI )
126 if (m_pUnoI != 0)
127 (*m_pUnoI->acquire)( m_pUnoI );
130 //______________________________________________________________________________
131 inline UnoInterfaceReference & UnoInterfaceReference::set(
132 uno_Interface * pUnoI )
134 if (pUnoI != 0)
135 (*pUnoI->acquire)( pUnoI );
136 if (m_pUnoI != 0)
137 (*m_pUnoI->release)( m_pUnoI );
138 m_pUnoI = pUnoI;
139 return *this;
142 //______________________________________________________________________________
143 inline UnoInterfaceReference & UnoInterfaceReference::set(
144 uno_Interface * pUnoI, __sal_NoAcquire )
146 if (m_pUnoI != 0)
147 (*m_pUnoI->release)( m_pUnoI );
148 m_pUnoI = pUnoI;
149 return *this;
152 //______________________________________________________________________________
153 inline void UnoInterfaceReference::clear()
155 if (m_pUnoI != 0)
157 (*m_pUnoI->release)( m_pUnoI );
158 m_pUnoI = 0;
162 //______________________________________________________________________________
163 inline void UnoInterfaceReference::dispatch(
164 struct _typelib_TypeDescription const * pMemberType,
165 void * pReturn, void * pArgs [], uno_Any ** ppException ) const
167 (*m_pUnoI->pDispatcher)(
168 m_pUnoI, pMemberType, pReturn, pArgs, ppException );
176 /// @endcond
178 #endif
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */