CObject
CIIterator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Brendan Bruner
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * bbruner@ualberta.ca
17  * July 7, 2016
18  */
24 #ifndef UTIL_CIITERATOR_H_
25 #define UTIL_CIITERATOR_H_
26 
27 #include <Class.h>
28 
29 /************************************************************************/
30 /* Interface declaration. */
31 /************************************************************************/
63 struct CIIterator
64 {
65  /* CInterface must always be first member of */
66  /* an interface's struct .*/
67  struct CInterface interface;
68 };
69 
76 {
77  CBool (*hasNext)( struct CIIterator* );
78  void (*next)( struct CIIterator*, void* );
79  CBool (*hasPrevious)( struct CIIterator* );
80  void (*previous)( struct CIIterator*, void* );
81  CBool (*set)( struct CIIterator*, void* );
82  CBool (*remove)( struct CIIterator* );
83  size_t (*index)( struct CIIterator* );
84 };
85 
86 
87 /************************************************************************/
88 /* Method declarations. */
89 /************************************************************************/
102 CBool CIIterator_HasNext( struct CIIterator* self );
103 
117 void CIIterator_Next( struct CIIterator* self, void* element );
118 
131 CBool CIIterator_HasPrevious( struct CIIterator* self );
132 
144 void CIIterator_Previous( struct CIIterator* self, void* element );
145 
162 CBool CIIterator_Set( struct CIIterator* self, void* element );
163 
178 CBool CIIterator_Remove( struct CIIterator* self );
179 
193 size_t CIIterator_Index( struct CIIterator* self );
194 
195 
196 #endif /* UTIL_CIITERATOR_H_ */
CIIterator virtual table.
Definition: CIIterator.h:75
void CIIterator_Next(struct CIIterator *self, void *element)
Definition: CIIterator.c:37
Definition: CIIterator.h:63
Base interface.
Definition: Class.h:398
CBool CIIterator_HasNext(struct CIIterator *self)
Definition: CIIterator.c:28
CBool CIIterator_Set(struct CIIterator *self, void *element)
Definition: CIIterator.c:67
void CIIterator_Previous(struct CIIterator *self, void *element)
Definition: CIIterator.c:57
CBool CIIterator_Remove(struct CIIterator *self)
Definition: CIIterator.c:77
size_t CIIterator_Index(struct CIIterator *self)
Definition: CIIterator.c:87
CBool CIIterator_HasPrevious(struct CIIterator *self)
Definition: CIIterator.c:47