Go to the documentation of this file.
17 #ifndef IGNITION_COMMON_ENUMITERATOR_HH_
18 #define IGNITION_COMMON_ENUMITERATOR_HH_
24 #include <ignition/common/Export.hh>
40 #define IGN_ENUM(name, enumType, begin, end, ...) \
41 static ignition::common::EnumIface<enumType> name( \
42 begin, end, {__VA_ARGS__});
53 public: EnumIface(T _start, T _end,
57 this->range[0] = _start;
58 this->range[1] = _end;
82 if (
static_cast<unsigned int>(_e) < names.size())
83 return names[
static_cast<unsigned int>(_e)];
143 template<
typename Enum>
148 public: EnumIterator()
155 public: EnumIterator(
const Enum &_c) : c(_c)
161 public: EnumIterator &operator=(
const Enum &_c)
169 public: EnumIterator &operator++()
171 this->c =
static_cast<Enum
>(
static_cast<int>(this->c) + 1);
177 public: EnumIterator operator++(
const int)
179 EnumIterator cpy(*
this);
186 public: EnumIterator &operator--()
188 this->c =
static_cast<Enum
>(
static_cast<int>(this->c) - 1);
194 public: EnumIterator operator--(
const int)
196 EnumIterator cpy(*
this);
203 public: Enum operator*()
const
210 public: Enum Value()
const
225 template<
typename Enum>
226 bool operator==(EnumIterator<Enum> _e1, EnumIterator<Enum> _e2)
228 return _e1.Value() == _e2.Value();
235 template<
typename Enum>
236 bool operator!=(EnumIterator<Enum> _e1, EnumIterator<Enum> _e2)
238 return !(_e1 == _e2);
Forward declarations for the common classes.