3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
16 #include <boost/lexical_cast.hpp>
20 using boost::lexical_cast;
26 string convert<string>(bool b)
28 return (b ? "true" : "false");
33 string convert<string>(char c)
40 string convert<string>(short unsigned int sui)
42 return lexical_cast<string>(sui);
47 string convert<string>(int i)
49 return lexical_cast<string>(i);
54 string convert<string>(unsigned int ui)
56 return lexical_cast<string>(ui);
61 string convert<string>(unsigned long ul)
63 return lexical_cast<string>(ul);
68 string convert<string>(long l)
70 return lexical_cast<string>(l);
75 string convert<string>(float f)
77 return lexical_cast<string>(f);
82 string convert<string>(double d)
84 return lexical_cast<string>(d);
89 int convert<int>(string const s)
91 return strtol(s.c_str(), 0, 10);
96 unsigned int convert<unsigned int>(string const s)
98 return strtoul(s.c_str(), 0, 10);
103 double convert<double>(string const s)
105 return strtod(s.c_str(), 0);
110 int convert<int>(char const * cptr)
112 return strtol(cptr, 0, 10);
117 double convert<double>(char const * cptr)
119 return strtod(cptr, 0);