summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-03-19 21:22:23 +0000
committerCarl Hetherington <cth@carlh.net>2019-03-19 21:22:23 +0000
commitbe5d6b54ffbc96c2b7823356c0b79583784ca91d (patch)
tree51cedf3114e4b6ab9830ca346b2f41b1a2a5fc03 /src
parent670c528a584d96e8bb6009f996204e9ecf174f54 (diff)
Add some more conversions.
Diffstat (limited to 'src')
-rw-r--r--src/cxml.cc16
-rw-r--r--src/cxml.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/cxml.cc b/src/cxml.cc
index 82e4bc3..78f75ee 100644
--- a/src/cxml.cc
+++ b/src/cxml.cc
@@ -331,6 +331,15 @@ locale_convert (string x)
}
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)
{
@@ -356,6 +365,13 @@ cxml::raw_convert (string v)
}
template <>
+long int
+cxml::raw_convert (string v)
+{
+ return locale_convert<long int> (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
@@ -83,6 +83,10 @@ int
raw_convert (std::string v);
template <>
+long int
+raw_convert (std::string v);
+
+template <>
float
raw_convert (std::string v);