X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fconvert.h;h=c1cd31551a8e46b48ab89474ef4d2109c1f7c21d;hb=f1ab5dfc5878bc736fd185279a0ef7a185b2d8d8;hp=ead674b99cd9d338cd79f220e6555dfb0ec316bf;hpb=9c2ba3c4ff17e15876a2ed6987ea44838a38d43b;p=lyx.git diff --git a/src/support/convert.h b/src/support/convert.h index ead674b99c..c1cd31551a 100644 --- a/src/support/convert.h +++ b/src/support/convert.h @@ -1,11 +1,11 @@ // -*- C++ -*- /** - * \file tostr.h + * \file convert.h * 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. * @@ -13,52 +13,38 @@ * Some of these would certainly benefit from a rewrite/optimization. */ -#ifndef TOSTR_H -#define TOSTR_H +#ifndef CONVERT_H +#define CONVERT_H -#include +#include "support/strfwd.h" -#include +namespace lyx { - -#if 0 -// Commented out since BOOST_STATIC_ASSERT does not work with gcc 4.0 -template -Target convert(Source arg) -{ - // We use a static assert here since we want all instances of - // this template to be specializations. - BOOST_STATIC_ASSERT(sizeof(bool) == 0); - return Target(); -} -#else template Target convert(Source arg); -#endif - - -template<> -std::string convert(bool); - -template<> -std::string convert(char); - -template<> -std::string convert(unsigned short); - -template<> -std::string convert(int); - -template<> -std::string convert(unsigned int); - -template<> -std::string convert(float); -template<> -std::string convert(double); -template<> -std::string convert(std::string); +template<> std::string convert(bool b); +template<> std::string convert(char c); +template<> std::string convert(short unsigned int sui); +template<> std::string convert(int i); +template<> docstring convert(int i); +template<> std::string convert(unsigned int ui); +template<> docstring convert(unsigned int ui); +template<> std::string convert(unsigned long ul); +template<> docstring convert(unsigned long ul); +template<> std::string convert(long l); +template<> docstring convert(long l); +template<> std::string convert(float f); +template<> std::string convert(double d); +template<> int convert(std::string const s); +template<> int convert(docstring const s); +template<> unsigned int convert(std::string const s); +template<> unsigned long convert(std::string const s); +template<> double convert(std::string const s); +template<> int convert(char const * cptr); +template<> double convert(char const * cptr); + +} // namespace lyx #endif