util/NumberParser: add overload with StringView

This commit is contained in:
Max Kellermann
2019-06-06 13:14:31 +02:00
parent e556cd20f7
commit 72a0aeb265
3 changed files with 56 additions and 0 deletions
+5
View File
@@ -35,6 +35,8 @@
#include <stdint.h>
#include <stdlib.h>
struct StringView;
static inline unsigned
ParseUnsigned(const char *p, char **endptr=nullptr, int base=10) noexcept
{
@@ -67,6 +69,9 @@ ParseInt64(const char *p, char **endptr=nullptr, int base=10) noexcept
return strtoll(p, endptr, base);
}
int64_t
ParseInt64(StringView s, const char **endptr_r=nullptr, int base=10) noexcept;
static inline double
ParseDouble(const char *p, char **endptr=nullptr) noexcept
{