ObjFW
Toggle main menu visibility
Loading...
Searching...
No Matches
OFBlock.h
1
/*
2
* Copyright (c) 2008-2026 Jonathan Schleifer <js@nil.im>
3
*
4
* All rights reserved.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License version 3.0 only,
8
* as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
* version 3.0 for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* version 3.0 along with this program. If not, see
17
* <https://www.gnu.org/licenses/>.
18
*/
19
20
#import "
OFObject.h
"
21
22
OF_ASSUME_NONNULL_BEGIN
23
29
@interface
OFBlock
:
OFObject
30
+ (instancetype)
alloc
OF_UNAVAILABLE;
31
- (instancetype)
init
OF_UNAVAILABLE;
32
@end
33
34
OF_SUBCLASSING_RESTRICTED
35
@interface
OFStackBlock:
OFBlock
36
@end
37
38
OF_SUBCLASSING_RESTRICTED
39
@interface
OFGlobalBlock:
OFBlock
40
@end
41
42
OF_SUBCLASSING_RESTRICTED
43
@interface
OFMallocBlock:
OFBlock
44
@end
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
extern
void
*_Nullable _Block_copy(
const
void
*_Nullable);
50
extern
void
_Block_release(
const
void
*_Nullable);
51
52
# if defined(OF_WINDOWS) && \
53
(defined(OF_NO_SHARED) || defined(OF_COMPILING_OBJFW))
54
/*
55
* Clang has implicit declarations for these, but they are dllimport. When
56
* compiling ObjFW itself or using it as a static library, these need to be
57
* dllexport. Interestingly, this still works when using it as a shared library.
58
*/
59
extern
__declspec(dllexport)
struct
objc_class
_NSConcreteStackBlock;
60
extern
__declspec(dllexport)
struct
objc_class
_NSConcreteGlobalBlock;
61
extern
__declspec(dllexport)
void
_Block_object_assign(
void
*,
const
void
*,
62
const
int
);
63
extern
__declspec(dllexport)
void
_Block_object_dispose(
const
void
*,
64
const
int
);
65
# endif
66
#ifdef __cplusplus
67
}
68
#endif
69
70
#ifndef Block_copy
71
# define Block_copy(...) \
72
((__typeof__(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
73
#endif
74
#ifndef Block_release
75
# define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
76
#endif
77
78
OF_ASSUME_NONNULL_END
OFObject.h
OFBlock
The class for all blocks, since all blocks are also objects.
Definition
OFBlock.h:30
OFObject
The root class for all other classes inside ObjFW.
Definition
OFObject.h:956
-[OFObject init]
instancetype init()
Initializes an already allocated object.
Definition
OFObject.m:671
+[OFObject alloc]
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object.
Definition
OFObject.m:515
objc_class
A pointer to a class.
Definition
private.h:36
src
OFBlock.h
Generated by
1.17.0