]> git.lyx.org Git - lyx.git/blobdiff - src/support/tostr.C
tostr -> convert and some bformat work
[lyx.git] / src / support / tostr.C
index b610cc21a75ead631efee773a03b1337baaa5f31..c137dbb6279c16ab976e9a47976d3251a82e2e16 100644 (file)
@@ -3,57 +3,67 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
+ * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
-#include "Lsstream.h"
-#include "LString.h"
 
+#include "tostr.h"
 
-string const tostr(bool b)
+#include <boost/lexical_cast.hpp>
+
+using boost::lexical_cast;
+
+using std::string;
+
+
+template<>
+string convert<string>(bool b)
 {
        return (b ? "true" : "false");
 }
 
 
-string const tostr(unsigned int i)
+template<>
+string convert<string>(char c)
+{
+       return string(1, c);
+}
+
+
+template<>
+string convert<string>(short unsigned int sui)
 {
-       ostringstream os;
-       os << i;
-       return STRCONV(os.str());
+       return lexical_cast<string>(sui);
 }
 
 
-string const tostr(long int i)
+template<>
+string convert<string>(int i)
 {
-       ostringstream os;
-       os << i;
-       return STRCONV(os.str());
+       return lexical_cast<string>(i);
 }
 
 
-string const tostr(double d)
+template<>
+string convert<string>(unsigned int ui)
 {
-       ostringstream os;
-       os << d;
-       return STRCONV(os.str());
+       return lexical_cast<string>(ui);
 }
 
 
-string const tostr(int i)
+template<>
+string convert<string>(float f)
 {
-       ostringstream os;
-       os << i;
-       return STRCONV(os.str());
+       return lexical_cast<string>(f);
 }
 
 
-string const tostr(string const & s)
+template<>
+string convert<string>(double d)
 {
-       return s;
+       return lexical_cast<string>(d);
 }