diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index bb611da491..176a0a4961 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -53,7 +53,7 @@ #include "graphics/Previews.h" #include "support/LAssert.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "support/filetools.h" #include diff --git a/src/ChangeLog b/src/ChangeLog index 91af4d567a..c5ada9b6c3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,17 @@ +2003-05-13 André Pönitz + + * BufferView_pimpl.C: + * buffer.C: + * bufferview_func.C: + * MenuBackend.C: + * lyxfunc.C: + * lyxrc.C: + * tex-accent.C: + * text3.C: + * toc.C: + * tabular_funcs.h: tostr() from its own header + 2003-05-12 André Pönitz * BufferView.C: diff --git a/src/LaTeX.C b/src/LaTeX.C index 50ea8faa4b..8908812d6f 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -21,6 +21,7 @@ #include "funcrequest.h" #include "support/filetools.h" #include "support/FileInfo.h" +#include "support/tostr.h" #include "support/lstrings.h" #include "support/lyxlib.h" #include "support/systemcall.h" diff --git a/src/MenuBackend.C b/src/MenuBackend.C index c9beb75072..9a506537b0 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -11,7 +11,6 @@ #include -#include #include "MenuBackend.h" #include "lyxlex.h" #include "LyXAction.h" @@ -33,6 +32,9 @@ #include "support/filetools.h" #include "support/lyxfunctional.h" #include "support/lstrings.h" +#include "support/tostr.h" + +#include extern BufferList bufferlist; extern boost::scoped_ptr toplevel_keymap; diff --git a/src/buffer.C b/src/buffer.C index 13c6120249..da63f13f66 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -59,6 +59,7 @@ #include "support/filetools.h" #include "support/path.h" #include "support/os.h" +#include "support/tostr.h" #include "support/lyxlib.h" #include "support/FileInfo.h" #include "support/lyxmanip.h" diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index df8af0248d..dde58c3fc9 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -31,7 +31,7 @@ #include "frontends/Alert.h" #include "mathed/math_cursor.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "Lsstream.h" #include "insets/updatableinset.h" diff --git a/src/converter.C b/src/converter.C index 04d296b450..6798b5a6a1 100644 --- a/src/converter.C +++ b/src/converter.C @@ -28,6 +28,7 @@ #include "support/filetools.h" #include "support/lyxfunctional.h" #include "support/path.h" +#include "support/tostr.h" #include "support/systemcall.h" #include diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 245ab25f1c..e628108f77 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,11 +1,19 @@ -2003-05-12 André Pönitz +2003-05-13 André Pönitz * ControlDocument.C: * ControlPrint.C: * ControlSpellchecker.C: * biblio.C: boost::format -> bformat all over the place + * ControlForks.C: + * ControlGraphics.C: + * ControlPrint.C: + * ControlSearch.C: + * ControlSpellchecker.C: + * ControlTabularCreate.C: use tostr from new header + + 2003-05-08 Lars Gullik Bjřnnes * Makefile.am: better lib building diff --git a/src/frontends/controllers/ControlForks.C b/src/frontends/controllers/ControlForks.C index b83bebcc18..de37e59152 100644 --- a/src/frontends/controllers/ControlForks.C +++ b/src/frontends/controllers/ControlForks.C @@ -10,7 +10,6 @@ #include - #include "ControlForks.h" #include "ViewBase.h" @@ -18,7 +17,7 @@ #include "funcrequest.h" #include "support/forkedcontr.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index 390703bc33..5134683f4e 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -11,7 +11,6 @@ #include - #include "ControlGraphics.h" #include "helper_funcs.h" @@ -29,7 +28,7 @@ #include "insets/insetgraphics.h" #include "insets/insetgraphicsParams.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "support/filetools.h" #include "support/FileInfo.h" diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index a039c7e0d4..c05d001dfe 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -10,7 +10,6 @@ #include - #include "ControlPrint.h" #include "ViewBase.h" @@ -25,6 +24,7 @@ #include "frontends/Alert.h" +#include "support/tostr.h" #include "support/LAssert.h" #include "support/filetools.h" #include "support/path.h" diff --git a/src/frontends/controllers/ControlSearch.C b/src/frontends/controllers/ControlSearch.C index 2cb3aa7d13..a918eb1b1e 100644 --- a/src/frontends/controllers/ControlSearch.C +++ b/src/frontends/controllers/ControlSearch.C @@ -10,7 +10,6 @@ #include - #include "ControlSearch.h" #include "gettext.h" @@ -18,7 +17,7 @@ #include "frontends/LyXView.h" -#include "support/lstrings.h" +#include "support/tostr.h" ControlSearch::ControlSearch(LyXView & lv, Dialogs & d) diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 74b749a0ef..7406da6c97 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -29,6 +29,8 @@ #endif #endif +#include "support/tostr.h" + #include "frontends/Alert.h" using std::endl; diff --git a/src/frontends/controllers/ControlTabularCreate.C b/src/frontends/controllers/ControlTabularCreate.C index 192f4e909f..4b7283dbda 100644 --- a/src/frontends/controllers/ControlTabularCreate.C +++ b/src/frontends/controllers/ControlTabularCreate.C @@ -12,7 +12,8 @@ #include "ControlTabularCreate.h" #include "funcrequest.h" -#include "support/lstrings.h" + +#include "support/tostr.h" ControlTabularCreate::ControlTabularCreate(Dialog & parent) @@ -22,14 +23,16 @@ ControlTabularCreate::ControlTabularCreate(Dialog & parent) bool ControlTabularCreate::initialiseParams(string const &) { - params_.first = params_.second = 5; + params_.first = 5; + params_.second = 5; return true; } void ControlTabularCreate::clearParams() { - params_.first = params_.second = 0; + params_.first = 0; + params_.second = 0; } diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index f19961df2c..be29a42d8f 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,4 +1,19 @@ +2003-05-13 André Pönitz + + * FontInfo.C: + * FormDocument.C: + * FormFiledialog.C: + * FormForks.C: + * FormGraphics.C: + * FormMinipage.C: + * FormParagraph.C: + * FormPreferences.C: + * FormPrint.C: + * FormSpellchecker.C: + * FormWrap.C: + * Menubar_pimpl.C: tostr from new header + 2003-05-12 André Pönitz * FormDocument.C: diff --git a/src/frontends/xforms/FontInfo.C b/src/frontends/xforms/FontInfo.C index ec524ab196..b7821bff9e 100644 --- a/src/frontends/xforms/FontInfo.C +++ b/src/frontends/xforms/FontInfo.C @@ -11,13 +11,14 @@ #include - #include "FontInfo.h" #include "debug.h" #include "lyxrc.h" // lyxrc.use_scalable_fonts +#include "support/tostr.h" #include "support/lstrings.h" #include "support/lyxlib.h" + #include "frontends/lyx_gui.h" #include // abs() diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index f5b4c1b2b9..571697dc79 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -11,7 +11,6 @@ #include - #include "ControlDocument.h" #include "FormDocument.h" #include "forms/form_document.h" @@ -33,6 +32,7 @@ #include "controllers/frnt_lang.h" #include "controllers/helper_funcs.h" +#include "support/tostr.h" #include "support/lstrings.h" // contains_functor, getStringFromVector #include "support/filetools.h" // LibFileSearch #include "support/BoostFormat.h" diff --git a/src/frontends/xforms/FormFiledialog.C b/src/frontends/xforms/FormFiledialog.C index a8fe2ec9c9..921a1a34a9 100644 --- a/src/frontends/xforms/FormFiledialog.C +++ b/src/frontends/xforms/FormFiledialog.C @@ -22,14 +22,18 @@ using std::map; using std::max; using std::sort; -#include "frontends/Alert.h" +#include "gettext.h" +#include "forms_gettext.h" +#include "xforms_helpers.h" + #include "support/FileInfo.h" #include "support/lyxlib.h" #include "support/lstrings.h" -#include "gettext.h" +#include "support/tostr.h" +#include "support/filetools.h" + +#include "frontends/Alert.h" #include "frontends/Dialogs.h" -#include "forms_gettext.h" -#include "xforms_helpers.h" #include @@ -53,7 +57,6 @@ using std::sort; #endif -#include "support/filetools.h" #include "FormFiledialog.h" #include "forms/form_filedialog.h" #include FORMS_H_LOCATION diff --git a/src/frontends/xforms/FormForks.C b/src/frontends/xforms/FormForks.C index 3288410538..5b63a9c9fd 100644 --- a/src/frontends/xforms/FormForks.C +++ b/src/frontends/xforms/FormForks.C @@ -11,7 +11,6 @@ #include - #include "xformsBC.h" #include "ButtonController.h" #include "FormForks.h" @@ -22,6 +21,7 @@ #include "xforms_helpers.h" #include "gettext.h" #include "support/lstrings.h" +#include "support/tostr.h" #include FORMS_H_LOCATION using std::vector; diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index 37a32f274b..a19926373c 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -12,7 +12,6 @@ #include - #include "xformsBC.h" #include "ControlGraphics.h" #include "FormGraphics.h" @@ -32,7 +31,8 @@ #include "frontends/Alert.h" -#include "support/lstrings.h" // for strToDbl & tostr +#include "support/tostr.h" +#include "support/lstrings.h" // for strToDbl #include "support/lyxlib.h" // for float_equal #include "support/filetools.h" // for MakeAbsPath etc diff --git a/src/frontends/xforms/FormMinipage.C b/src/frontends/xforms/FormMinipage.C index e97bd6ca87..2cfee7e1e8 100644 --- a/src/frontends/xforms/FormMinipage.C +++ b/src/frontends/xforms/FormMinipage.C @@ -10,12 +10,12 @@ #include - #include "xformsBC.h" #include "ControlMinipage.h" #include "FormMinipage.h" #include "forms/form_minipage.h" #include "support/lstrings.h" +#include "support/tostr.h" #include "helper_funcs.h" #include "debug.h" #include "xforms_helpers.h" diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index b84caa803d..01c042439e 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -11,7 +11,6 @@ #include - #include "ControlParagraph.h" #include "FormParagraph.h" #include "forms/form_paragraph.h" @@ -29,6 +28,7 @@ #include "layout.h" // LyXAlignment #include "support/lstrings.h" +#include "support/tostr.h" #include "support/LAssert.h" #include FORMS_H_LOCATION diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 91f47461c2..003f41dffe 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -10,7 +10,6 @@ #include - #include "ControlPrefs.h" #include "FormPreferences.h" #include "forms/form_preferences.h" @@ -38,6 +37,7 @@ #include "support/lyxfunctional.h" #include "support/lyxmanip.h" +#include "support/tostr.h" #include "support/filetools.h" #include "support/LAssert.h" @@ -657,8 +657,7 @@ void FormPreferences::Colors::InputHSV() int const s = int(100.0 * sat); int const v = int(100.0 * val); - string const label = tostr(h) + string(", ") + tostr(s) + string(", ") + - tostr(v); + string const label = tostr(h) + ", " + tostr(s) + ", " + tostr(v); fl_set_object_label(dialog_->text_color_values, label.c_str()); RGBColor col = HSVColor(hue, sat, val); diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index a5f46b9ee7..360b7497ed 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -11,7 +11,6 @@ #include - #include "xformsBC.h" #include "ControlPrint.h" #include "FormPrint.h" @@ -23,7 +22,7 @@ #include "input_validators.h" #include "xforms_helpers.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include FORMS_H_LOCATION diff --git a/src/frontends/xforms/FormSpellchecker.C b/src/frontends/xforms/FormSpellchecker.C index 80469dcb8c..6aa3b16718 100644 --- a/src/frontends/xforms/FormSpellchecker.C +++ b/src/frontends/xforms/FormSpellchecker.C @@ -10,7 +10,6 @@ #include - #include "xformsBC.h" #include "FormSpellchecker.h" #include "ControlSpellchecker.h" @@ -19,7 +18,7 @@ #include "forms_gettext.h" #include "Tooltips.h" #include "xforms_helpers.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include FORMS_H_LOCATION diff --git a/src/frontends/xforms/FormWrap.C b/src/frontends/xforms/FormWrap.C index aaae3fbb1d..daf5a73e0b 100644 --- a/src/frontends/xforms/FormWrap.C +++ b/src/frontends/xforms/FormWrap.C @@ -22,6 +22,7 @@ #include "insets/insetwrap.h" #include "support/lstrings.h" +#include "support/tostr.h" #include FORMS_H_LOCATION typedef FormController > base_class; diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index acd453b061..e2e8f55e20 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -16,6 +16,7 @@ #include "XFormsView.h" #include "lyxfunc.h" #include "support/lstrings.h" +#include "support/tostr.h" #include "support/LAssert.h" #include "gettext.h" #include "debug.h" diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index c32c13c301..359c40bf42 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,4 +1,9 @@ +2003-05-13 André Pönitz + + * GraphicsConverter.C: + * PreviewLoader.C: use tostr from own header + 2003-05-12 André Pönitz * PreviewLoader.C: boost::format -> bformat diff --git a/src/graphics/GraphicsConverter.C b/src/graphics/GraphicsConverter.C index 852e5bb6ae..41d8620a14 100644 --- a/src/graphics/GraphicsConverter.C +++ b/src/graphics/GraphicsConverter.C @@ -19,7 +19,7 @@ #include "support/filetools.h" #include "support/forkedcall.h" #include "support/forkedcallqueue.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "support/lyxlib.h" #include diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 75d6faf587..906d7fe2c2 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -28,7 +28,7 @@ #include "support/filetools.h" #include "support/forkedcall.h" #include "support/forkedcontr.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "support/lyxlib.h" #include diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index c5337e6827..5b1dce1abc 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,4 +1,13 @@ +2003-05-13 André Pönitz + + * insetbibitem.C: + * insetcollapsable.C: + * insetert.C: + * insetfloat.C: + * insetinclude.C: + * insetwrap.C: tostr from own header + 2003-05-12 André Pönitz * insetcaption.C: diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 5a91ffd8d5..71b49ac8d8 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -17,6 +17,7 @@ #include "frontends/font_metrics.h" +#include "support/tostr.h" #include "support/lstrings.h" diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 5f5da107d4..07bb71e72f 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -12,7 +12,6 @@ #include - #include "insetcollapsable.h" #include "insettext.h" @@ -32,7 +31,6 @@ #include "support/LAssert.h" #include "support/LOstream.h" -#include "support/lstrings.h" using std::vector; using std::ostream; @@ -88,7 +86,7 @@ bool InsetCollapsable::insertInset(BufferView * bv, Inset * in) void InsetCollapsable::write(Buffer const * buf, ostream & os) const { - os << "collapsed " << tostr(collapsed_) << "\n"; + os << "collapsed " << (collapsed_ ? "true" : "false") << "\n"; inset.writeParagraphData(buf, os); } diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 0e53c9db9c..62fedfe989 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -31,7 +31,7 @@ #include "support/LOstream.h" #include "support/LAssert.h" -#include "support/lstrings.h" +#include "support/tostr.h" using std::ostream; diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index ab78bdb83e..43518fbc07 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -30,6 +30,7 @@ #include "support/LOstream.h" #include "support/lstrings.h" +#include "support/tostr.h" #include "frontends/LyXView.h" #include "frontends/Dialogs.h" diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 2d52f64fb0..acb43ab167 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -29,7 +29,8 @@ #include "support/filetools.h" #include "support/FileInfo.h" #include "support/FileMonitor.h" -#include "support/lstrings.h" +#include "support/lstrings.h" // contains +#include "support/tostr.h" #include "graphics/PreviewedInset.h" #include "graphics/PreviewImage.h" diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 9068d7c53e..d7af96cc2c 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -29,7 +29,7 @@ #include "frontends/Dialogs.h" #include "support/LOstream.h" -#include "support/lstrings.h" +#include "support/tostr.h" using std::ostream; using std::endl; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 1ce5d3adb1..bcff99a8ef 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -63,6 +63,7 @@ #include "support/FileInfo.h" #include "support/forkedcontr.h" #include "support/lstrings.h" +#include "support/tostr.h" #include "support/path.h" #include "support/lyxfunctional.h" diff --git a/src/lyxrc.C b/src/lyxrc.C index 6b7cb7451d..00a8ad2789 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -13,21 +13,23 @@ #include #include -#include "debug.h" - #include "lyxrc.h" + +#include "debug.h" #include "kbmap.h" #include "LyXAction.h" #include "intl.h" -#include "support/path.h" -#include "support/filetools.h" -#include "support/LAssert.h" -#include "support/userinfo.h" #include "converter.h" #include "format.h" #include "gettext.h" #include "lyxlex.h" +#include "support/path.h" +#include "support/tostr.h" +#include "support/filetools.h" +#include "support/LAssert.h" +#include "support/userinfo.h" + using std::ostream; using std::ofstream; using std::cout; diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 344f49b2a6..2431c2f8b5 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -64,10 +64,12 @@ libsupport_la_SOURCES = \ sstream.h \ systemcall.C \ systemcall.h \ - userinfo.C \ - userinfo.h \ tempname.C \ textutils.h \ + tostr.h \ + tostr.C \ translator.h \ types.h \ + userinfo.C \ + userinfo.h \ unlink.C diff --git a/src/support/filetools.C b/src/support/filetools.C index 575338bef7..a9102ce69a 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -19,7 +19,7 @@ #include #include "debug.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "support/systemcall.h" #include "support/LAssert.h" diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 51dc20ad91..45df1f5e14 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -18,8 +18,6 @@ #include -#include "Lsstream.h" - #include "LString.h" /// @@ -86,36 +84,6 @@ string const lowercase(string const &); /// string const uppercase(string const &); -/// convert \a T to string -template -inline -string const tostr(T const & t) -{ - ostringstream ostr; - ostr << t; - return STRCONV(ostr.str()); - // We need to use the .c_str since we sometimes are using - // our own string class and that is not compatible with - // basic_string. (of course we don't want this later) -} - - -/// -template<> -inline -string const tostr(bool const & b) -{ - return (b ? "true" : "false"); -} - -/// -template<> -inline -string const tostr(string const & s) -{ - return s; -} - /// Does the string start with this prefix? bool prefixIs(string const &, char const *); diff --git a/src/support/tempname.C b/src/support/tempname.C index f15ec1a6f0..d6b9fb0c7d 100644 --- a/src/support/tempname.C +++ b/src/support/tempname.C @@ -6,7 +6,7 @@ #include "LString.h" #include "support/lyxlib.h" #include "support/filetools.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "debug.h" #include "os.h" diff --git a/src/support/tostr.C b/src/support/tostr.C new file mode 100644 index 0000000000..2442699f57 --- /dev/null +++ b/src/support/tostr.C @@ -0,0 +1,41 @@ +#include + +#include "Lsstream.h" +#include "LString.h" + + +string const tostr(bool b) +{ + return (b ? "true" : "false"); +} + + +string const tostr(unsigned int i) +{ + ostringstream os; + os << i; + return STRCONV(os.str()); +} + + +string const tostr(double d) +{ + ostringstream os; + os << d; + return STRCONV(os.str()); +} + + +string const tostr(int i) +{ + ostringstream os; + os << i; + return STRCONV(os.str()); +} + + +string const tostr(string const & s) +{ + return s; +} + diff --git a/src/support/tostr.h b/src/support/tostr.h new file mode 100644 index 0000000000..4ad4aa4201 --- /dev/null +++ b/src/support/tostr.h @@ -0,0 +1,35 @@ +// -*- 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 + * + * 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 "LString.h" + +// When trying to convert this to a template using std::stringstream, +// note that this will pull in the whole of in more than 150 +// files, even when configuring --with-included-strings ! + +/// convert things to strings +string const tostr(bool b); +/// +string const tostr(int); +/// +string const tostr(unsigned int); +/// +string const tostr(double); +/// +string const tostr(string const & s); + +#endif diff --git a/src/tabular_funcs.C b/src/tabular_funcs.C index c3c2d7d199..ac2e2fbfe2 100644 --- a/src/tabular_funcs.C +++ b/src/tabular_funcs.C @@ -15,6 +15,7 @@ #include "tabular_funcs.h" #include "support/LIstream.h" +#include "support/lstrings.h" #ifndef CXX_GLOBAL_CSTD using std::strlen; diff --git a/src/tabular_funcs.h b/src/tabular_funcs.h index e2ce28f1e7..a6925e9c88 100644 --- a/src/tabular_funcs.h +++ b/src/tabular_funcs.h @@ -14,9 +14,8 @@ #ifndef TABULAR_FUNCS_H #define TABULAR_FUNCS_H -#include "LString.h" #include "tabular.h" -#include "support/lstrings.h" // for tostr +#include "support/tostr.h" #include diff --git a/src/tex-accent.C b/src/tex-accent.C index 806b6591f5..6d6dae76fd 100644 --- a/src/tex-accent.C +++ b/src/tex-accent.C @@ -13,8 +13,7 @@ #include #include "tex-accent.h" #include "lfuns.h" -#include "LString.h" -#include "support/lstrings.h" +#include "support/tostr.h" /* the names used by TeX and XWindows for deadkeys/accents are not the same so here follows a table to clearify the differences. Please correct this diff --git a/src/text3.C b/src/text3.C index f6f1e44b31..b516764f3d 100644 --- a/src/text3.C +++ b/src/text3.C @@ -25,7 +25,7 @@ #include "intl.h" #include "box.h" #include "language.h" -#include "support/lstrings.h" +#include "support/tostr.h" #include "frontends/LyXView.h" #include "frontends/screen.h" #include "frontends/Dialogs.h" diff --git a/src/toc.C b/src/toc.C index 2db88e4af9..8912609988 100644 --- a/src/toc.C +++ b/src/toc.C @@ -15,17 +15,20 @@ #include -#include "support/lstrings.h" #include "toc.h" #include "buffer.h" -#include "frontends/LyXView.h" #include "LyXAction.h" #include "paragraph.h" -#include "insets/insetfloat.h" -#include "insets/insetwrap.h" #include "debug.h" #include "iterators.h" +#include "insets/insetfloat.h" +#include "insets/insetwrap.h" + +#include "support/tostr.h" + +#include "frontends/LyXView.h" + using std::vector; using std::max; using std::endl;