Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/uno/dispatcher.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
20
/*
21
 * This file is part of LibreOffice published API.
22
 */
23
24
#ifndef INCLUDED_UNO_DISPATCHER_HXX
25
#define INCLUDED_UNO_DISPATCHER_HXX
26
27
#include "sal/config.h"
28
29
#include <cstddef>
30
31
#include "uno/dispatcher.h"
32
33
/// @cond INTERNAL
34
35
namespace com
36
{
37
namespace sun
38
{
39
namespace star
40
{
41
namespace uno
42
{
43
44
/** C++ holder reference for binary C uno_Interface.  Not for public use, may be
45
    subject to changes.
46
47
    @see uno_Interface
48
    @attention
49
              not for public use!
50
*/
51
class UnoInterfaceReference
52
{
53
public:
54
    uno_Interface * m_pUnoI;
55
56
    bool is() const
57
0
        { return m_pUnoI != NULL; }
58
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 );
64
65
#if defined LIBO_INTERNAL_ONLY
66
    UnoInterfaceReference(UnoInterfaceReference && other) noexcept :
67
        m_pUnoI(other.m_pUnoI)
68
0
    { other.m_pUnoI = nullptr; }
69
#endif
70
71
    uno_Interface * get() const
72
0
        { return m_pUnoI; }
73
74
    inline UnoInterfaceReference & set(
75
        uno_Interface * pUnoI );
76
    inline UnoInterfaceReference & set(
77
        uno_Interface * pUnoI, __sal_NoAcquire );
78
    inline void clear();
79
80
    UnoInterfaceReference & operator = (
81
        UnoInterfaceReference const & ref )
82
0
        { return set( ref.m_pUnoI ); }
83
    UnoInterfaceReference & operator = (
84
        uno_Interface * pUnoI )
85
0
        { return set( pUnoI ); }
86
87
#if defined LIBO_INTERNAL_ONLY
88
0
    UnoInterfaceReference & operator =(UnoInterfaceReference && other) {
89
0
        if (m_pUnoI != nullptr) {
90
0
            (*m_pUnoI->release)(m_pUnoI);
91
0
        }
92
0
        m_pUnoI = other.m_pUnoI;
93
0
        other.m_pUnoI = nullptr;
94
0
        return *this;
95
0
    }
96
#endif
97
98
    inline void dispatch(
99
        struct _typelib_TypeDescription const * pMemberType,
100
        void * pReturn, void * pArgs [], uno_Any ** ppException ) const;
101
};
102
103
104
inline UnoInterfaceReference::~UnoInterfaceReference()
105
58.0k
{
106
58.0k
    if (m_pUnoI != NULL)
107
58.0k
        (*m_pUnoI->release)( m_pUnoI );
108
58.0k
}
109
110
111
inline UnoInterfaceReference::UnoInterfaceReference()
112
58.0k
    : m_pUnoI( NULL )
113
58.0k
{
114
58.0k
}
115
116
117
inline UnoInterfaceReference::UnoInterfaceReference(
118
    uno_Interface * pUnoI, __sal_NoAcquire )
119
0
    : m_pUnoI( pUnoI )
120
0
{
121
0
}
122
123
124
inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI )
125
    : m_pUnoI( pUnoI )
126
{
127
    if (m_pUnoI != NULL)
128
        (*m_pUnoI->acquire)( m_pUnoI );
129
}
130
131
132
inline UnoInterfaceReference::UnoInterfaceReference(
133
    UnoInterfaceReference const & ref )
134
    : m_pUnoI( ref.m_pUnoI )
135
{
136
    if (m_pUnoI != NULL)
137
        (*m_pUnoI->acquire)( m_pUnoI );
138
}
139
140
141
inline UnoInterfaceReference & UnoInterfaceReference::set(
142
    uno_Interface * pUnoI )
143
0
{
144
0
    if (pUnoI != NULL)
145
0
        (*pUnoI->acquire)( pUnoI );
146
0
    if (m_pUnoI != NULL)
147
0
        (*m_pUnoI->release)( m_pUnoI );
148
0
    m_pUnoI = pUnoI;
149
0
    return *this;
150
0
}
151
152
153
inline UnoInterfaceReference & UnoInterfaceReference::set(
154
    uno_Interface * pUnoI, __sal_NoAcquire )
155
0
{
156
0
    if (m_pUnoI != NULL)
157
0
        (*m_pUnoI->release)( m_pUnoI );
158
0
    m_pUnoI = pUnoI;
159
0
    return *this;
160
0
}
161
162
163
inline void UnoInterfaceReference::clear()
164
0
{
165
0
    if (m_pUnoI != NULL)
166
0
    {
167
0
        (*m_pUnoI->release)( m_pUnoI );
168
0
        m_pUnoI = NULL;
169
0
    }
170
0
}
171
172
173
inline void UnoInterfaceReference::dispatch(
174
    struct _typelib_TypeDescription const * pMemberType,
175
    void * pReturn, void * pArgs [], uno_Any ** ppException ) const
176
58.0k
{
177
58.0k
    (*m_pUnoI->pDispatcher)(
178
58.0k
        m_pUnoI, pMemberType, pReturn, pArgs, ppException );
179
58.0k
}
180
181
}
182
}
183
}
184
}
185
186
/// @endcond
187
188
#endif
189
190
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */