Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / uno / dispatcher.hxx
blobd8d5189b14ec730f564cbd49cb50178e6110056d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UNO_DISPATCHER_HXX
21 #define INCLUDED_UNO_DISPATCHER_HXX
23 #include <sal/config.h>
25 #include <cstddef>
27 #include <uno/dispatcher.h>
29 /// @cond INTERNAL
31 namespace com
33 namespace sun
35 namespace star
37 namespace uno
40 /** C++ holder reference for binary C uno_Interface. Not for public use, may be
41 subject to changes.
43 @see uno_Interface
44 @attention
45 not for public use!
47 class UnoInterfaceReference
49 public:
50 uno_Interface * m_pUnoI;
52 inline bool is() const
53 { return m_pUnoI != NULL; }
55 inline ~UnoInterfaceReference();
56 inline UnoInterfaceReference();
57 inline UnoInterfaceReference( uno_Interface * pUnoI, __sal_NoAcquire );
58 inline UnoInterfaceReference( uno_Interface * pUnoI );
59 inline UnoInterfaceReference( UnoInterfaceReference const & ref );
61 inline uno_Interface * get() const
62 { return m_pUnoI; }
64 inline UnoInterfaceReference & set(
65 uno_Interface * pUnoI );
66 inline UnoInterfaceReference & set(
67 uno_Interface * pUnoI, __sal_NoAcquire );
68 inline void clear();
70 inline UnoInterfaceReference & operator = (
71 UnoInterfaceReference const & ref )
72 { return set( ref.m_pUnoI ); }
73 inline UnoInterfaceReference & operator = (
74 uno_Interface * pUnoI )
75 { return set( pUnoI ); }
77 inline void dispatch(
78 struct _typelib_TypeDescription const * pMemberType,
79 void * pReturn, void * pArgs [], uno_Any ** ppException ) const;
81 private:
82 inline bool operator == ( UnoInterfaceReference const & ); // not impl
83 inline bool operator != ( UnoInterfaceReference const & ); // not impl
84 inline bool operator == ( uno_Interface * ); // not impl
85 inline bool operator != ( uno_Interface * ); // not impl
89 inline UnoInterfaceReference::~UnoInterfaceReference()
91 if (m_pUnoI != NULL)
92 (*m_pUnoI->release)( m_pUnoI );
96 inline UnoInterfaceReference::UnoInterfaceReference()
97 : m_pUnoI( NULL )
102 inline UnoInterfaceReference::UnoInterfaceReference(
103 uno_Interface * pUnoI, __sal_NoAcquire )
104 : m_pUnoI( pUnoI )
109 inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI )
110 : m_pUnoI( pUnoI )
112 if (m_pUnoI != NULL)
113 (*m_pUnoI->acquire)( m_pUnoI );
117 inline UnoInterfaceReference::UnoInterfaceReference(
118 UnoInterfaceReference const & ref )
119 : m_pUnoI( ref.m_pUnoI )
121 if (m_pUnoI != NULL)
122 (*m_pUnoI->acquire)( m_pUnoI );
126 inline UnoInterfaceReference & UnoInterfaceReference::set(
127 uno_Interface * pUnoI )
129 if (pUnoI != NULL)
130 (*pUnoI->acquire)( pUnoI );
131 if (m_pUnoI != NULL)
132 (*m_pUnoI->release)( m_pUnoI );
133 m_pUnoI = pUnoI;
134 return *this;
138 inline UnoInterfaceReference & UnoInterfaceReference::set(
139 uno_Interface * pUnoI, __sal_NoAcquire )
141 if (m_pUnoI != NULL)
142 (*m_pUnoI->release)( m_pUnoI );
143 m_pUnoI = pUnoI;
144 return *this;
148 inline void UnoInterfaceReference::clear()
150 if (m_pUnoI != NULL)
152 (*m_pUnoI->release)( m_pUnoI );
153 m_pUnoI = NULL;
158 inline void UnoInterfaceReference::dispatch(
159 struct _typelib_TypeDescription const * pMemberType,
160 void * pReturn, void * pArgs [], uno_Any ** ppException ) const
162 (*m_pUnoI->pDispatcher)(
163 m_pUnoI, pMemberType, pReturn, pArgs, ppException );
171 /// @endcond
173 #endif
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */