From caa3f20cd224f88f7a785618b63000f44a06da3a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 23 Mar 2019 21:37:17 +0000 Subject: Add string -> long long conversion for OS X. --- src/cxml.cc | 20 ++++++++++++++++++++ src/cxml.h | 4 ++++ 2 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/cxml.cc b/src/cxml.cc index f667584..3fa3d94 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -348,6 +348,19 @@ locale_convert (string x) return y; } +template<> +long long +locale_convert (string x) +{ + long long y = 0; +#ifdef LIBCXML_WINDOWS + __mingw_sscanf (x.c_str(), "%lld", &y); +#else + sscanf (x.c_str(), "%lld", &y); +#endif + return y; +} + template<> float locale_convert (string x) @@ -380,6 +393,13 @@ cxml::raw_convert (string v) return locale_convert (make_local(v)); } +template <> +long long +cxml::raw_convert (string v) +{ + return locale_convert (make_local(v)); +} + template <> unsigned int cxml::raw_convert (string v) diff --git a/src/cxml.h b/src/cxml.h index 20a948a..bd04af1 100644 --- a/src/cxml.h +++ b/src/cxml.h @@ -90,6 +90,10 @@ template <> long int raw_convert (std::string v); +template <> +long long +raw_convert (std::string v); + template <> float raw_convert (std::string v); -- cgit v1.2.3