diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/expression/array_assertion.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/expression/at.cpp | 5 | ||||
-rw-r--r-- | src/mbgl/style/expression/case.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/expression/coercion.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/expression/compound_expression.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/expression/interpolate.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/expression/let.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/expression/literal.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/expression/match.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/style/expression/parsing_context.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/expression/step.cpp | 3 |
11 files changed, 31 insertions, 20 deletions
diff --git a/src/mbgl/style/expression/array_assertion.cpp b/src/mbgl/style/expression/array_assertion.cpp index a62f67fbb5..29f6a47b10 100644 --- a/src/mbgl/style/expression/array_assertion.cpp +++ b/src/mbgl/style/expression/array_assertion.cpp @@ -1,5 +1,6 @@ #include <mbgl/style/expression/array_assertion.hpp> #include <mbgl/style/expression/check_subtype.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -36,7 +37,7 @@ ParseResult ArrayAssertion::parse(const Convertible& value, ParsingContext& ctx) auto length = arrayLength(value); if (length < 2 || length > 4) { - ctx.error("Expected 1, 2, or 3 arguments, but found " + std::to_string(length - 1) + " instead."); + ctx.error("Expected 1, 2, or 3 arguments, but found " + util::toString(length - 1) + " instead."); return ParseResult(); } diff --git a/src/mbgl/style/expression/at.cpp b/src/mbgl/style/expression/at.cpp index d9beb63b52..e447d33bc7 100644 --- a/src/mbgl/style/expression/at.cpp +++ b/src/mbgl/style/expression/at.cpp @@ -1,4 +1,5 @@ #include <mbgl/style/expression/at.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { @@ -21,7 +22,7 @@ EvaluationResult At::evaluate(const EvaluationContext& params) const { if (i < 0 || i >= inputArray.size()) { return EvaluationError { "Array index out of bounds: " + stringify(i) + - " > " + std::to_string(inputArray.size()) + "." + " > " + util::toString(inputArray.size()) + "." }; } if (i != std::floor(i)) { @@ -43,7 +44,7 @@ ParseResult At::parse(const Convertible& value, ParsingContext& ctx) { std::size_t length = arrayLength(value); if (length != 3) { - ctx.error("Expected 2 arguments, but found " + std::to_string(length - 1) + " instead."); + ctx.error("Expected 2 arguments, but found " + util::toString(length - 1) + " instead."); return ParseResult(); } diff --git a/src/mbgl/style/expression/case.cpp b/src/mbgl/style/expression/case.cpp index a435b71fc5..049f258606 100644 --- a/src/mbgl/style/expression/case.cpp +++ b/src/mbgl/style/expression/case.cpp @@ -1,4 +1,5 @@ #include <mbgl/style/expression/case.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -38,7 +39,7 @@ ParseResult Case::parse(const Convertible& value, ParsingContext& ctx) { assert(isArray(value)); auto length = arrayLength(value); if (length < 4) { - ctx.error("Expected at least 3 arguments, but found only " + std::to_string(length - 1) + "."); + ctx.error("Expected at least 3 arguments, but found only " + util::toString(length - 1) + "."); return ParseResult(); } diff --git a/src/mbgl/style/expression/coercion.cpp b/src/mbgl/style/expression/coercion.cpp index f2042ffd8f..8ed8e160dd 100644 --- a/src/mbgl/style/expression/coercion.cpp +++ b/src/mbgl/style/expression/coercion.cpp @@ -1,6 +1,7 @@ #include <mbgl/style/expression/coercion.hpp> #include <mbgl/style/expression/check_subtype.hpp> #include <mbgl/style/expression/util.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -11,7 +12,7 @@ EvaluationResult toNumber(const Value& v) { [](const double f) -> optional<double> { return f; }, [](const std::string& s) -> optional<double> { try { - return std::stof(s); + return util::stof(s); } catch(std::exception) { return optional<double>(); } diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index c1e0639562..fa79357560 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -2,7 +2,9 @@ #include <mbgl/style/expression/check_subtype.hpp> #include <mbgl/style/expression/util.hpp> #include <mbgl/tile/geometry_tile_data.hpp> +#include <mbgl/math/log2.hpp> #include <mbgl/util/ignore.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -350,7 +352,7 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali define("sqrt", [](double x) -> Result<double> { return sqrt(x); }); define("log10", [](double x) -> Result<double> { return log10(x); }); define("ln", [](double x) -> Result<double> { return log(x); }); - define("log2", [](double x) -> Result<double> { return log2(x); }); + define("log2", [](double x) -> Result<double> { return util::log2(x); }); define("sin", [](double x) -> Result<double> { return sin(x); }); define("cos", [](double x) -> Result<double> { return cos(x); }); define("tan", [](double x) -> Result<double> { return tan(x); }); @@ -501,8 +503,8 @@ ParseResult createCompoundExpression(const std::string& name, const std::vector<type::Type>& params = signature->params.get<std::vector<type::Type>>(); if (params.size() != args.size()) { signatureContext.error( - "Expected " + std::to_string(params.size()) + - " arguments, but found " + std::to_string(args.size()) + " instead." + "Expected " + util::toString(params.size()) + + " arguments, but found " + util::toString(args.size()) + " instead." ); continue; } diff --git a/src/mbgl/style/expression/interpolate.cpp b/src/mbgl/style/expression/interpolate.cpp index 020aba9dce..5ddfca8e9f 100644 --- a/src/mbgl/style/expression/interpolate.cpp +++ b/src/mbgl/style/expression/interpolate.cpp @@ -1,5 +1,5 @@ - #include <mbgl/style/expression/interpolate.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -73,7 +73,7 @@ ParseResult parseInterpolate(const Convertible& value, ParsingContext& ctx) { std::size_t minArgs = 4; if (length - 1 < minArgs) { - ctx.error("Expected at least 4 arguments, but found only " + std::to_string(length - 1) + "."); + ctx.error("Expected at least 4 arguments, but found only " + util::toString(length - 1) + "."); return ParseResult(); } diff --git a/src/mbgl/style/expression/let.cpp b/src/mbgl/style/expression/let.cpp index 8e206d3582..561e8515d4 100644 --- a/src/mbgl/style/expression/let.cpp +++ b/src/mbgl/style/expression/let.cpp @@ -1,5 +1,6 @@ #include <mbgl/style/expression/let.hpp> #include <mbgl/style/conversion/get_json_type.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -24,7 +25,7 @@ ParseResult Let::parse(const Convertible& value, ParsingContext& ctx) { std::size_t length = arrayLength(value); if (length < 4) { - ctx.error("Expected at least 3 arguments, but found " + std::to_string(length - 1) + " instead."); + ctx.error("Expected at least 3 arguments, but found " + util::toString(length - 1) + " instead."); return ParseResult(); } diff --git a/src/mbgl/style/expression/literal.cpp b/src/mbgl/style/expression/literal.cpp index fc11878bea..7e79fcbfe6 100644 --- a/src/mbgl/style/expression/literal.cpp +++ b/src/mbgl/style/expression/literal.cpp @@ -1,5 +1,5 @@ - #include <mbgl/style/expression/literal.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -70,7 +70,7 @@ ParseResult Literal::parse(const Convertible& value, ParsingContext& ctx) { } else if (isArray(value)) { // object or array value, quoted with ["literal", value] if (arrayLength(value) != 2) { - ctx.error("'literal' expression requires exactly one argument, but found " + std::to_string(arrayLength(value) - 1) + " instead."); + ctx.error("'literal' expression requires exactly one argument, but found " + util::toString(arrayLength(value) - 1) + " instead."); return ParseResult(); } const optional<Value> parsedValue = parseValue(arrayMember(value, 1), ctx); diff --git a/src/mbgl/style/expression/match.cpp b/src/mbgl/style/expression/match.cpp index 6336eba1e6..35356747c9 100644 --- a/src/mbgl/style/expression/match.cpp +++ b/src/mbgl/style/expression/match.cpp @@ -1,6 +1,7 @@ #include <mbgl/style/expression/match.hpp> #include <mbgl/style/expression/check_subtype.hpp> #include <mbgl/style/expression/parsing_context.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { namespace style { @@ -75,7 +76,7 @@ optional<InputType> parseInputValue(const Convertible& input, ParsingContext& pa value->match( [&] (uint64_t n) { if (!Value::isSafeInteger(n)) { - parentContext.error("Branch labels must be integers no larger than " + std::to_string(Value::maxSafeInteger()) + ".", index); + parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else { type = {type::Number}; result = {static_cast<int64_t>(n)}; @@ -83,7 +84,7 @@ optional<InputType> parseInputValue(const Convertible& input, ParsingContext& pa }, [&] (int64_t n) { if (!Value::isSafeInteger(n)) { - parentContext.error("Branch labels must be integers no larger than " + std::to_string(Value::maxSafeInteger()) + ".", index); + parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else { type = {type::Number}; result = {n}; @@ -91,7 +92,7 @@ optional<InputType> parseInputValue(const Convertible& input, ParsingContext& pa }, [&] (double n) { if (!Value::isSafeInteger(n)) { - parentContext.error("Branch labels must be integers no larger than " + std::to_string(Value::maxSafeInteger()) + ".", index); + parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else if (n != std::floor(n)) { parentContext.error("Numeric branch labels must be integer values.", index); } else { @@ -167,7 +168,7 @@ ParseResult parseMatch(const Convertible& value, ParsingContext& ctx) { auto length = arrayLength(value); if (length < 5) { ctx.error( - "Expected at least 4 arguments, but found only " + std::to_string(length - 1) + "." + "Expected at least 4 arguments, but found only " + util::toString(length - 1) + "." ); return ParseResult(); } diff --git a/src/mbgl/style/expression/parsing_context.cpp b/src/mbgl/style/expression/parsing_context.cpp index 81cbdede59..501ba2749f 100644 --- a/src/mbgl/style/expression/parsing_context.cpp +++ b/src/mbgl/style/expression/parsing_context.cpp @@ -23,6 +23,8 @@ #include <mbgl/style/conversion/get_json_type.hpp> +#include <mbgl/util/string.hpp> + namespace mbgl { namespace style { namespace expression { @@ -55,7 +57,7 @@ bool isConstant(const Expression& expression) { using namespace mbgl::style::conversion; ParseResult ParsingContext::parse(const Convertible& value, std::size_t index_, optional<type::Type> expected_) { - ParsingContext child(key + "[" + std::to_string(index_) + "]", + ParsingContext child(key + "[" + util::toString(index_) + "]", errors, std::move(expected_), scope); @@ -64,7 +66,7 @@ ParseResult ParsingContext::parse(const Convertible& value, std::size_t index_, ParseResult ParsingContext::parse(const Convertible& value, std::size_t index_, optional<type::Type> expected_, const std::map<std::string, std::shared_ptr<Expression>>& bindings) { - ParsingContext child(key + "[" + std::to_string(index_) + "]", + ParsingContext child(key + "[" + util::toString(index_) + "]", errors, std::move(expected_), std::make_shared<detail::Scope>(bindings, scope)); diff --git a/src/mbgl/style/expression/step.cpp b/src/mbgl/style/expression/step.cpp index 2720e9257a..bfcb6fd270 100644 --- a/src/mbgl/style/expression/step.cpp +++ b/src/mbgl/style/expression/step.cpp @@ -1,5 +1,6 @@ #include <mbgl/style/expression/step.hpp> #include <mbgl/style/expression/get_covering_stops.hpp> +#include <mbgl/util/string.hpp> namespace mbgl { @@ -50,7 +51,7 @@ ParseResult Step::parse(const mbgl::style::conversion::Convertible& value, Parsi auto length = arrayLength(value); if (length - 1 < 4) { - ctx.error("Expected at least 4 arguments, but found only " + std::to_string(length - 1) + "."); + ctx.error("Expected at least 4 arguments, but found only " + util::toString(length - 1) + "."); return ParseResult(); } |