|
OpenTTD Source 20261123-master-g1c55c72fd0
|
Iterator to iterate all valid CargoSpec. More...
#include <cargotype.h>
Public Types | |
| using | value_type = CargoSpec |
| The type pointed by iterator. | |
| using | pointer = CargoSpec * |
| The pointer type to value_type. | |
| using | reference = CargoSpec & |
| The reference type to value_type. | |
| using | difference_type = size_t |
| Type used to store difference between two iterators. | |
| using | iterator_category = std::forward_iterator_tag |
| The category of the iterator. | |
Public Member Functions | |
| Iterator (size_t index) | |
| Constructs new iterator from an index. | |
| bool | operator== (const Iterator &other) const |
| Compare with other iterator. | |
| CargoSpec * | operator* () const |
| Dereference operator. | |
| Iterator & | operator++ () |
| Increment the iterator and set it to the next position. | |
Private Member Functions | |
| void | ValidateIndex () |
| Validate index so it points to a valid cargo spec. | |
Private Attributes | |
| size_t | index |
| Index of the CargoSpec that this iterator points to. | |
Iterator to iterate all valid CargoSpec.
Definition at line 163 of file cargotype.h.
| using CargoSpec::Iterator::difference_type = size_t |
Type used to store difference between two iterators.
Definition at line 167 of file cargotype.h.
| using CargoSpec::Iterator::iterator_category = std::forward_iterator_tag |
The category of the iterator.
Definition at line 168 of file cargotype.h.
| using CargoSpec::Iterator::pointer = CargoSpec * |
The pointer type to value_type.
Definition at line 165 of file cargotype.h.
| using CargoSpec::Iterator::reference = CargoSpec & |
The reference type to value_type.
Definition at line 166 of file cargotype.h.
The type pointed by iterator.
Definition at line 164 of file cargotype.h.
|
inlineexplicit |
Constructs new iterator from an index.
| index | Index of the CargoSpec to iterate from. |
Definition at line 174 of file cargotype.h.
References index, and ValidateIndex().
Referenced by operator++(), and operator==().
|
inline |
Dereference operator.
Gets the pointed CargoSpec.
Definition at line 190 of file cargotype.h.
References CargoSpec::Get(), and index.
|
inline |
Increment the iterator and set it to the next position.
Definition at line 196 of file cargotype.h.
References index, Iterator(), and ValidateIndex().
|
inline |
Compare with other iterator.
| other | The other iterator to compare with. |
true iff the other iterator matches this value e.i. they are equal. Definition at line 184 of file cargotype.h.
References index, and Iterator().
|
inlineprivate |
Validate index so it points to a valid cargo spec.
Definition at line 202 of file cargotype.h.
References CargoSpec::Get(), CargoSpec::GetArraySize(), and CargoSpec::IsValid().
Referenced by Iterator(), and operator++().
|
private |
Index of the CargoSpec that this iterator points to.
Definition at line 199 of file cargotype.h.
Referenced by Iterator(), operator*(), operator++(), and operator==().