polar-objc 5.44
An Objective-C runtime library
Loading...
Searching...
No Matches
objc-protocol.c
1/* Internal API: protocol utility routines for polar-objc.
2 Copyright (C) 2022-2025 Michael Malicoat <[email protected]>
3
4 This file is part of polar-objc.
5
6 polar-objc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
8
9 polar-objc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
10 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 details.
12
13 You should have received a copy of the GNU General Public License along with this program; see the file LICENSE. If
14 not, see <http://www.gnu.org/licenses/>.
15*/
16
17// Public ==============================================================================================================
18
19POLAR_FUNCTION_INTERNAL BOOL
20objc_protocol_is_valid( struct objc_protocol *protocol_target, BOOL flag_require_resolved )
21{
22 if( (id)protocol_target != nil )
23 ;
24
25 else
26 return NO;
27
28 if( protocol_target->class_pointer == ProtocolClass )
29 return YES;
30
31 else if( flag_require_resolved == NO )
32 return ( ((struct objc_protocol_static *)protocol_target)->version_protocol == OBJC_VERSION_PROTOCOL );
33
34 return NO;
35}