Go to the documentation of this file.
17 #ifndef GZ_COMMON_ENUMITERATOR_HH_
18 #define GZ_COMMON_ENUMITERATOR_HH_
24 #include <gz/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 #if defined __APPLE__ && defined __clang__
144 _Pragma(
"clang diagnostic push")
145 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
147 template<
typename Enum>
152 public: EnumIterator()
159 public: EnumIterator(
const Enum &_c) : c(_c)
165 public: EnumIterator &operator=(
const Enum &_c)
173 public: EnumIterator &operator++()
175 this->c =
static_cast<Enum
>(
static_cast<int>(this->c) + 1);
181 public: EnumIterator operator++(
const int)
183 EnumIterator cpy(*
this);
190 public: EnumIterator &operator--()
192 this->c =
static_cast<Enum
>(
static_cast<int>(this->c) - 1);
198 public: EnumIterator operator--(
const int)
200 EnumIterator cpy(*
this);
207 public: Enum operator*()
const
214 public: Enum Value()
const
224 #if defined __APPLE__ && defined __clang__
225 _Pragma(
"clang diagnostic pop")
232 template<
typename Enum>
233 bool operator==(EnumIterator<Enum> _e1, EnumIterator<Enum> _e2)
235 return _e1.Value() == _e2.Value();
242 template<
typename Enum>
243 bool operator!=(EnumIterator<Enum> _e1, EnumIterator<Enum> _e2)
245 return !(_e1 == _e2);
Forward declarations for the common classes.