diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-30 15:04:41 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-30 17:17:38 -0700 |
commit | 9a1bb1ad14e18433d4cc8e805af57a6014275561 (patch) | |
tree | 60533ceadc7bebe48d655041b9c4dbcf4133c32a /include/mbgl/style/conversion/custom_geometry_source_options.hpp | |
parent | bf7785618ac5f3bbcba068e61ef6359d70aff92b (diff) | |
download | qtlocation-mapboxgl-9a1bb1ad14e18433d4cc8e805af57a6014275561.tar.gz |
[core] Tweak conversions to reduce binary size
* return {} → return nullopt
* error = { "..." } → error.message = "..."
Diffstat (limited to 'include/mbgl/style/conversion/custom_geometry_source_options.hpp')
-rw-r--r-- | include/mbgl/style/conversion/custom_geometry_source_options.hpp | 69 |
1 files changed, 1 insertions, 68 deletions
diff --git a/include/mbgl/style/conversion/custom_geometry_source_options.hpp b/include/mbgl/style/conversion/custom_geometry_source_options.hpp index dedecd1aa4..f0f505e54f 100644 --- a/include/mbgl/style/conversion/custom_geometry_source_options.hpp +++ b/include/mbgl/style/conversion/custom_geometry_source_options.hpp @@ -9,74 +9,7 @@ namespace conversion { template <> struct Converter<CustomGeometrySource::Options> { - - template <class V> - optional<CustomGeometrySource::Options> operator()(const V& value, Error& error) const { - CustomGeometrySource::Options options; - - const auto minzoomValue = objectMember(value, "minzoom"); - if (minzoomValue) { - if (toNumber(*minzoomValue)) { - options.zoomRange.min = static_cast<uint8_t>(*toNumber(*minzoomValue)); - } else { - error = { "GeoJSON source minzoom value must be a number" }; - return {}; - } - } - - const auto maxzoomValue = objectMember(value, "maxzoom"); - if (maxzoomValue) { - if (toNumber(*maxzoomValue)) { - options.zoomRange.max = static_cast<uint8_t>(*toNumber(*maxzoomValue)); - } else { - error = { "GeoJSON source maxzoom value must be a number" }; - return {}; - } - } - - const auto bufferValue = objectMember(value, "buffer"); - if (bufferValue) { - if (toNumber(*bufferValue)) { - options.tileOptions.buffer = static_cast<uint16_t>(*toNumber(*bufferValue)); - } else { - error = { "GeoJSON source buffer value must be a number" }; - return {}; - } - } - - const auto toleranceValue = objectMember(value, "tolerance"); - if (toleranceValue) { - if (toNumber(*toleranceValue)) { - options.tileOptions.tolerance = static_cast<double>(*toNumber(*toleranceValue)); - } else { - error = { "GeoJSON source tolerance value must be a number" }; - return {}; - } - } - - const auto wrapValue = objectMember(value, "wrap"); - if (wrapValue) { - if (toBool(*wrapValue)) { - options.tileOptions.wrap = static_cast<bool>(*toBool(*wrapValue)); - } else { - error = { "CustomGeometrySource TileOptions wrap value must be a boolean" }; - return {}; - } - } - - const auto clipValue = objectMember(value, "clip"); - if (clipValue) { - if (toBool(*clipValue)) { - options.tileOptions.clip = static_cast<double>(*toBool(*clipValue)); - } else { - error = { "CustomGeometrySource TileOptiosn clip value must be a boolean" }; - return {}; - } - } - - return { options }; - } - + optional<CustomGeometrySource::Options> operator()(const Convertible& value, Error& error) const; }; } // namespace conversion |