From: Lars Gullik Bjønnes Date: Thu, 6 Jan 2005 16:39:35 +0000 (+0000) Subject: rename tostr.[Ch] to convert.[Ch] X-Git-Tag: 1.6.10~14684 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9c2ba3c4ff17e15876a2ed6987ea44838a38d43b;p=features.git rename tostr.[Ch] to convert.[Ch] git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9448 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index e76eaf3052..95fdf3ee14 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -68,7 +68,7 @@ #include "support/filetools.h" #include "support/forkedcontr.h" #include "support/path_defines.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/types.h" #include diff --git a/src/ChangeLog b/src/ChangeLog index 213d911a3e..66fac148bd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,9 @@ 2005-01-06 Lars Gullik Bjonnes + * everywhere: change support/tostr.h -> support/convert.h + * tabular.C: make all write_attributes templates, tostr -> convert - + * paragraph.C (simpleLinuxDocOnePar): fix type for ret from getChar (emptyTag): and -> &&, and fix type for ret from getChar (getFirstWord): fix type for ret from getChar diff --git a/src/LaTeX.C b/src/LaTeX.C index 92ee3ac0ce..4ccd0cb57c 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -22,7 +22,7 @@ #include "DepTable.h" #include "support/filetools.h" #include "support/FileInfo.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/lstrings.h" #include "support/lyxlib.h" #include "support/systemcall.h" diff --git a/src/MenuBackend.C b/src/MenuBackend.C index d57a1292a1..50a0a9b00f 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -41,7 +41,7 @@ #include "support/filetools.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/Spacing.C b/src/Spacing.C index c4fcdb1edd..8846a742ea 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -13,7 +13,7 @@ #include "Spacing.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include #include diff --git a/src/buffer.C b/src/buffer.C index 4e58256a87..de6a46b06e 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -70,7 +70,7 @@ #include "support/os.h" #include "support/path.h" #include "support/textutils.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/bufferparams.C b/src/bufferparams.C index c8f659b6e1..6789e114fa 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -38,7 +38,7 @@ #include "frontends/Alert.h" #include "support/lyxalgo.h" // for lyx::count -#include "support/tostr.h" +#include "support/convert.h" #include "support/translator.h" #include diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index d4dbfe353a..fb977c2dc5 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -35,7 +35,7 @@ #include "insets/insettext.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/counters.C b/src/counters.C index 7f65d86af9..1411660fac 100644 --- a/src/counters.C +++ b/src/counters.C @@ -16,7 +16,7 @@ #include "debug.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index 6e64ea1d13..30fee5b52c 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -29,7 +29,7 @@ #include "support/filefilterlist.h" #include "support/filetools.h" -#include "support/tostr.h" +#include "support/convert.h" using std::advance; using std::vector; diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index a0cda6f91f..8335e35713 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -29,7 +29,7 @@ #include "support/filefilterlist.h" #include "support/filetools.h" #include "support/path_defines.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/types.h" using std::make_pair; diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index 53f3678efb..c9755e2242 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -21,7 +21,7 @@ #include "gettext.h" #include "PrinterParams.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/filefilterlist.h" #include "support/filetools.h" diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 6bbb8e51ea..2ca4645259 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -33,7 +33,7 @@ #endif #include "support/textutils.h" -#include "support/tostr.h" +#include "support/convert.h" #include "frontends/Alert.h" diff --git a/src/frontends/controllers/ControlTabularCreate.C b/src/frontends/controllers/ControlTabularCreate.C index f2d026e30a..e13f491895 100644 --- a/src/frontends/controllers/ControlTabularCreate.C +++ b/src/frontends/controllers/ControlTabularCreate.C @@ -13,7 +13,7 @@ #include "ControlTabularCreate.h" #include "funcrequest.h" -#include "support/tostr.h" +#include "support/convert.h" using std::string; @@ -43,7 +43,7 @@ void ControlTabularCreate::clearParams() void ControlTabularCreate::dispatchParams() { - string data = convert(params().first) + ' ' + convert(params().second); + string const data = convert(params().first) + ' ' + convert(params().second); kernel().dispatch(FuncRequest(LFUN_TABULAR_INSERT, data)); } diff --git a/src/frontends/xforms/ColorHandler.C b/src/frontends/xforms/ColorHandler.C index a43bc9036f..86392b89b4 100644 --- a/src/frontends/xforms/ColorHandler.C +++ b/src/frontends/xforms/ColorHandler.C @@ -17,7 +17,7 @@ #include "LColor.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FontInfo.C b/src/frontends/xforms/FontInfo.C index 6fae730671..bb30ae3542 100644 --- a/src/frontends/xforms/FontInfo.C +++ b/src/frontends/xforms/FontInfo.C @@ -20,7 +20,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormBox.C b/src/frontends/xforms/FormBox.C index 2bf22abeeb..59fc25cf71 100644 --- a/src/frontends/xforms/FormBox.C +++ b/src/frontends/xforms/FormBox.C @@ -17,7 +17,7 @@ #include "controllers/ButtonPolicies.h" #include "controllers/helper_funcs.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "Tooltips.h" #include "xforms_helpers.h" diff --git a/src/frontends/xforms/FormColorpicker.C b/src/frontends/xforms/FormColorpicker.C index 90f93e9c51..c9e8d25120 100644 --- a/src/frontends/xforms/FormColorpicker.C +++ b/src/frontends/xforms/FormColorpicker.C @@ -20,7 +20,7 @@ #include "lyxrc.h" #include "support/filetools.h" // LibFileSearch -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index e84100896b..033d12d7eb 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -40,7 +40,7 @@ #include "tex-strings.h" #include "vspace.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/lstrings.h" // contains, getStringFromVector #include "support/filetools.h" // LibFileSearch diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index b3b8070a29..c4cd302c7c 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -31,7 +31,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormFiledialog.C b/src/frontends/xforms/FormFiledialog.C index d2e8bd601a..7cea65f8f4 100644 --- a/src/frontends/xforms/FormFiledialog.C +++ b/src/frontends/xforms/FormFiledialog.C @@ -26,7 +26,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" #include "support/os.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index 77d17cb5b3..b25b931f1d 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -31,7 +31,7 @@ #include "frontends/Alert.h" #include "support/lyxlib.h" // for float_equal -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 29fffa227a..c60199b87c 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -28,7 +28,7 @@ #include "Spacing.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index f67946fb4d..1d89287858 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -23,7 +23,7 @@ #include "PrinterParams.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormSpellchecker.C b/src/frontends/xforms/FormSpellchecker.C index 1eba6cf52e..27c2868d9c 100644 --- a/src/frontends/xforms/FormSpellchecker.C +++ b/src/frontends/xforms/FormSpellchecker.C @@ -19,7 +19,7 @@ #include "xforms_helpers.h" #include "xformsBC.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormVSpace.C b/src/frontends/xforms/FormVSpace.C index 0df4171318..9cf600e20a 100644 --- a/src/frontends/xforms/FormVSpace.C +++ b/src/frontends/xforms/FormVSpace.C @@ -29,7 +29,7 @@ #include "vspace.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" diff --git a/src/frontends/xforms/FormWrap.C b/src/frontends/xforms/FormWrap.C index 85ea19a6b1..6bcd65723f 100644 --- a/src/frontends/xforms/FormWrap.C +++ b/src/frontends/xforms/FormWrap.C @@ -23,7 +23,7 @@ #include "insets/insetwrap.h" #include "support/lstrings.h" #include "lyx_forms.h" -#include "support/tostr.h" +#include "support/convert.h" using std::string; diff --git a/src/frontends/xforms/XFormsMenubar.C b/src/frontends/xforms/XFormsMenubar.C index c6ea81a5ce..4d0a3c988c 100644 --- a/src/frontends/xforms/XFormsMenubar.C +++ b/src/frontends/xforms/XFormsMenubar.C @@ -21,7 +21,7 @@ #include "MenuBackend.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/frontends/xforms/xforms_helpers.C b/src/frontends/xforms/xforms_helpers.C index f5a4e19a0e..a4b8b8c93a 100644 --- a/src/frontends/xforms/xforms_helpers.C +++ b/src/frontends/xforms/xforms_helpers.C @@ -21,7 +21,7 @@ #include "support/FileInfo.h" #include "support/filetools.h" #include "support/lstrings.h" // frontStrip, strip -#include "support/tostr.h" +#include "support/convert.h" #include "lyx_forms.h" #include "combox.h" diff --git a/src/graphics/GraphicsConverter.C b/src/graphics/GraphicsConverter.C index cc013e773a..2a4bf09c0e 100644 --- a/src/graphics/GraphicsConverter.C +++ b/src/graphics/GraphicsConverter.C @@ -18,7 +18,7 @@ #include "support/filetools.h" #include "support/forkedcallqueue.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/lstrings.h" #include "support/lyxlib.h" diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 04d63ea334..55e2935d65 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -33,7 +33,7 @@ #include "support/forkedcontr.h" #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/insets/ExternalTransforms.C b/src/insets/ExternalTransforms.C index 19670f087f..ffc66cfb12 100644 --- a/src/insets/ExternalTransforms.C +++ b/src/insets/ExternalTransforms.C @@ -16,7 +16,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" // float_equal -#include "support/tostr.h" +#include "support/convert.h" #include "support/translator.h" #include diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 74e3f29fae..97dca12473 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -25,7 +25,7 @@ #include "support/lstrings.h" #include "support/std_ostream.h" -#include "support/tostr.h" +#include "support/convert.h" using lyx::support::prefixIs; using lyx::support::strToInt; diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 6fc0e5e05c..3bbf20e91b 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -41,7 +41,7 @@ #include "support/filetools.h" #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/translator.h" #include diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index aaa87eca6a..b43c4a121c 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -31,7 +31,7 @@ #include "pariterator.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index a887ba9f4e..490f8b3553 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -44,7 +44,7 @@ #include "support/filetools.h" #include "support/lstrings.h" // contains #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 486f933f2c..c9b958f8d4 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -28,7 +28,7 @@ #include "outputparams.h" #include "paragraph.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/lyxfind.C b/src/lyxfind.C index 5d23c82976..1bcf3c398a 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -30,7 +30,7 @@ #include "frontends/Alert.h" #include "frontends/LyXView.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/lyxfunc.C b/src/lyxfunc.C index e5eb20d52a..7188aa5774 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -86,7 +86,7 @@ #include "support/path.h" #include "support/path_defines.h" #include "support/systemcall.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/os.h" #include diff --git a/src/lyxrc.C b/src/lyxrc.C index 9ff5301030..18ab6b0052 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -35,7 +35,7 @@ #include "support/filetools.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/userinfo.h" using lyx::support::ascii_lowercase; diff --git a/src/output_docbook.C b/src/output_docbook.C index 825914f779..8c1d0dba60 100644 --- a/src/output_docbook.C +++ b/src/output_docbook.C @@ -27,7 +27,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/types.h" #ifdef HAVE_LOCALE diff --git a/src/paragraph.C b/src/paragraph.C index b1a9a60f82..ce8b9967d8 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -42,7 +42,7 @@ #include "support/lstrings.h" #include "support/textutils.h" -#include "support/tostr.h" +#include "support/convert.h" #include #include diff --git a/src/sgml.C b/src/sgml.C index c10e8d81f7..5045025cdc 100644 --- a/src/sgml.C +++ b/src/sgml.C @@ -22,7 +22,7 @@ #include "support/lstrings.h" #include "support/std_ostream.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/support/ChangeLog b/src/support/ChangeLog index db6f478951..cadf806b9a 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,9 +1,13 @@ +2005-01-06 Lars Gullik Bjonnes + + * tostr.[Ch]: renamed to convert[ch] + 2005-01-06 Lars Gullik Bjonnes * lstrings.[Ch]: change bformat to be a template - + * tostr.[Ch]: tostr -> convert, convert is a template - + * tempname.C: * filetools.C (createBufferTmpDir): tostr -> convert diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 2193c1cd8a..ad8291ee34 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -22,6 +22,8 @@ libsupport_la_SOURCES = \ abort.C \ atoi.C \ chdir.C \ + convert.C \ + convert.h \ copy.C \ copied_ptr.h \ cow_ptr.h \ @@ -71,8 +73,6 @@ libsupport_la_SOURCES = \ systemcall.h \ tempname.C \ textutils.h \ - tostr.h \ - tostr.C \ translator.h \ types.h \ userinfo.C \ diff --git a/src/support/convert.C b/src/support/convert.C new file mode 100644 index 0000000000..b0eaa99c4a --- /dev/null +++ b/src/support/convert.C @@ -0,0 +1,69 @@ +/** + * \file tostr.C + * 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 + * + * Full author contact details are available in file CREDITS. + */ + +#include + +#include "convert.h" + +#include + +using boost::lexical_cast; + +using std::string; + + +template<> +string convert(bool b) +{ + return (b ? "true" : "false"); +} + + +template<> +string convert(char c) +{ + return string(1, c); +} + + +template<> +string convert(short unsigned int sui) +{ + return lexical_cast(sui); +} + + +template<> +string convert(int i) +{ + return lexical_cast(i); +} + + +template<> +string convert(unsigned int ui) +{ + return lexical_cast(ui); +} + + +template<> +string convert(float f) +{ + return lexical_cast(f); +} + + +template<> +string convert(double d) +{ + return lexical_cast(d); +} diff --git a/src/support/convert.h b/src/support/convert.h new file mode 100644 index 0000000000..ead674b99c --- /dev/null +++ b/src/support/convert.h @@ -0,0 +1,64 @@ +// -*- C++ -*- +/** + * \file tostr.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 + * + * Full author contact details are available in file CREDITS. + * + * A collection of string helper functions that works with string. + * Some of these would certainly benefit from a rewrite/optimization. + */ + +#ifndef TOSTR_H +#define TOSTR_H + +#include + +#include + + +#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); + +#endif diff --git a/src/support/filetools.C b/src/support/filetools.C index 4b29034661..2f220470e2 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -21,7 +21,7 @@ #include -#include "support/tostr.h" +#include "support/convert.h" #include "support/systemcall.h" #include "support/filetools.h" #include "support/lstrings.h" diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 1c60dd4c8f..65c238ecfc 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -13,7 +13,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include "debug.h" diff --git a/src/support/tempname.C b/src/support/tempname.C index 4202312076..18826367c2 100644 --- a/src/support/tempname.C +++ b/src/support/tempname.C @@ -12,7 +12,7 @@ #include "support/lyxlib.h" #include "support/filetools.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/os.h" #include "debug.h" diff --git a/src/support/tostr.C b/src/support/tostr.C deleted file mode 100644 index c137dbb627..0000000000 --- a/src/support/tostr.C +++ /dev/null @@ -1,69 +0,0 @@ -/** - * \file tostr.C - * 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 - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "tostr.h" - -#include - -using boost::lexical_cast; - -using std::string; - - -template<> -string convert(bool b) -{ - return (b ? "true" : "false"); -} - - -template<> -string convert(char c) -{ - return string(1, c); -} - - -template<> -string convert(short unsigned int sui) -{ - return lexical_cast(sui); -} - - -template<> -string convert(int i) -{ - return lexical_cast(i); -} - - -template<> -string convert(unsigned int ui) -{ - return lexical_cast(ui); -} - - -template<> -string convert(float f) -{ - return lexical_cast(f); -} - - -template<> -string convert(double d) -{ - return lexical_cast(d); -} diff --git a/src/support/tostr.h b/src/support/tostr.h deleted file mode 100644 index ead674b99c..0000000000 --- a/src/support/tostr.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- -/** - * \file tostr.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 - * - * Full author contact details are available in file CREDITS. - * - * A collection of string helper functions that works with string. - * Some of these would certainly benefit from a rewrite/optimization. - */ - -#ifndef TOSTR_H -#define TOSTR_H - -#include - -#include - - -#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); - -#endif diff --git a/src/tabular.C b/src/tabular.C index 02ddbd7e46..d43d6b5892 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -30,7 +30,7 @@ #include "insets/insettabular.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/tex-accent.C b/src/tex-accent.C index 8b7f740672..e2f1a8319b 100644 --- a/src/tex-accent.C +++ b/src/tex-accent.C @@ -12,7 +12,7 @@ #include #include "tex-accent.h" -#include "support/tostr.h" +#include "support/convert.h" using std::string; diff --git a/src/tex2lyx/text.C b/src/tex2lyx/text.C index d1bd74209f..2f9b001cf1 100644 --- a/src/tex2lyx/text.C +++ b/src/tex2lyx/text.C @@ -19,7 +19,7 @@ #include "lengthcommon.h" #include "support/FileInfo.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include "support/filetools.h" #include diff --git a/src/text.C b/src/text.C index dc94664fe5..1547bc6c52 100644 --- a/src/text.C +++ b/src/text.C @@ -67,7 +67,7 @@ #include "support/lstrings.h" #include "support/textutils.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/text2.C b/src/text2.C index 0ffd04c0f6..324d3cbef4 100644 --- a/src/text2.C +++ b/src/text2.C @@ -58,7 +58,7 @@ #include "support/lstrings.h" #include "support/textutils.h" -#include "support/tostr.h" +#include "support/convert.h" #include diff --git a/src/text3.C b/src/text3.C index d65d24bf45..e46b839721 100644 --- a/src/text3.C +++ b/src/text3.C @@ -54,7 +54,7 @@ #include "support/lstrings.h" #include "support/lyxlib.h" -#include "support/tostr.h" +#include "support/convert.h" #include "mathed/math_hullinset.h" #include "mathed/math_macrotemplate.h" diff --git a/src/toc.C b/src/toc.C index 42141c3dc2..603912ab55 100644 --- a/src/toc.C +++ b/src/toc.C @@ -25,7 +25,7 @@ #include "insets/insetfloat.h" #include "insets/insetwrap.h" -#include "support/tostr.h" +#include "support/convert.h" using std::vector; using std::max;