summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-09-12 20:57:26 +0100
committerCarl Hetherington <cth@carlh.net>2016-09-12 20:57:26 +0100
commitf7c73615a49d308040a4a5d40677ecab08c21841 (patch)
tree092fd21c74f330174e055d0b900e3ce9267417d8 /src
parent732f931e0559f29100b56f7f4a6e6be8820f0ff7 (diff)
More raw_convert long/long stuff.
Diffstat (limited to 'src')
-rw-r--r--src/locale_convert.cc11
-rw-r--r--src/locale_convert.h6
-rw-r--r--src/raw_convert.cc7
-rw-r--r--src/raw_convert.h4
4 files changed, 26 insertions, 2 deletions
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;
@@ -194,6 +194,15 @@ dcp::locale_convert (string x, int, bool)
}
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
@@ -167,6 +167,13 @@ dcp::raw_convert (string v, int precision, bool fixed)
}
template <>
+long long
+dcp::raw_convert (string v, int precision, bool fixed)
+{
+ return locale_convert<long long> (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
@@ -113,6 +113,10 @@ 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);