summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-06-01 11:49:15 +0200
committerMolly Lloyd <mollymerp@users.noreply.github.com>2018-08-31 13:08:47 -0700
commit5e9bbfdd44ef9c0a2c5850566c28a40aa2a05151 (patch)
treec988c26ea070063adb4a584485625ac5e7ec2ec5 /src
parent748e6bde5f611cfba3419c272d3cbf1d5c1350ef (diff)
downloadqtlocation-mapboxgl-5e9bbfdd44ef9c0a2c5850566c28a40aa2a05151.tar.gz
[core] introduce TypeListConcat and TypeList::ExpandInto
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/gl/attribute.hpp18
-rw-r--r--src/mbgl/gl/uniform.hpp19
-rw-r--r--src/mbgl/programs/symbol_program.hpp4
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.hpp4
-rw-r--r--src/mbgl/style/properties.hpp9
5 files changed, 10 insertions, 44 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp
index de95be0733..8cdb03bfe7 100644
--- a/src/mbgl/gl/attribute.hpp
+++ b/src/mbgl/gl/attribute.hpp
@@ -294,22 +294,8 @@ public:
}
};
-namespace detail {
-
-template <class...>
-struct ConcatenateAttributes;
-
-template <class... As, class... Bs>
-struct ConcatenateAttributes<TypeList<As...>, TypeList<Bs...>> {
- using Type = Attributes<As..., Bs...>;
-};
-
-} // namespace detail
-
-template <class A, class B>
-using ConcatenateAttributes = typename detail::ConcatenateAttributes<
- typename A::Types,
- typename B::Types>::Type;
+template <class... As>
+using ConcatenateAttributes = typename TypeListConcat<typename As::Types...>::template ExpandInto<Attributes>;
} // namespace gl
} // namespace mbgl
diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp
index 5a78068fc8..d8a167c382 100644
--- a/src/mbgl/gl/uniform.hpp
+++ b/src/mbgl/gl/uniform.hpp
@@ -120,23 +120,8 @@ public:
}
};
-
-namespace detail {
-
-template <class...>
-struct ConcatenateUniforms;
-
-template <class... As, class... Bs>
-struct ConcatenateUniforms<TypeList<As...>, TypeList<Bs...>> {
- using Type = Uniforms<As..., Bs...>;
-};
-
-} // namespace detail
-
-template <class A, class B>
-using ConcatenateUniforms = typename detail::ConcatenateUniforms<
- typename A::Types,
- typename B::Types>::Type;
+template <class... Us>
+using ConcatenateUniforms = typename TypeListConcat<typename Us::Types...>::template ExpandInto<Uniforms>;
} // namespace gl
} // namespace mbgl
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index a1a4621b62..27bcd7b427 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -252,7 +252,7 @@ public:
using LayoutAttributes = LayoutAttrs;
using LayoutVertex = typename LayoutAttributes::Vertex;
- using LayoutAndSizeAttributes = gl::ConcatenateAttributes<LayoutAttributes, gl::ConcatenateAttributes<SymbolDynamicLayoutAttributes, SymbolOpacityAttributes>>;
+ using LayoutAndSizeAttributes = gl::ConcatenateAttributes<LayoutAttributes, SymbolDynamicLayoutAttributes, SymbolOpacityAttributes>;
using PaintProperties = PaintProps;
using PaintPropertyBinders = typename PaintProperties::Binders;
@@ -262,7 +262,7 @@ public:
using UniformValues = typename Uniforms::Values;
using SizeUniforms = typename SymbolSizeBinder::Uniforms;
using PaintUniforms = typename PaintPropertyBinders::Uniforms;
- using AllUniforms = gl::ConcatenateUniforms<Uniforms, gl::ConcatenateUniforms<SizeUniforms, PaintUniforms>>;
+ using AllUniforms = gl::ConcatenateUniforms<Uniforms, SizeUniforms, PaintUniforms>;
using ProgramType = gl::Program<Primitive, Attributes, AllUniforms>;
diff --git a/src/mbgl/renderer/layers/render_line_layer.hpp b/src/mbgl/renderer/layers/render_line_layer.hpp
index facab60645..1e0100548a 100644
--- a/src/mbgl/renderer/layers/render_line_layer.hpp
+++ b/src/mbgl/renderer/layers/render_line_layer.hpp
@@ -13,8 +13,8 @@ struct LineFloorwidth : style::DataDrivenPaintProperty<float, attributes::a_floo
};
class RenderLinePaintProperties : public style::ConcatenateProperties<
- style::LinePaintProperties::PropertyTypes,
- TypeList<LineFloorwidth>>::Type {};
+ style::LinePaintProperties,
+ style::Properties<LineFloorwidth>> {};
class RenderLineLayer: public RenderLayer {
public:
diff --git a/src/mbgl/style/properties.hpp b/src/mbgl/style/properties.hpp
index 9206e96982..e7f05db959 100644
--- a/src/mbgl/style/properties.hpp
+++ b/src/mbgl/style/properties.hpp
@@ -233,13 +233,8 @@ public:
};
};
-template <class...>
-struct ConcatenateProperties;
-
-template <class... As, class... Bs>
-struct ConcatenateProperties<TypeList<As...>, TypeList<Bs...>> {
- using Type = Properties<As..., Bs...>;
-};
+template <class... Ps>
+using ConcatenateProperties = typename TypeListConcat<typename Ps::PropertyTypes...>::template ExpandInto<Properties>;
} // namespace style
} // namespace mbgl