From 1185fe0d316f34ebad93807e871093f9c0df0890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 11 Jan 2019 15:11:01 +0100 Subject: [core] return constexpr strings from functions to avoid ODR compile failures --- src/mbgl/style/layers/layer_properties.hpp.ejs | 2 +- src/mbgl/style/layers/line_layer_properties.hpp | 8 +-- src/mbgl/style/layers/symbol_layer_properties.hpp | 74 +++++++++++------------ 3 files changed, 42 insertions(+), 42 deletions(-) (limited to 'src/mbgl/style/layers') diff --git a/src/mbgl/style/layers/layer_properties.hpp.ejs b/src/mbgl/style/layers/layer_properties.hpp.ejs index 694d9a62b7..792f858862 100644 --- a/src/mbgl/style/layers/layer_properties.hpp.ejs +++ b/src/mbgl/style/layers/layer_properties.hpp.ejs @@ -19,7 +19,7 @@ namespace style { <% for (const property of layoutProperties) { -%> struct <%- camelize(property.name) %> : <%- layoutPropertyType(property, type) %> { - static constexpr const char * key = "<%- property.name %>"; + static constexpr const char *name() { return "<%- property.name %>"; } static <%- evaluatedType(property) %> defaultValue() { return <%- defaultValue(property) %>; } }; diff --git a/src/mbgl/style/layers/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp index 6f85eadafb..f6eeaa154f 100644 --- a/src/mbgl/style/layers/line_layer_properties.hpp +++ b/src/mbgl/style/layers/line_layer_properties.hpp @@ -13,22 +13,22 @@ namespace mbgl { namespace style { struct LineCap : LayoutProperty { - static constexpr const char * key = "line-cap"; + static constexpr const char *name() { return "line-cap"; } static LineCapType defaultValue() { return LineCapType::Butt; } }; struct LineJoin : DataDrivenLayoutProperty { - static constexpr const char * key = "line-join"; + static constexpr const char *name() { return "line-join"; } static LineJoinType defaultValue() { return LineJoinType::Miter; } }; struct LineMiterLimit : LayoutProperty { - static constexpr const char * key = "line-miter-limit"; + static constexpr const char *name() { return "line-miter-limit"; } static float defaultValue() { return 2; } }; struct LineRoundLimit : LayoutProperty { - static constexpr const char * key = "line-round-limit"; + static constexpr const char *name() { return "line-round-limit"; } static float defaultValue() { return 1; } }; diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index 6c147f440d..d5bdce1f5d 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -13,187 +13,187 @@ namespace mbgl { namespace style { struct SymbolPlacement : LayoutProperty { - static constexpr const char * key = "symbol-placement"; + static constexpr const char *name() { return "symbol-placement"; } static SymbolPlacementType defaultValue() { return SymbolPlacementType::Point; } }; struct SymbolSpacing : LayoutProperty { - static constexpr const char * key = "symbol-spacing"; + static constexpr const char *name() { return "symbol-spacing"; } static float defaultValue() { return 250; } }; struct SymbolAvoidEdges : LayoutProperty { - static constexpr const char * key = "symbol-avoid-edges"; + static constexpr const char *name() { return "symbol-avoid-edges"; } static bool defaultValue() { return false; } }; struct SymbolZOrder : LayoutProperty { - static constexpr const char * key = "symbol-z-order"; + static constexpr const char *name() { return "symbol-z-order"; } static SymbolZOrderType defaultValue() { return SymbolZOrderType::ViewportY; } }; struct IconAllowOverlap : LayoutProperty { - static constexpr const char * key = "icon-allow-overlap"; + static constexpr const char *name() { return "icon-allow-overlap"; } static bool defaultValue() { return false; } }; struct IconIgnorePlacement : LayoutProperty { - static constexpr const char * key = "icon-ignore-placement"; + static constexpr const char *name() { return "icon-ignore-placement"; } static bool defaultValue() { return false; } }; struct IconOptional : LayoutProperty { - static constexpr const char * key = "icon-optional"; + static constexpr const char *name() { return "icon-optional"; } static bool defaultValue() { return false; } }; struct IconRotationAlignment : LayoutProperty { - static constexpr const char * key = "icon-rotation-alignment"; + static constexpr const char *name() { return "icon-rotation-alignment"; } static AlignmentType defaultValue() { return AlignmentType::Auto; } }; struct IconSize : DataDrivenLayoutProperty { - static constexpr const char * key = "icon-size"; + static constexpr const char *name() { return "icon-size"; } static float defaultValue() { return 1; } }; struct IconTextFit : LayoutProperty { - static constexpr const char * key = "icon-text-fit"; + static constexpr const char *name() { return "icon-text-fit"; } static IconTextFitType defaultValue() { return IconTextFitType::None; } }; struct IconTextFitPadding : LayoutProperty> { - static constexpr const char * key = "icon-text-fit-padding"; + static constexpr const char *name() { return "icon-text-fit-padding"; } static std::array defaultValue() { return {{ 0, 0, 0, 0 }}; } }; struct IconImage : DataDrivenLayoutProperty { - static constexpr const char * key = "icon-image"; + static constexpr const char *name() { return "icon-image"; } static std::string defaultValue() { return ""; } }; struct IconRotate : DataDrivenLayoutProperty { - static constexpr const char * key = "icon-rotate"; + static constexpr const char *name() { return "icon-rotate"; } static float defaultValue() { return 0; } }; struct IconPadding : LayoutProperty { - static constexpr const char * key = "icon-padding"; + static constexpr const char *name() { return "icon-padding"; } static float defaultValue() { return 2; } }; struct IconKeepUpright : LayoutProperty { - static constexpr const char * key = "icon-keep-upright"; + static constexpr const char *name() { return "icon-keep-upright"; } static bool defaultValue() { return false; } }; struct IconOffset : DataDrivenLayoutProperty> { - static constexpr const char * key = "icon-offset"; + static constexpr const char *name() { return "icon-offset"; } static std::array defaultValue() { return {{ 0, 0 }}; } }; struct IconAnchor : DataDrivenLayoutProperty { - static constexpr const char * key = "icon-anchor"; + static constexpr const char *name() { return "icon-anchor"; } static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; } }; struct IconPitchAlignment : LayoutProperty { - static constexpr const char * key = "icon-pitch-alignment"; + static constexpr const char *name() { return "icon-pitch-alignment"; } static AlignmentType defaultValue() { return AlignmentType::Auto; } }; struct TextPitchAlignment : LayoutProperty { - static constexpr const char * key = "text-pitch-alignment"; + static constexpr const char *name() { return "text-pitch-alignment"; } static AlignmentType defaultValue() { return AlignmentType::Auto; } }; struct TextRotationAlignment : LayoutProperty { - static constexpr const char * key = "text-rotation-alignment"; + static constexpr const char *name() { return "text-rotation-alignment"; } static AlignmentType defaultValue() { return AlignmentType::Auto; } }; struct TextField : DataDrivenLayoutProperty { - static constexpr const char * key = "text-field"; + static constexpr const char *name() { return "text-field"; } static expression::Formatted defaultValue() { return ""; } }; struct TextFont : DataDrivenLayoutProperty> { - static constexpr const char * key = "text-font"; + static constexpr const char *name() { return "text-font"; } static std::vector defaultValue() { return { "Open Sans Regular", "Arial Unicode MS Regular" }; } }; struct TextSize : DataDrivenLayoutProperty { - static constexpr const char * key = "text-size"; + static constexpr const char *name() { return "text-size"; } static float defaultValue() { return 16; } }; struct TextMaxWidth : DataDrivenLayoutProperty { - static constexpr const char * key = "text-max-width"; + static constexpr const char *name() { return "text-max-width"; } static float defaultValue() { return 10; } }; struct TextLineHeight : LayoutProperty { - static constexpr const char * key = "text-line-height"; + static constexpr const char *name() { return "text-line-height"; } static float defaultValue() { return 1.2; } }; struct TextLetterSpacing : DataDrivenLayoutProperty { - static constexpr const char * key = "text-letter-spacing"; + static constexpr const char *name() { return "text-letter-spacing"; } static float defaultValue() { return 0; } }; struct TextJustify : DataDrivenLayoutProperty { - static constexpr const char * key = "text-justify"; + static constexpr const char *name() { return "text-justify"; } static TextJustifyType defaultValue() { return TextJustifyType::Center; } }; struct TextAnchor : DataDrivenLayoutProperty { - static constexpr const char * key = "text-anchor"; + static constexpr const char *name() { return "text-anchor"; } static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; } }; struct TextMaxAngle : LayoutProperty { - static constexpr const char * key = "text-max-angle"; + static constexpr const char *name() { return "text-max-angle"; } static float defaultValue() { return 45; } }; struct TextRotate : DataDrivenLayoutProperty { - static constexpr const char * key = "text-rotate"; + static constexpr const char *name() { return "text-rotate"; } static float defaultValue() { return 0; } }; struct TextPadding : LayoutProperty { - static constexpr const char * key = "text-padding"; + static constexpr const char *name() { return "text-padding"; } static float defaultValue() { return 2; } }; struct TextKeepUpright : LayoutProperty { - static constexpr const char * key = "text-keep-upright"; + static constexpr const char *name() { return "text-keep-upright"; } static bool defaultValue() { return true; } }; struct TextTransform : DataDrivenLayoutProperty { - static constexpr const char * key = "text-transform"; + static constexpr const char *name() { return "text-transform"; } static TextTransformType defaultValue() { return TextTransformType::None; } }; struct TextOffset : DataDrivenLayoutProperty> { - static constexpr const char * key = "text-offset"; + static constexpr const char *name() { return "text-offset"; } static std::array defaultValue() { return {{ 0, 0 }}; } }; struct TextAllowOverlap : LayoutProperty { - static constexpr const char * key = "text-allow-overlap"; + static constexpr const char *name() { return "text-allow-overlap"; } static bool defaultValue() { return false; } }; struct TextIgnorePlacement : LayoutProperty { - static constexpr const char * key = "text-ignore-placement"; + static constexpr const char *name() { return "text-ignore-placement"; } static bool defaultValue() { return false; } }; struct TextOptional : LayoutProperty { - static constexpr const char * key = "text-optional"; + static constexpr const char *name() { return "text-optional"; } static bool defaultValue() { return false; } }; -- cgit v1.2.1