X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fconvert.cpp;h=70cd91eebafd15ac9ebf00baa3c4c3f48541edd6;hb=faa87bf9f30b943397429a04254d96963bbf38bc;hp=894d7647293cdb05d9514665bc6d4084439aa66c;hpb=f212b483355d68e93132fb469814e13335d0886b;p=lyx.git diff --git a/src/support/convert.cpp b/src/support/convert.cpp index 894d764729..70cd91eeba 100644 --- a/src/support/convert.cpp +++ b/src/support/convert.cpp @@ -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 -#include "convert.h" - +#include "support/convert.h" #include "support/docstring.h" #include #include +//needed for Mac OSX 10.5.2 Leopard +#include +using namespace std; namespace lyx { -using lyx::docstring; - using boost::lexical_cast; -using std::string; - - template<> string convert(bool b) { @@ -60,7 +57,7 @@ string convert(int i) template<> docstring convert(int i) { - return lyx::from_ascii(lexical_cast(i)); + return from_ascii(lexical_cast(i)); } @@ -74,7 +71,7 @@ string convert(unsigned int ui) template<> docstring convert(unsigned int ui) { - return lyx::from_ascii(lexical_cast(ui)); + return from_ascii(lexical_cast(ui)); } @@ -88,7 +85,7 @@ string convert(unsigned long ul) template<> docstring convert(unsigned long ul) { - return lyx::from_ascii(lexical_cast(ul)); + return from_ascii(lexical_cast(ul)); } @@ -102,7 +99,7 @@ string convert(long l) template<> docstring convert(long l) { - return lyx::from_ascii(lexical_cast(l)); + return from_ascii(lexical_cast(l)); } @@ -130,7 +127,7 @@ int convert(string const s) template<> int convert(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(string const s) } +template<> +unsigned long convert(string const s) +{ + return strtoul(s.c_str(), 0, 10); +} + + template<> double convert(string const s) {