#pragma once
#include <cstdint>
#include <better-enums/enum.h>
namespace kooling::datamodel {
BETTER_ENUM(motion_type, std::int32_t,<--- Array index out of bounds<--- Assuming that condition 'index>=_size()' is not redundant<--- Calling function '_size' returns 10<--- Class 'motion_type' has a constructor with 1 argument that is not explicit. [+]Class 'motion_type' has a constructor with 1 argument that is not explicit. Such, so called "Converting constructors", should in general be explicit for type safety reasons as that prevents unintended implicit conversions.
<--- Redundant assignment of 'none' to itself.<--- Redundant assignment of 'walking' to itself.<--- Redundant assignment of 'running' to itself.<--- Redundant assignment of 'cycling' to itself.<--- Redundant assignment of 'automotive' to itself.<--- Redundant assignment of 'unknown' to itself.<--- Redundant assignment of 'disabled' to itself.<--- Redundant assignment of 'subway' to itself.<--- Redundant assignment of 'unavailable' to itself.<--- Redundant assignment of 'flight' to itself.
none = 3,
walking = 7,
running = 8,
cycling = 1,
automotive = 0,
unknown = 4,
disabled = -3, // from android: userAskedNoTrack
subway = -2, // from android: noGpsOrNetwork
unavailable = -1, // from php
flight = 9 // from c++
)
inline motion_type motion_type_or_none(std::int32_t val)
{
if (const auto maybe{ motion_type::_from_integral_nothrow(val) })
{
return *maybe;
}
else
{
return motion_type::none;
}
}
inline bool is_none(motion_type mt)
{
return mt == +motion_type::none;
}
inline bool is_walking(motion_type mt)
{
return mt == +motion_type::walking;
}
inline bool is_running(motion_type mt)
{
return mt == +motion_type::running;
}
inline bool is_cycling(motion_type mt)
{
return mt == +motion_type::cycling;
}
inline bool is_automotive(motion_type mt)
{
return mt == +motion_type::automotive;
}
inline bool is_unknown(motion_type mt)
{
return mt == +motion_type::unknown;
}
} // namespace kooling::datamodel