-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSAMWeak.h
More file actions
35 lines (29 loc) · 883 Bytes
/
Copy pathSAMWeak.h
File metadata and controls
35 lines (29 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// SAMWeak.h
//
// Created by Roman Kříž on 07.08.13.
// Copyright (c) 2013 samnung. All rights reserved.
//
#ifndef SAM_WEAK
#define SAM_WEAK
#ifndef SAM_WEAK_NAME
#define SAM_WEAK_NAME(name) _##name
#endif
#ifndef SAM_STRONG_NAME
#define SAM_STRONG_NAME(name) s##name
#endif
/**
* Creates weak reference to object. Default new name is _(__self)
*
* @note If you want to change the patern name define macro SAM_WEAK_NAME().
* Something like #define SAM_WEAK_NAME(name) _##name
*/
#define WEAK(__self) __weak __typeof(__self) SAM_WEAK_NAME(__self) = __self
/**
* Creates strong reference to object. Default new name is s(__self)
*
* @note If you want to change the patern name define macro SAM_STRONG_NAME().
* Something like #define SAM_STRONG_NAME(name) s##name
*/
#define STRONG(__self) __strong __typeof(__self) SAM_STRONG_NAME(__self) = __self
#endif