From f7c73615a49d308040a4a5d40677ecab08c21841 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 12 Sep 2016 20:57:26 +0100 Subject: More raw_convert long/long stuff. --- src/locale_convert.cc | 11 ++++++++++- src/locale_convert.h | 6 +++++- src/raw_convert.cc | 7 +++++++ src/raw_convert.h | 4 ++++ 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/locale_convert.cc b/src/locale_convert.cc index 129ee50f..89c79759 100644 --- a/src/locale_convert.cc +++ b/src/locale_convert.cc @@ -185,7 +185,7 @@ dcp::locale_convert (string x, int, bool) } template<> -long int +long dcp::locale_convert (string x, int, bool) { long int y = 0; @@ -193,6 +193,15 @@ dcp::locale_convert (string x, int, bool) return y; } +template<> +long long +dcp::locale_convert (string x, int, bool) +{ + long long y = 0; + sscanf (x.c_str(), "%lld", &y); + return y; +} + template<> float dcp::locale_convert (string x, int, bool) diff --git a/src/locale_convert.h b/src/locale_convert.h index 05728409..ccce7b82 100644 --- a/src/locale_convert.h +++ b/src/locale_convert.h @@ -112,7 +112,11 @@ int locale_convert (std::string x, int, bool); template <> -long int +long +locale_convert (std::string x, int, bool); + +template <> +long long locale_convert (std::string x, int, bool); template <> diff --git a/src/raw_convert.cc b/src/raw_convert.cc index 432ce394..281772e7 100644 --- a/src/raw_convert.cc +++ b/src/raw_convert.cc @@ -166,6 +166,13 @@ dcp::raw_convert (string v, int precision, bool fixed) return locale_convert (make_local (v), precision, fixed); } +template <> +long long +dcp::raw_convert (string v, int precision, bool fixed) +{ + return locale_convert (make_local (v), precision, fixed); +} + template <> int dcp::raw_convert (char const * v, int precision, bool fixed) diff --git a/src/raw_convert.h b/src/raw_convert.h index 8ce5220e..af2a1e37 100644 --- a/src/raw_convert.h +++ b/src/raw_convert.h @@ -112,6 +112,10 @@ template <> long raw_convert (std::string v, int, bool); +template <> +long long +raw_convert (std::string v, int, bool); + template <> int raw_convert (char const * v, int, bool); -- cgit v1.2.3