From: Carl Hetherington Date: Tue, 19 Mar 2019 21:22:23 +0000 (+0000) Subject: Add some more conversions. X-Git-Tag: v0.17.0~16 X-Git-Url: https://git.carlh.net/gitweb/?p=libcxml.git;a=commitdiff_plain;h=be5d6b54ffbc96c2b7823356c0b79583784ca91d Add some more conversions. --- diff --git a/src/cxml.cc b/src/cxml.cc index 82e4bc3..78f75ee 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -330,6 +330,15 @@ locale_convert (string x) return y; } +template<> +long int +locale_convert (string x) +{ + long int y = 0; + sscanf (x.c_str(), "%ld", &y); + return y; +} + template<> float locale_convert (string x) @@ -355,6 +364,13 @@ cxml::raw_convert (string v) return locale_convert (make_local(v)); } +template <> +long int +cxml::raw_convert (string v) +{ + return locale_convert (make_local(v)); +} + template <> float cxml::raw_convert (string v) diff --git a/src/cxml.h b/src/cxml.h index bd9db00..a2d5b88 100644 --- a/src/cxml.h +++ b/src/cxml.h @@ -82,6 +82,10 @@ template <> int raw_convert (std::string v); +template <> +long int +raw_convert (std::string v); + template <> float raw_convert (std::string v);