diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-25 13:34:41 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-25 13:34:41 -0700 |
commit | c1f40b9e711115c24d4a4e8464eb8d75f4004ddc (patch) | |
tree | a9911684c854fe702659ce02d0c7fe592daf4798 /src | |
parent | d20174270b2010c4842d20ad36cae48774d33272 (diff) | |
download | qtlocation-mapboxgl-c1f40b9e711115c24d4a4e8464eb8d75f4004ddc.tar.gz |
[core] Move enum type classes to implementation (#4831)
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/property_parsing.cpp | 58 | ||||
-rw-r--r-- | src/mbgl/style/style_parser.cpp | 5 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp index 9932451975..84589ea414 100644 --- a/src/mbgl/style/property_parsing.cpp +++ b/src/mbgl/style/property_parsing.cpp @@ -58,6 +58,11 @@ optional<Color> parseProperty(const char* name, const JSValue& value) { css_color.a}}; } +MBGL_DEFINE_ENUM_CLASS(TranslateAnchorTypeClass, TranslateAnchorType, { + { TranslateAnchorType::Map, "map" }, + { TranslateAnchorType::Viewport, "viewport" }, +}); + template <> optional<TranslateAnchorType> parseProperty(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -68,6 +73,11 @@ optional<TranslateAnchorType> parseProperty(const char* name, const JSValue& val return { TranslateAnchorTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(RotateAnchorTypeClass, RotateAnchorType, { + { RotateAnchorType::Map, "map" }, + { RotateAnchorType::Viewport, "viewport" }, +}); + template <> optional<RotateAnchorType> parseProperty<RotateAnchorType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -78,6 +88,12 @@ optional<RotateAnchorType> parseProperty<RotateAnchorType>(const char* name, con return { RotateAnchorTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(LineCapTypeClass, LineCapType, { + { LineCapType::Round, "round" }, + { LineCapType::Butt, "butt" }, + { LineCapType::Square, "square" }, +}); + template <> optional<LineCapType> parseProperty<LineCapType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -88,6 +104,14 @@ optional<LineCapType> parseProperty<LineCapType>(const char* name, const JSValue return { LineCapTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(LineJoinTypeClass, LineJoinType, { + { LineJoinType::Miter, "miter" }, + { LineJoinType::Bevel, "bevel" }, + { LineJoinType::Round, "round" }, + { LineJoinType::FakeRound, "fakeround" }, + { LineJoinType::FlipBevel, "flipbevel" }, +}); + template <> optional<LineJoinType> parseProperty<LineJoinType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -98,6 +122,11 @@ optional<LineJoinType> parseProperty<LineJoinType>(const char* name, const JSVal return { LineJoinTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(SymbolPlacementTypeClass, SymbolPlacementType, { + { SymbolPlacementType::Point, "point" }, + { SymbolPlacementType::Line, "line" }, +}); + template <> optional<SymbolPlacementType> parseProperty<SymbolPlacementType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -108,6 +137,18 @@ optional<SymbolPlacementType> parseProperty<SymbolPlacementType>(const char* nam return { SymbolPlacementTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(TextAnchorTypeClass, TextAnchorType, { + { TextAnchorType::Center, "center" }, + { TextAnchorType::Left, "left" }, + { TextAnchorType::Right, "right" }, + { TextAnchorType::Top, "top" }, + { TextAnchorType::Bottom, "bottom" }, + { TextAnchorType::TopLeft, "top-left" }, + { TextAnchorType::TopRight, "top-right" }, + { TextAnchorType::BottomLeft, "bottom-left" }, + { TextAnchorType::BottomRight, "bottom-right" } +}); + template <> optional<TextAnchorType> parseProperty<TextAnchorType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -118,6 +159,12 @@ optional<TextAnchorType> parseProperty<TextAnchorType>(const char* name, const J return { TextAnchorTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(TextJustifyTypeClass, TextJustifyType, { + { TextJustifyType::Center, "center" }, + { TextJustifyType::Left, "left" }, + { TextJustifyType::Right, "right" }, +}); + template <> optional<TextJustifyType> parseProperty<TextJustifyType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -128,6 +175,12 @@ optional<TextJustifyType> parseProperty<TextJustifyType>(const char* name, const return { TextJustifyTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(TextTransformTypeClass, TextTransformType, { + { TextTransformType::None, "none" }, + { TextTransformType::Uppercase, "uppercase" }, + { TextTransformType::Lowercase, "lowercase" }, +}); + template <> optional<TextTransformType> parseProperty<TextTransformType>(const char* name, const JSValue& value) { if (!value.IsString()) { @@ -138,6 +191,11 @@ optional<TextTransformType> parseProperty<TextTransformType>(const char* name, c return { TextTransformTypeClass({ value.GetString(), value.GetStringLength() }) }; } +MBGL_DEFINE_ENUM_CLASS(RotationAlignmentTypeClass, RotationAlignmentType, { + { RotationAlignmentType::Map, "map" }, + { RotationAlignmentType::Viewport, "viewport" }, +}); + template <> optional<RotationAlignmentType> parseProperty<RotationAlignmentType>(const char* name, const JSValue& value) { if (!value.IsString()) { diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp index ff0a3b13af..d99339b84a 100644 --- a/src/mbgl/style/style_parser.cpp +++ b/src/mbgl/style/style_parser.cpp @@ -481,6 +481,11 @@ void StyleParser::parseLayer(const std::string& id, const JSValue& value, std::u layer->parsePaints(value); } +MBGL_DEFINE_ENUM_CLASS(VisibilityTypeClass, VisibilityType, { + { VisibilityType::Visible, "visible" }, + { VisibilityType::None, "none" }, +}); + void StyleParser::parseVisibility(StyleLayer& layer, const JSValue& value) { if (!value.HasMember("visibility")) { return; |