aboutsummaryrefslogtreecommitdiff
path: root/src/utilstrencodings.h
diff options
context:
space:
mode:
author251 <13120787+251Labs@users.noreply.github.com>2018-07-22 21:34:45 +0200
committer251 <13120787+251Labs@users.noreply.github.com>2018-07-22 21:34:45 +0200
commite3245f2e7b6f98cda38a3806da854f7d513fec2f (patch)
tree84407bc96e5c75f252079bdb3a8d07fa6f4314b9 /src/utilstrencodings.h
parent0a34593ddb7a6d10c19533754d7a23345a155986 (diff)
Removes Boost predicate.hpp dependency
This is a squashed commit that squashes the following commits: This commit removes the `boost/algorithm/string/predicate.hpp` dependenc from the project by replacing the function calls to `boost::algorithm::starts_with` `boost::algorithm::ends_with` and `all` with respectively C++11' `std::basic_string::front`, `std::basic_string::back`, `std::all_of` function calls This commit replaces `boost::algorithm::is_digit` with a locale independent isdigi function, because the use of the standard library's `isdigit` and `std::isdigit functions is discoraged in the developer notes
Diffstat (limited to 'src/utilstrencodings.h')
-rw-r--r--src/utilstrencodings.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utilstrencodings.h b/src/utilstrencodings.h
index 1c9cca90b2..47f9afba1c 100644
--- a/src/utilstrencodings.h
+++ b/src/utilstrencodings.h
@@ -62,6 +62,16 @@ int64_t atoi64(const std::string& str);
int atoi(const std::string& str);
/**
+ * Tests if the given character is a decimal digit.
+ * @param[in] c character to test
+ * @return true if the argument is a decimal digit; otherwise false.
+ */
+constexpr bool IsDigit(char c)
+{
+ return c >= '0' && c <= '9';
+}
+
+/**
* Convert string to signed 32-bit integer with strict parse error feedback.
* @returns true if the entire string could be parsed as valid integer,
* false if not the entire string could be parsed or when overflow or underflow occurred.