]> git.lyx.org Git - lyx.git/blob - src/support/convert.C
add specialization for unsigned long, and clean up header file
[lyx.git] / src / support / convert.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 "convert.h"
15
16 #include <boost/lexical_cast.hpp>
17
18 #include <string>
19
20 using boost::lexical_cast;
21
22 using std::string;
23
24
25 template<>
26 string convert<string>(bool b)
27 {
28         return (b ? "true" : "false");
29 }
30
31
32 template<>
33 string convert<string>(char c)
34 {
35         return string(1, c);
36 }
37
38
39 template<>
40 string convert<string>(short unsigned int sui)
41 {
42         return lexical_cast<string>(sui);
43 }
44
45
46 template<>
47 string convert<string>(int i)
48 {
49         return lexical_cast<string>(i);
50 }
51
52
53 template<>
54 string convert<string>(unsigned int ui)
55 {
56         return lexical_cast<string>(ui);
57 }
58
59
60 template<>
61 string convert<string>(unsigned long ul)
62 {
63         return lexical_cast<string>(ul);
64 }
65
66
67 template<>
68 string convert<string>(float f)
69 {
70         return lexical_cast<string>(f);
71 }
72
73
74 template<>
75 string convert<string>(double d)
76 {
77         return lexical_cast<string>(d);
78 }