Freeciv21
Develop your civilization from humble roots to a global empire
iterator.cpp
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 
14 #include "iterator.h"
15 
19 static void invalid_iter_next(struct iterator *it)
20 { // Do nothing.
21 }
22 
26 static void *invalid_iter_get(const struct iterator *it) { return nullptr; }
27 
31 static bool invalid_iter_valid(const struct iterator *it) { return false; }
32 
37 struct iterator *invalid_iter_init(struct iterator *it)
38 {
39  it->next = invalid_iter_next;
40  it->get = invalid_iter_get;
42  return it;
43 }
static bool invalid_iter_valid(const struct iterator *it)
'valid' function implementation for an "invalid" iterator.
Definition: iterator.cpp:31
struct iterator * invalid_iter_init(struct iterator *it)
Initializes the iterator vtable so that generic_iterate assumes that the iterator is invalid.
Definition: iterator.cpp:37
static void invalid_iter_next(struct iterator *it)
'next' function implementation for an "invalid" iterator.
Definition: iterator.cpp:19
static void * invalid_iter_get(const struct iterator *it)
'get' function implementation for an "invalid" iterator.
Definition: iterator.cpp:26
bool(* valid)(const struct iterator *it)
Definition: iterator.h:23
void *(* get)(const struct iterator *it)
Definition: iterator.h:22
void(* next)(struct iterator *it)
Definition: iterator.h:21