summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-11-10 20:04:20 -0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-11-12 13:17:57 -0200
commit92608f58858d77c17a65ae9b29758e74bb2da7d2 (patch)
treef4b0287febdea20ae58d4dc31be294d50253b254 /include
parent465b345dd2d9e8ff95accecc84b6ec6ff24e0a2f (diff)
downloadqtlocation-mapboxgl-92608f58858d77c17a65ae9b29758e74bb2da7d2.tar.gz
[core] Fix build on Android + GCC and Android + armeabi
Sadly we don't have bots for these two setups.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/expression/parsing_context.hpp5
-rw-r--r--include/mbgl/style/expression/type.hpp3
-rw-r--r--include/mbgl/util/string.hpp8
3 files changed, 13 insertions, 3 deletions
diff --git a/include/mbgl/style/expression/parsing_context.hpp b/include/mbgl/style/expression/parsing_context.hpp
index 65c5ebe188..a983789cbd 100644
--- a/include/mbgl/style/expression/parsing_context.hpp
+++ b/include/mbgl/style/expression/parsing_context.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <mbgl/util/optional.hpp>
+#include <mbgl/util/string.hpp>
#include <mbgl/style/expression/type.hpp>
#include <mbgl/style/conversion.hpp>
@@ -104,11 +105,11 @@ public:
}
void error(std::string message, std::size_t child) {
- errors->push_back({message, key + "[" + std::to_string(child) + "]"});
+ errors->push_back({message, key + "[" + util::toString(child) + "]"});
}
void error(std::string message, std::size_t child, std::size_t grandchild) {
- errors->push_back({message, key + "[" + std::to_string(child) + "][" + std::to_string(grandchild) + "]"});
+ errors->push_back({message, key + "[" + util::toString(child) + "][" + util::toString(grandchild) + "]"});
}
void appendErrors(ParsingContext&& ctx) {
diff --git a/include/mbgl/style/expression/type.hpp b/include/mbgl/style/expression/type.hpp
index d801cd3ac9..da59eb001c 100644
--- a/include/mbgl/style/expression/type.hpp
+++ b/include/mbgl/style/expression/type.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <mbgl/util/optional.hpp>
+#include <mbgl/util/string.hpp>
#include <mbgl/util/variant.hpp>
#include <vector>
@@ -88,7 +89,7 @@ struct Array {
Array(Type itemType_, optional<std::size_t> N_) : itemType(std::move(itemType_)), N(std::move(N_)) {}
std::string getName() const {
if (N) {
- return "array<" + toString(itemType) + ", " + std::to_string(*N) + ">";
+ return "array<" + toString(itemType) + ", " + util::toString(*N) + ">";
} else if (itemType == Value) {
return "array";
} else {
diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp
index 82d317c620..13498ccb92 100644
--- a/include/mbgl/util/string.hpp
+++ b/include/mbgl/util/string.hpp
@@ -25,6 +25,10 @@ inline int stoi(const std::string &str)
return atoi(str.c_str());
}
+inline float stof(const std::string &str) {
+ return static_cast<float>(atof(str.c_str()));
+}
+
} // namespace std
#endif
@@ -65,5 +69,9 @@ inline std::string toString(std::exception_ptr error) {
}
}
+inline float stof(const std::string& str) {
+ return std::stof(str);
+}
+
} // namespace util
} // namespace mbgl