summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-12-20 15:46:10 -0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2017-01-24 11:36:59 +0200
commit3e2fc894f73e5750ad365d7ca3563d535928a17b (patch)
treec591010796fe128a090aaf721e3a558cf3bbe798
parent9833ca8b76e9608ba9c3a8928de93b1fb9be3a45 (diff)
downloadqtlocation-mapboxgl-3e2fc894f73e5750ad365d7ca3563d535928a17b.tar.gz
[gcc4.9] std:: namespace issues
-rw-r--r--include/mbgl/util/string.hpp24
-rw-r--r--src/3rd_party/polylabel/include/mapbox/polylabel.hpp4
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.hpp1
-rw-r--r--src/mbgl/layout/symbol_layout.cpp2
-rw-r--r--src/mbgl/style/parser.cpp1
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp6
-rw-r--r--src/mbgl/text/glyph_set.cpp3
-rw-r--r--src/mbgl/tile/geojson_tile.cpp1
-rw-r--r--src/mbgl/util/dtoa.cpp2
-rw-r--r--src/mbgl/util/http_header.cpp2
10 files changed, 40 insertions, 6 deletions
diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp
index 202554c3a7..ee02422715 100644
--- a/include/mbgl/util/string.hpp
+++ b/include/mbgl/util/string.hpp
@@ -1,11 +1,35 @@
#pragma once
+#include <sstream>
#include <string>
#include <cassert>
+#include <cstdlib>
#include <exception>
#include <mbgl/util/dtoa.hpp>
+#if defined(__ANDROID__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
+
+namespace std {
+
+template <typename T>
+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/3rd_party/polylabel/include/mapbox/polylabel.hpp b/src/3rd_party/polylabel/include/mapbox/polylabel.hpp
index 3c6bb75c89..0e9e2b5433 100644
--- a/src/3rd_party/polylabel/include/mapbox/polylabel.hpp
+++ b/src/3rd_party/polylabel/include/mapbox/polylabel.hpp
@@ -152,7 +152,7 @@ geometry::point<T> polylabel(const geometry::polygon<T>& polygon, T precision =
// update the best cell if we found a better one
if (cell.d > bestCell.d) {
bestCell = cell;
- if (debug) std::cout << "found best " << std::round(1e4 * cell.d) / 1e4 << " after " << numProbes << " probes" << std::endl;
+ if (debug) std::cout << "found best " << ::round(1e4 * cell.d) / 1e4 << " after " << numProbes << " probes" << std::endl;
}
// do not drill down further if there's no chance of a better solution
@@ -175,4 +175,4 @@ geometry::point<T> polylabel(const geometry::polygon<T>& polygon, T precision =
return bestCell.c;
}
-} // namespace mapbox \ No newline at end of file
+} // namespace mapbox
diff --git a/src/mbgl/annotation/shape_annotation_impl.hpp b/src/mbgl/annotation/shape_annotation_impl.hpp
index 800b4ec313..f257ead69d 100644
--- a/src/mbgl/annotation/shape_annotation_impl.hpp
+++ b/src/mbgl/annotation/shape_annotation_impl.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <mbgl/util/string.hpp>
#include <mapbox/geojsonvt.hpp>
#include <mbgl/annotation/annotation.hpp>
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index eaa0332995..7e523eb9ec 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -484,7 +484,7 @@ void SymbolLayout::addSymbols(Buffer &buffer, const SymbolQuads &symbols, float
uint16_t index = segment.vertexLength;
// Encode angle of glyph
- uint8_t glyphAngle = std::round((symbol.glyphAngle / (M_PI * 2)) * 256);
+ uint8_t glyphAngle = ::round((symbol.glyphAngle / (M_PI * 2)) * 256);
// coordinates (2 triangles)
buffer.vertices.emplace_back(SymbolAttributes::vertex(anchorPoint, tl, tex.x, tex.y,
diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp
index c6c6e50dd7..c45daa7b44 100644
--- a/src/mbgl/style/parser.cpp
+++ b/src/mbgl/style/parser.cpp
@@ -7,6 +7,7 @@
#include <mbgl/util/logging.hpp>
+#include <mbgl/util/string.hpp>
#include <mapbox/geojsonvt.hpp>
#include <rapidjson/document.h>
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index 3f3bc879f7..29eff1e244 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -6,6 +6,7 @@
#include <mbgl/tile/geojson_tile.hpp>
#include <mbgl/util/rapidjson.hpp>
+#include <mbgl/util/string.hpp>
#include <mapbox/geojson.hpp>
#include <mapbox/geojson/rapidjson.hpp>
#include <mapbox/geojsonvt.hpp>
@@ -14,6 +15,7 @@
#include <rapidjson/error/en.h>
+#include <cmath>
#include <sstream>
namespace mbgl {
@@ -69,7 +71,7 @@ void GeoJSONSource::Impl::_setGeoJSON(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);
const auto& features = geoJSON.get<mapbox::geometry::feature_collection<double>>();
geoJSONOrSupercluster =
@@ -78,7 +80,7 @@ void GeoJSONSource::Impl::_setGeoJSON(const GeoJSON& geoJSON) {
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;
geoJSONOrSupercluster = std::make_unique<mapbox::geojsonvt::GeoJSONVT>(geoJSON, vtOptions);
}
diff --git a/src/mbgl/text/glyph_set.cpp b/src/mbgl/text/glyph_set.cpp
index f9a90f9bb0..493cce61b8 100644
--- a/src/mbgl/text/glyph_set.cpp
+++ b/src/mbgl/text/glyph_set.cpp
@@ -7,6 +7,7 @@
#include <algorithm>
#include <cassert>
+#include <cmath>
namespace mbgl {
@@ -111,7 +112,7 @@ float GlyphSet::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 61437b79b1..a2f453f03d 100644
--- a/src/mbgl/tile/geojson_tile.cpp
+++ b/src/mbgl/tile/geojson_tile.cpp
@@ -1,6 +1,7 @@
#include <mbgl/tile/geojson_tile.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
+#include <mbgl/util/string.hpp>
#include <mapbox/geojsonvt.hpp>
#include <supercluster.hpp>
diff --git a/src/mbgl/util/dtoa.cpp b/src/mbgl/util/dtoa.cpp
index 578f844c72..737b121b97 100644
--- a/src/mbgl/util/dtoa.cpp
+++ b/src/mbgl/util/dtoa.cpp
@@ -1,5 +1,7 @@
#include "dtoa.hpp"
+#include <mbgl/util/string.hpp>
+
// Clang on Windows 64-bits can't parse rapidjson's dtoa
#if !defined(_WINDOWS)
#include <rapidjson/internal/dtoa.h>
diff --git a/src/mbgl/util/http_header.cpp b/src/mbgl/util/http_header.cpp
index e337d4c8ab..cad029567e 100644
--- a/src/mbgl/util/http_header.cpp
+++ b/src/mbgl/util/http_header.cpp
@@ -1,5 +1,7 @@
#include <mbgl/util/http_header.hpp>
+#include <mbgl/util/string.hpp>
+
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wunused-parameter"