diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp index de061647b..82d317c62 100644 --- a/include/mbgl/util/string.hpp +++ b/include/mbgl/util/string.hpp @@ -1,9 +1,34 @@ #pragma once +#include #include #include +#include #include +// Polyfill needed by Qt when building for Android with GCC +#if defined(__ANDROID__) && defined(__GLIBCXX__) + +namespace std { + +template +std::string to_string(T value) +{ + std::ostringstream oss; + oss << value; + + return oss.str(); +} + +inline int stoi(const std::string &str) +{ + return atoi(str.c_str()); +} + +} // namespace std + +#endif + namespace mbgl { namespace util { diff --git a/src/mbgl/annotation/shape_annotation_impl.hpp b/src/mbgl/annotation/shape_annotation_impl.hpp index ed9e8d015..caf2cff1a 100644 --- a/src/mbgl/annotation/shape_annotation_impl.hpp +++ b/src/mbgl/annotation/shape_annotation_impl.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index 467b44632..a83897dbf 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -8,6 +8,7 @@ #include #include +#include #include diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp index be347af2a..efa4018b4 100644 --- a/src/mbgl/style/sources/geojson_source_impl.cpp +++ b/src/mbgl/style/sources/geojson_source_impl.cpp @@ -1,10 +1,13 @@ #include #include #include +#include #include #include +#include + namespace mbgl { namespace style { @@ -52,14 +55,14 @@ GeoJSONSource::Impl::Impl(const Impl& other, const GeoJSON& geoJSON) mapbox::supercluster::Options clusterOptions; clusterOptions.maxZoom = options.clusterMaxZoom; clusterOptions.extent = util::EXTENT; - clusterOptions.radius = std::round(scale * options.clusterRadius); + clusterOptions.radius = ::round(scale * options.clusterRadius); data = std::make_unique( geoJSON.get>(), clusterOptions); } else { mapbox::geojsonvt::Options vtOptions; vtOptions.maxZoom = options.maxzoom; vtOptions.extent = util::EXTENT; - vtOptions.buffer = std::round(scale * options.buffer); + vtOptions.buffer = ::round(scale * options.buffer); vtOptions.tolerance = scale * options.tolerance; data = std::make_unique(geoJSON, vtOptions); } diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp index c81f25d4e..6c7ecff42 100644 --- a/src/mbgl/text/shaping.cpp +++ b/src/mbgl/text/shaping.cpp @@ -7,6 +7,7 @@ #include #include +#include namespace mbgl { @@ -72,7 +73,7 @@ float determineAverageLineWidth(const std::u16string& logicalInput, } } - int32_t targetLineCount = std::fmax(1, std::ceil(totalWidth / maxWidth)); + int32_t targetLineCount = ::fmax(1, std::ceil(totalWidth / maxWidth)); return totalWidth / targetLineCount; } diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index d5e2e14e5..f6861140b 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/src/mbgl/util/dtoa.cpp b/src/mbgl/util/dtoa.cpp index 6ca3e19c3..0e3aef611 100644 --- a/src/mbgl/util/dtoa.cpp +++ b/src/mbgl/util/dtoa.cpp @@ -6,6 +6,8 @@ #include #endif +#include + namespace mbgl { namespace util { diff --git a/src/mbgl/util/http_header.cpp b/src/mbgl/util/http_header.cpp index 40711232f..ce31a06c5 100644 --- a/src/mbgl/util/http_header.cpp +++ b/src/mbgl/util/http_header.cpp @@ -1,5 +1,7 @@ #include +#include + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wunused-parameter"