polar-objc 5.44
An Objective-C runtime library
Loading...
Searching...
No Matches
polar-iterator.h
1/* Internal API: root iterator type 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#ifndef POLAR_ITERATOR_H
18#define POLAR_ITERATOR_H
19// polar_iterator ******************************************************************************************************
20
21typedef struct polar_iterator polar_iterator;
23
25{
26 polar_runtime_object data_inherited;
27};
28
30{
31 polar_runtime_object_class data_inherited;
32
33 // Virtual methods
34
35 BOOL
36 (*get_next)( polar_iterator *self, void **out_next_element ) POLAR_FUNCTION_INTERNAL;
37};
38
39#define POLAR_TYPE_ITERATOR ( polar_iterator_get_type() )
40
41#define POLAR_ITERATOR(inst) ( POLAR_INTERNAL_TYPE_CHECK_INSTANCE_CAST((inst), POLAR_TYPE_ITERATOR, polar_iterator) )
42#define POLAR_IS_ITERATOR(inst) ( POLAR_INTERNAL_TYPE_CHECK_INSTANCE_TYPE((inst), POLAR_TYPE_ITERATOR) )
43#define POLAR_ITERATOR_CLASS(klass) ( POLAR_INTERNAL_TYPE_CHECK_CLASS_CAST((klass), POLAR_TYPE_ITERATOR, polar_iterator_class) )
44#define POLAR_IS_ITERATOR_CLASS(klass) ( POLAR_INTERNAL_TYPE_CHECK_CLASS_TYPE((klass), POLAR_TYPE_ITERATOR) )
45#define POLAR_ITERATOR_GET_CLASS(inst) ( POLAR_INTERNAL_TYPE_INSTANCE_GET_CLASS((inst), POLAR_TYPE_ITERATOR, polar_iterator_class) )
46
47POLAR_FUNCTION_INTERNAL OBJC_FUNCTION_CONSTANT polar_internal_type
48polar_iterator_get_type( void );
49
50static inline BOOL
51polar_iterator_get_next( polar_iterator *self, void **out_next_element )
52{
53 assert( POLAR_IS_ITERATOR(self) );
54
55 return POLAR_ITERATOR_GET_CLASS(self)->get_next(self, out_next_element);
56}
57
58#endif // POLAR_ITERATOR_H
Definition polar-iterator.h:30
Definition polar-iterator.h:25
Definition polar-runtime-object.h:36
Definition polar-runtime-object.h:31