summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-08-13 06:53:40 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-08-13 10:12:48 +0300
commitac9d5886f09a58ce879a5372b817b7a524a70844 (patch)
tree15128484b4aff0b70f3d3e3c49b65ed8b68ca74e /include
parent5abb18a99cb5723f7b8ca21c5cb674d7214189dc (diff)
downloadqtlocation-mapboxgl-ac9d5886f09a58ce879a5372b817b7a524a70844.tar.gz
Added operator implementations for mbgl::Update enum class
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/map/update.hpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/mbgl/map/update.hpp b/include/mbgl/map/update.hpp
index d5978d80b6..fe9250efcf 100644
--- a/include/mbgl/map/update.hpp
+++ b/include/mbgl/map/update.hpp
@@ -5,9 +5,7 @@
namespace mbgl {
-using UpdateType = uint32_t;
-
-enum class Update : UpdateType {
+enum class Update : uint32_t {
Nothing = 0,
Dimensions = 1 << 1,
DefaultTransition = 1 << 2,
@@ -17,6 +15,19 @@ enum class Update : UpdateType {
Repaint = 1 << 6,
};
+inline Update operator| (const Update& lhs, const Update& rhs) {
+ return Update(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
+}
+
+inline Update& operator|=(Update& lhs, const Update& rhs) {
+ lhs = lhs | rhs;
+ return lhs;
}
-#endif
+inline bool operator& (const Update& lhs, const Update& rhs) {
+ return static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs);
+}
+
+} // namespace mbgl
+
+#endif // MBGL_MAP_UPDATE