Add some more conversions.
authorCarl Hetherington <cth@carlh.net>
Tue, 19 Mar 2019 21:22:23 +0000 (21:22 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 19 Mar 2019 21:22:23 +0000 (21:22 +0000)
src/cxml.cc
src/cxml.h

index 82e4bc3eca909fe9961dcfe24c6860b73eaaa930..78f75eeef24254365887c395ba8de78dfa6d9126 100644 (file)
@@ -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<int> (make_local(v));
 }
 
+template <>
+long int
+cxml::raw_convert (string v)
+{
+       return locale_convert<long int> (make_local(v));
+}
+
 template <>
 float
 cxml::raw_convert (string v)
index bd9db003721f8ec78af0c0301e38adfb8549afd3..a2d5b88b3aeb423db5918d16dd50fa52e512157e 100644 (file)
@@ -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);