UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CFRef.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#pragma once
4
5
namespace
UE4CFRef_Private
6
{
7
template
<
class
CFRefType>
8
struct
TTollFreeBridgeType
;
9
10
#ifdef __OBJC__
11
template
<>
struct
TTollFreeBridgeType
<
CFArrayRef
> {
using
Type =
NSArray
*; };
12
template
<>
struct
TTollFreeBridgeType
<
CFAttributedStringRef
> {
using
Type =
NSAttributedString
*; };
13
template
<>
struct
TTollFreeBridgeType<
CFBooleanRef
> {
using
Type =
NSNumber
*; };
14
template
<>
struct
TTollFreeBridgeType<
CFCalendarRef
> {
using
Type
=
NSCalendar
*; };
15
template
<>
struct
TTollFreeBridgeType<
CFCharacterSetRef
> {
using
Type
=
NSCharacterSet
*; };
16
template
<>
struct
TTollFreeBridgeType<
CFDataRef
> {
using
Type
=
NSData
*; };
17
template
<>
struct
TTollFreeBridgeType<
CFDateRef
> {
using
Type
=
NSDate
*; };
18
template
<>
struct
TTollFreeBridgeType<
CFDictionaryRef
> {
using
Type
=
NSDictionary
*; };
19
template
<>
struct
TTollFreeBridgeType<
CFErrorRef
> {
using
Type
=
NSError
*; };
20
template
<>
struct
TTollFreeBridgeType<
CFLocaleRef
> {
using
Type
=
NSLocale
*; };
21
template
<>
struct
TTollFreeBridgeType<
CFMutableArrayRef
> {
using
Type
=
NSMutableArray
*; };
22
template
<>
struct
TTollFreeBridgeType<
CFMutableAttributedStringRef
> {
using
Type
=
NSMutableAttributedString
*; };
23
template
<>
struct
TTollFreeBridgeType<
CFMutableCharacterSetRef
> {
using
Type
=
NSMutableCharacterSet
*; };
24
template
<>
struct
TTollFreeBridgeType<
CFMutableDataRef
> {
using
Type
=
NSMutableData
*; };
25
template
<>
struct
TTollFreeBridgeType<
CFMutableDictionaryRef
> {
using
Type
=
NSMutableDictionary
*; };
26
template
<>
struct
TTollFreeBridgeType<
CFMutableSetRef
> {
using
Type
=
NSMutableSet
*; };
27
template
<>
struct
TTollFreeBridgeType<
CFMutableStringRef
> {
using
Type
=
NSMutableString
*; };
28
template
<>
struct
TTollFreeBridgeType<
CFNullRef
> {
using
Type
=
NSNull
*; };
29
template
<>
struct
TTollFreeBridgeType<
CFNumberRef
> {
using
Type
=
NSNumber
*; };
30
template
<>
struct
TTollFreeBridgeType<
CFReadStreamRef
> {
using
Type
= NSInputStream*; };
31
template
<>
struct
TTollFreeBridgeType<
CFRunLoopTimerRef
> {
using
Type
=
NSTimer
*; };
32
template
<>
struct
TTollFreeBridgeType<
CFSetRef
> {
using
Type
=
NSSet
*; };
33
template
<>
struct
TTollFreeBridgeType<
CFStringRef
> {
using
Type
=
NSString
*; };
34
template
<>
struct
TTollFreeBridgeType<
CFTimeZoneRef
> {
using
Type
=
NSTimeZone
*; };
35
template
<>
struct
TTollFreeBridgeType<
CFURLRef
> {
using
Type
=
NSURL
*; };
36
template
<>
struct
TTollFreeBridgeType<
CFWriteStreamRef
> {
using
Type
=
NSOutputStream
*; };
37
#endif
// __OBJC__
38
}
39
40
template
<
class
CFRefType>
41
class
TCFRef
42
{
43
public
:
44
48
TCFRef
()
49
: Ref(nullptr)
50
{
51
}
52
58
TCFRef
(
CFRefType
InRef
)
59
: Ref(
InRef
)
60
{
61
}
62
68
TCFRef
(
const
TCFRef
&
Other
)
69
{
70
CFRetain
(
Other
.Ref);
71
Ref =
Other
.Ref;
72
}
73
79
TCFRef
(
TCFRef
&&
Other
)
80
{
81
Ref =
Other
.Ref;
82
Other
.Ref =
nullptr
;
83
}
84
88
~TCFRef
()
89
{
90
if
(Ref)
91
{
92
CFRelease
(Ref);
93
}
94
}
95
101
TCFRef
&
operator=
(
const
TCFRef
&
Other
)
102
{
103
if
(
this
!= &
Other
)
104
{
105
if
(Ref !=
nullptr
)
106
{
107
CFRelease
(Ref);
108
}
109
CFRetain
(
Other
.Ref);
110
Ref =
Other
.Ref;
111
}
112
return
*
this
;
113
}
114
120
TCFRef
&
operator=
(
TCFRef
&&
Other
)
121
{
122
if
(
this
!= &
Other
)
123
{
124
if
(Ref)
125
{
126
CFRelease
(Ref);
127
}
128
Ref =
Other
.Ref;
129
Other
.Ref =
nullptr
;
130
}
131
return
*
this
;
132
}
133
140
CFRefType
*
GetForAssignment
()
141
{
142
if
(Ref !=
nullptr
)
143
{
144
CFRelease
(Ref);
145
Ref =
nullptr
;
146
}
147
return
&Ref;
148
}
149
155
explicit
operator
bool
()
const
156
{
157
return
Ref !=
nullptr
;
158
}
159
165
operator
CFRefType
()
const
166
{
167
return
Ref;
168
}
169
175
template
<
typename
T =
CFRefType
,
176
typename
=
typename
UE4CFRef_Private::TTollFreeBridgeType<T>::Type
>
177
operator
typename
UE4CFRef_Private::TTollFreeBridgeType<T>::Type
()
const
178
{
179
return
static_cast<
typename
UE4CFRef_Private::TTollFreeBridgeType<T>::Type
>
(Ref);
180
}
181
182
private
:
183
/* The Core Foundation Type. Can be nullptr. */
184
CFRefType
Ref;
185
};
186
EARSessionStatus::Other
@ Other
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
bool
const bool
Definition
NetworkReplayStreaming.h:178
TCFRef
Definition
CFRef.h:42
TCFRef::TCFRef
TCFRef(CFRefType InRef)
Definition
CFRef.h:58
TCFRef::operator=
TCFRef & operator=(const TCFRef &Other)
Definition
CFRef.h:101
TCFRef::TCFRef
TCFRef(TCFRef &&Other)
Definition
CFRef.h:79
TCFRef::GetForAssignment
CFRefType * GetForAssignment()
Definition
CFRef.h:140
TCFRef::~TCFRef
~TCFRef()
Definition
CFRef.h:88
TCFRef::TCFRef
TCFRef(const TCFRef &Other)
Definition
CFRef.h:68
TCFRef::TCFRef
TCFRef()
Definition
CFRef.h:48
TCFRef::operator=
TCFRef & operator=(TCFRef &&Other)
Definition
CFRef.h:120
EPawnActionMoveMode::Type
Type
Definition
PawnAction_Move.h:11
UE4CFRef_Private
Definition
CFRef.h:6
UE4CFRef_Private::TTollFreeBridgeType
Definition
CFRef.h:8
Engine
Source
Runtime
Core
Public
Apple
CFRef.h
Generated by
1.9.8