Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
iterator.h File Reference
#include "support.h"

Go to the source code of this file.

Data Structures

struct  iterator
 

Macros

#define ITERATOR(p)   ((struct iterator *)(p))
 
#define generic_iterate(TYPE_it, TYPE_a, NAME_a, FUNC_size, FUNC_init, ...)
 
#define generic_iterate_end
 

Functions

static void iterator_next (struct iterator *it)
 
static voiditerator_get (const struct iterator *it)
 
static bool iterator_valid (const struct iterator *it)
 
struct iteratorinvalid_iter_init (struct iterator *it)
 

Macro Definition Documentation

◆ generic_iterate

#define generic_iterate (   TYPE_it,
  TYPE_a,
  NAME_a,
  FUNC_size,
  FUNC_init,
  ... 
)
Value:
do { \
char MY_mem_##NAME_a[FUNC_size()]; \
struct iterator *MY_it_##NAME_a; \
char * incite_cost
Definition comments.c:76
static void * iterator_get(const struct iterator *it)
Definition iterator.h:53
static bool iterator_valid(const struct iterator *it)
Definition iterator.h:61
static void iterator_next(struct iterator *it)
Definition iterator.h:42

Definition at line 117 of file iterator.h.

◆ generic_iterate_end

#define generic_iterate_end
Value:
} \
} while (FALSE)
#define FALSE
Definition support.h:47

Definition at line 129 of file iterator.h.

◆ ITERATOR

#define ITERATOR (   p)    ((struct iterator *)(p))

Definition at line 37 of file iterator.h.

Function Documentation

◆ invalid_iter_init()

struct iterator * invalid_iter_init ( struct iterator it)

Initializes the iterator vtable so that generic_iterate assumes that the iterator is invalid.

Definition at line 51 of file iterator.c.

Referenced by genhash_iter_init_common(), and startpos_iter_init().

◆ iterator_get()

static void * iterator_get ( const struct iterator it)
inlinestatic

Returns the item currently pointed to by the iterator. Note that the iterator could point to an item whose value is nullptr; to actually test whether the iterator is still valid (e.g. has not gone past the end of the sequence), use iterator_valid().

Definition at line 53 of file iterator.h.

Referenced by research_player_iter_valid_state(), startpos_exclude_iter_get(), and startpos_exclude_iter_next().

◆ iterator_next()

static void iterator_next ( struct iterator it)
inlinestatic

Advances the iterator to point to the next item in the sequence.

Definition at line 42 of file iterator.h.

Referenced by research_player_iter_init(), startpos_exclude_iter_next(), and unit_cargo_depth().

◆ iterator_valid()

static bool iterator_valid ( const struct iterator it)
inlinestatic

Returns TRUE if the iterator points to an item in the sequence.

Definition at line 61 of file iterator.h.

Referenced by startpos_exclude_iter_next(), startpos_exclude_iter_valid(), and unit_cargo_depth().