]> git.lyx.org Git - lyx.git/blobdiff - src/support/convert.cpp
* layouttranslations.review - remove dupes
[lyx.git] / src / support / convert.cpp
index 894d7647293cdb05d9514665bc6d4084439aa66c..70cd91eebafd15ac9ebf00baa3c4c3f48541edd6 100644 (file)
@@ -1,34 +1,31 @@
 /**
- * \file tostr.C
+ * \file convert.cpp
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
- * \author Lars Gullik Bjønnes
+ * \author André Pönitz
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#include "convert.h"
-
+#include "support/convert.h"
 #include "support/docstring.h"
 
 #include <boost/lexical_cast.hpp>
 
 #include <string>
+//needed for Mac OSX 10.5.2 Leopard
+#include <cstdlib>
 
+using namespace std;
 
 namespace lyx {
 
-using lyx::docstring;
-
 using boost::lexical_cast;
 
-using std::string;
-
-
 template<>
 string convert<string>(bool b)
 {
@@ -60,7 +57,7 @@ string convert<string>(int i)
 template<>
 docstring convert<docstring>(int i)
 {
-       return lyx::from_ascii(lexical_cast<string>(i));
+       return from_ascii(lexical_cast<string>(i));
 }
 
 
@@ -74,7 +71,7 @@ string convert<string>(unsigned int ui)
 template<>
 docstring convert<docstring>(unsigned int ui)
 {
-       return lyx::from_ascii(lexical_cast<string>(ui));
+       return from_ascii(lexical_cast<string>(ui));
 }
 
 
@@ -88,7 +85,7 @@ string convert<string>(unsigned long ul)
 template<>
 docstring convert<docstring>(unsigned long ul)
 {
-       return lyx::from_ascii(lexical_cast<string>(ul));
+       return from_ascii(lexical_cast<string>(ul));
 }
 
 
@@ -102,7 +99,7 @@ string convert<string>(long l)
 template<>
 docstring convert<docstring>(long l)
 {
-       return lyx::from_ascii(lexical_cast<string>(l));
+       return from_ascii(lexical_cast<string>(l));
 }
 
 
@@ -130,7 +127,7 @@ int convert<int>(string const s)
 template<>
 int convert<int>(docstring const s)
 {
-       return strtol(lyx::to_ascii(s).c_str(), 0, 10);
+       return strtol(to_ascii(s).c_str(), 0, 10);
 }
 
 
@@ -141,6 +138,13 @@ unsigned int convert<unsigned int>(string const s)
 }
 
 
+template<>
+unsigned long convert<unsigned long>(string const s)
+{
+       return strtoul(s.c_str(), 0, 10);
+}
+
+
 template<>
 double convert<double>(string const s)
 {