]> git.lyx.org Git - lyx.git/blob - src/support/tostr.C
tostr -> convert and some bformat work
[lyx.git] / src / support / tostr.C
1 /**
2  * \file tostr.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "tostr.h"
15
16 #include <boost/lexical_cast.hpp>
17
18 using boost::lexical_cast;
19
20 using std::string;
21
22
23 template<>
24 string convert<string>(bool b)
25 {
26         return (b ? "true" : "false");
27 }
28
29
30 template<>
31 string convert<string>(char c)
32 {
33         return string(1, c);
34 }
35
36
37 template<>
38 string convert<string>(short unsigned int sui)
39 {
40         return lexical_cast<string>(sui);
41 }
42
43
44 template<>
45 string convert<string>(int i)
46 {
47         return lexical_cast<string>(i);
48 }
49
50
51 template<>
52 string convert<string>(unsigned int ui)
53 {
54         return lexical_cast<string>(ui);
55 }
56
57
58 template<>
59 string convert<string>(float f)
60 {
61         return lexical_cast<string>(f);
62 }
63
64
65 template<>
66 string convert<string>(double d)
67 {
68         return lexical_cast<string>(d);
69 }