1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 * This file is part of LibreOffice published API.
24 #ifndef INCLUDED_UNO_DISPATCHER_HXX
25 #define INCLUDED_UNO_DISPATCHER_HXX
27 #include "sal/config.h"
31 #include "uno/dispatcher.h"
44 /** C++ holder reference for binary C uno_Interface. Not for public use, may be
51 class UnoInterfaceReference
54 uno_Interface
* m_pUnoI
;
57 { return m_pUnoI
!= NULL
; }
59 inline ~UnoInterfaceReference();
60 inline UnoInterfaceReference();
61 inline UnoInterfaceReference( uno_Interface
* pUnoI
, __sal_NoAcquire
);
62 inline UnoInterfaceReference( uno_Interface
* pUnoI
);
63 inline UnoInterfaceReference( UnoInterfaceReference
const & ref
);
65 #if defined LIBO_INTERNAL_ONLY
66 UnoInterfaceReference(UnoInterfaceReference
&& other
) noexcept
:
67 m_pUnoI(other
.m_pUnoI
)
68 { other
.m_pUnoI
= nullptr; }
71 uno_Interface
* get() const
74 inline UnoInterfaceReference
& set(
75 uno_Interface
* pUnoI
);
76 inline UnoInterfaceReference
& set(
77 uno_Interface
* pUnoI
, __sal_NoAcquire
);
80 UnoInterfaceReference
& operator = (
81 UnoInterfaceReference
const & ref
)
82 { return set( ref
.m_pUnoI
); }
83 UnoInterfaceReference
& operator = (
84 uno_Interface
* pUnoI
)
85 { return set( pUnoI
); }
87 #if defined LIBO_INTERNAL_ONLY
88 UnoInterfaceReference
& operator =(UnoInterfaceReference
&& other
) {
89 if (m_pUnoI
!= nullptr) {
90 (*m_pUnoI
->release
)(m_pUnoI
);
92 m_pUnoI
= other
.m_pUnoI
;
93 other
.m_pUnoI
= nullptr;
99 struct _typelib_TypeDescription
const * pMemberType
,
100 void * pReturn
, void * pArgs
[], uno_Any
** ppException
) const;
104 inline UnoInterfaceReference::~UnoInterfaceReference()
107 (*m_pUnoI
->release
)( m_pUnoI
);
111 inline UnoInterfaceReference::UnoInterfaceReference()
117 inline UnoInterfaceReference::UnoInterfaceReference(
118 uno_Interface
* pUnoI
, __sal_NoAcquire
)
124 inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface
* pUnoI
)
128 (*m_pUnoI
->acquire
)( m_pUnoI
);
132 inline UnoInterfaceReference::UnoInterfaceReference(
133 UnoInterfaceReference
const & ref
)
134 : m_pUnoI( ref
.m_pUnoI
)
137 (*m_pUnoI
->acquire
)( m_pUnoI
);
141 inline UnoInterfaceReference
& UnoInterfaceReference::set(
142 uno_Interface
* pUnoI
)
145 (*pUnoI
->acquire
)( pUnoI
);
147 (*m_pUnoI
->release
)( m_pUnoI
);
153 inline UnoInterfaceReference
& UnoInterfaceReference::set(
154 uno_Interface
* pUnoI
, __sal_NoAcquire
)
157 (*m_pUnoI
->release
)( m_pUnoI
);
163 inline void UnoInterfaceReference::clear()
167 (*m_pUnoI
->release
)( m_pUnoI
);
173 inline void UnoInterfaceReference::dispatch(
174 struct _typelib_TypeDescription
const * pMemberType
,
175 void * pReturn
, void * pArgs
[], uno_Any
** ppException
) const
177 (*m_pUnoI
->pDispatcher
)(
178 m_pUnoI
, pMemberType
, pReturn
, pArgs
, ppException
);
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */