CObject
CCListIterator.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 6, 2016
18  */
22 #ifndef UTIL_CCARRAYLISTITERATOR_H_
23 #define UTIL_CCARRAYLISTITERATOR_H_
24 
25 #include <CIIterator.h>
26 #include <CError.h>
27 
28 /************************************************************************/
29 /* Class and vtable decalre. */
30 /************************************************************************/
31 /* Must forward declare this. Declarations are included in source file.
32  */
33 struct CIList;
34 
75 {
76  /* Super class must always be first member */
77  /* of a C class struct. */
78  struct CObject cobject;
79 
80  /* Implementing the CIIterator interface. */
81  struct CIIterator ciiterator;
82 
83  struct CIList* list;
84  size_t index;
85  size_t next_index;
86  size_t previous_index;
87  size_t last_index_used;
88  CBool is_next_valid;
89  CBool is_previous_valid;
90  CBool is_last_index_used_valid;
91 };
92 
99 {
100  /* Space for a copy of the super class' virtual table must */
101  /* be the first member of a class virtual table declaration. */
102  struct CObject_VTable cobject;
103 
104  /* Space for a copy of the implemented interface's virtual table */
105  struct CIIterator_VTable ciiterator_override;
106 };
107 
115 
116 
117 /************************************************************************/
118 /* Constructor */
119 /************************************************************************/
132 CError CCListIterator( struct CCListIterator* self, struct CIList* list );
133 
134 #endif /* UTIL_CCARRAYLISTITERATOR_H_ */
CIIterator virtual table.
Definition: CIIterator.h:75
Definition: CIIterator.h:63
CError CCListIterator(struct CCListIterator *self, struct CIList *list)
Definition: CCListIterator.c:270
Interface for list data structures.
Definition: CIList.h:69
Base class.
Definition: Class.h:283
Definition: CCListIterator.h:74
const struct CCListIterator_VTable * CCListIterator_GetVTable()
Definition: CCListIterator.c:245
CObject&#39;s virtual table declaration.
Definition: Class.h:306
Virtual table for CCListIterator.
Definition: CCListIterator.h:98