Add another conversion.
authorCarl Hetherington <cth@carlh.net>
Fri, 22 Mar 2019 15:02:18 +0000 (15:02 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 22 Mar 2019 15:02:18 +0000 (15:02 +0000)
src/cxml.cc
src/cxml.h

index 78f75eeef24254365887c395ba8de78dfa6d9126..f667584f4fee595331061d0d401b90009356db00 100644 (file)
@@ -330,6 +330,15 @@ locale_convert (string x)
        return y;
 }
 
+template<>
+unsigned int
+locale_convert (string x)
+{
+       unsigned int y = 0;
+       sscanf (x.c_str(), "%u", &y);
+       return y;
+}
+
 template<>
 long int
 locale_convert (string x)
@@ -371,6 +380,13 @@ cxml::raw_convert (string v)
        return locale_convert<long int> (make_local(v));
 }
 
+template <>
+unsigned int
+cxml::raw_convert (string v)
+{
+       return locale_convert<unsigned int> (make_local(v));
+}
+
 template <>
 float
 cxml::raw_convert (string v)
index a2d5b88b3aeb423db5918d16dd50fa52e512157e..20a948ae29e920a5204e37cb2b91b53b0fb9a1d8 100644 (file)
@@ -82,6 +82,10 @@ template <>
 int
 raw_convert (std::string v);
 
+template <>
+unsigned int
+raw_convert (std::string v);
+
 template <>
 long int
 raw_convert (std::string v);