From be5d6b54ffbc96c2b7823356c0b79583784ca91d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 19 Mar 2019 21:22:23 +0000 Subject: [PATCH] Add some more conversions. --- src/cxml.cc | 16 ++++++++++++++++ src/cxml.h | 4 ++++ 2 files changed, 20 insertions(+) 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); -- 2.30.2