Go to the documentation of this file.
17 #ifndef IGNITION_COMMON_ENUMITERATOR_HH_
18 #define IGNITION_COMMON_ENUMITERATOR_HH_
24 #include <gz/common/config.hh>
25 #include <gz/common/Export.hh>
42 #define IGN_ENUM(name, enumType, begin, end, ...) \
43 static ignition::common::EnumIface<enumType> name( \
44 begin, end, {__VA_ARGS__});
55 public: EnumIface(T _start, T _end,
59 this->range[0] = _start;
60 this->range[1] = _end;
84 if (
static_cast<unsigned int>(_e) < names.size())
85 return names[
static_cast<unsigned int>(_e)];
145 #if defined __APPLE__ && defined __clang__
146 _Pragma(
"clang diagnostic push")
147 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
149 template<
typename Enum>
154 public: EnumIterator()
161 public: EnumIterator(
const Enum &_c) : c(_c)
167 public: EnumIterator &operator=(
const Enum &_c)
175 public: EnumIterator &operator++()
177 this->c =
static_cast<Enum
>(
static_cast<int>(this->c) + 1);
183 public: EnumIterator operator++(
const int)
185 EnumIterator cpy(*
this);
192 public: EnumIterator &operator--()
194 this->c =
static_cast<Enum
>(
static_cast<int>(this->c) - 1);
200 public: EnumIterator operator--(
const int)
202 EnumIterator cpy(*
this);
209 public: Enum operator*()
const
216 public: Enum Value()
const
226 #if defined __APPLE__ && defined __clang__
227 _Pragma(
"clang diagnostic pop")
234 template<
typename Enum>
235 bool operator==(EnumIterator<Enum> _e1, EnumIterator<Enum> _e2)
237 return _e1.Value() == _e2.Value();
244 template<
typename Enum>
245 bool operator!=(EnumIterator<Enum> _e1, EnumIterator<Enum> _e2)
247 return !(_e1 == _e2);
Forward declarations for the common classes.