Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
btraii.mm
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#include "
btraii_p.h
"
5
6
#include <
qdebug.h
>
7
8
#include <Foundation/Foundation.h>
9
10
#include <utility>
11
12
QT_BEGIN_NAMESPACE
13
14
namespace
DarwinBluetooth
{
15
16
StrongReference::StrongReference
(
void
*
object
,
RetainPolicy
policy
)
17
: objCInstance(
object
)
18
{
19
if
(objCInstance &&
policy
==
RetainPolicy::doInitialRetain
)
20
objCInstance = [getAs<NSObject>() retain];
21
}
22
23
StrongReference::StrongReference
(
const
StrongReference
&
other
)
24
{
25
if
((objCInstance =
other
.getAs<NSObject>()))
26
objCInstance = [
other
.getAs<NSObject>() retain];
27
}
28
29
StrongReference::StrongReference
(
StrongReference
&&
other
)
30
{
31
std::swap(objCInstance,
other
.objCInstance);
32
}
33
34
StrongReference::~StrongReference
()
35
{
36
[getAs<NSObject>()
release
];
37
}
38
39
StrongReference
&
StrongReference::operator =
(
const
StrongReference
&
other
)
noexcept
40
{
41
if
(
this
!= &
other
) {
42
[getAs<NSObject>()
release
];
43
objCInstance = [
other
.getAs<NSObject>() retain];
44
}
45
46
return
*
this
;
47
}
48
49
StrongReference
&
StrongReference::operator =
(
StrongReference
&&
other
)
noexcept
50
{
51
swap
(
other
);
52
53
return
*
this
;
54
}
55
56
void
*
StrongReference::release
()
57
{
58
void
*released = objCInstance;
59
objCInstance =
nullptr
;
60
61
return
released;
62
}
63
64
void
StrongReference::reset
()
65
{
66
[getAs<NSObject>()
release
];
67
objCInstance =
nullptr
;
68
}
69
70
void
StrongReference::reset
(
void
*
obj
,
RetainPolicy
policy
)
71
{
72
[getAs<NSObject>()
release
];
73
objCInstance =
obj
;
74
75
if
(objCInstance &&
policy
==
RetainPolicy::doInitialRetain
)
76
objCInstance = [getAs<NSObject>() retain];
77
}
78
79
}
// namespace DarwinBluetooth
80
81
QT_END_NAMESPACE
btraii_p.h
DarwinBluetooth::StrongReference
Definition
btraii_p.h:44
DarwinBluetooth::StrongReference::StrongReference
StrongReference()=default
DarwinBluetooth::StrongReference::operator=
StrongReference & operator=(const StrongReference &other) noexcept
Definition
btraii.mm:39
DarwinBluetooth::StrongReference::~StrongReference
~StrongReference()
Definition
btraii.mm:34
DarwinBluetooth::StrongReference::reset
void reset()
Definition
btraii.mm:64
DarwinBluetooth::StrongReference::release
void * release()
Definition
btraii.mm:56
DarwinBluetooth
Definition
btcentralmanager.mm:22
DarwinBluetooth::RetainPolicy
RetainPolicy
Definition
btraii_p.h:27
DarwinBluetooth::RetainPolicy::doInitialRetain
@ doInitialRetain
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
qdebug.h
object
GLuint object
[3]
Definition
qopengles2ext.h:1248
obj
GLhandleARB obj
[2]
Definition
qopenglext.h:4164
release
sem release()
other
QSharedPointer< T > other(t)
[5]
swap
this swap(other)
policy
QSizePolicy policy
Definition
src_gui_widgets_qsplitter.cpp:6
qtconnectivity
src
bluetooth
darwin
btraii.mm
Generated by
1.10.0