]> git.lyx.org Git - lyx.git/blobdiff - src/support/convert.C
the convert patch
[lyx.git] / src / support / convert.C
index 800ae8fc99afd9015edf0a3a65c830013d3478e8..262f937addd8e60bb947e0ea2c9929959dd79ef0 100644 (file)
@@ -83,3 +83,38 @@ string convert<string>(double d)
 {
        return lexical_cast<string>(d);
 }
+
+
+template<>
+int convert<int>(string const s)
+{
+       return strtol(s.c_str(), 0, 10);
+}
+
+
+template<>
+unsigned int convert<unsigned int>(string const s)
+{
+       return strtoul(s.c_str(), 0, 10);
+}
+
+
+template<>
+double convert<double>(string const s)
+{
+       return strtod(s.c_str(), 0);
+}
+
+
+template<>
+int convert<int>(char const * cptr)
+{
+       return strtol(cptr, 0, 10);
+}
+
+
+template<>
+double convert<double>(char const * cptr)
+{
+       return strtod(cptr, 0);
+}