non-templated tostr in separate files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6955 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-05-13 14:36:24 +00:00
parent b21a69d998
commit dbef37d522
50 changed files with 204 additions and 92 deletions

View File

@ -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 <boost/bind.hpp>

View File

@ -1,4 +1,17 @@
2003-05-13 André Pönitz <poenitz@gmx.net>
* 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 <poenitz@gmx.net>
* BufferView.C:

View File

@ -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"

View File

@ -11,7 +11,6 @@
#include <config.h>
#include <algorithm>
#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 <algorithm>
extern BufferList bufferlist;
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;

View File

@ -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"

View File

@ -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"

View File

@ -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 <cctype>

View File

@ -1,11 +1,19 @@
2003-05-12 André Pönitz <poenitz@gmx.net>
2003-05-13 André Pönitz <poenitz@gmx.net>
* 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 <larsbj@gullik.net>
* Makefile.am: better lib building

View File

@ -10,7 +10,6 @@
#include <config.h>
#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 <boost/bind.hpp>

View File

@ -11,7 +11,6 @@
#include <config.h>
#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"

View File

@ -10,7 +10,6 @@
#include <config.h>
#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"

View File

@ -10,7 +10,6 @@
#include <config.h>
#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)

View File

@ -29,6 +29,8 @@
#endif
#endif
#include "support/tostr.h"
#include "frontends/Alert.h"
using std::endl;

View File

@ -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;
}

View File

@ -1,4 +1,19 @@
2003-05-13 André Pönitz <poenitz@gmx.net>
* 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 <poenitz@gmx.net>
* FormDocument.C:

View File

@ -11,13 +11,14 @@
#include <config.h>
#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 <cmath> // abs()

View File

@ -11,7 +11,6 @@
#include <config.h>
#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"

View File

@ -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 <boost/bind.hpp>
@ -53,7 +57,6 @@ using std::sort;
#endif
#include "support/filetools.h"
#include "FormFiledialog.h"
#include "forms/form_filedialog.h"
#include FORMS_H_LOCATION

View File

@ -11,7 +11,6 @@
#include <config.h>
#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;

View File

@ -12,7 +12,6 @@
#include <config.h>
#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

View File

@ -10,12 +10,12 @@
#include <config.h>
#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"

View File

@ -11,7 +11,6 @@
#include <config.h>
#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

View File

@ -10,7 +10,6 @@
#include <config.h>
#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);

View File

@ -11,7 +11,6 @@
#include <config.h>
#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

View File

@ -10,7 +10,6 @@
#include <config.h>
#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

View File

@ -22,6 +22,7 @@
#include "insets/insetwrap.h"
#include "support/lstrings.h"
#include "support/tostr.h"
#include FORMS_H_LOCATION
typedef FormController<ControlWrap, FormView<FD_wrap> > base_class;

View File

@ -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"

View File

@ -1,4 +1,9 @@
2003-05-13 André Pönitz <poenitz@gmx.net>
* GraphicsConverter.C:
* PreviewLoader.C: use tostr from own header
2003-05-12 André Pönitz <poenitz@gmx.net>
* PreviewLoader.C: boost::format -> bformat

View File

@ -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 <boost/bind.hpp>

View File

@ -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 <boost/bind.hpp>

View File

@ -1,4 +1,13 @@
2003-05-13 André Pönitz <poenitz@gmx.net>
* insetbibitem.C:
* insetcollapsable.C:
* insetert.C:
* insetfloat.C:
* insetinclude.C:
* insetwrap.C: tostr from own header
2003-05-12 André Pönitz <poenitz@gmx.net>
* insetcaption.C:

View File

@ -17,6 +17,7 @@
#include "frontends/font_metrics.h"
#include "support/tostr.h"
#include "support/lstrings.h"

View File

@ -12,7 +12,6 @@
#include <config.h>
#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);
}

View File

@ -31,7 +31,7 @@
#include "support/LOstream.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
using std::ostream;

View File

@ -30,6 +30,7 @@
#include "support/LOstream.h"
#include "support/lstrings.h"
#include "support/tostr.h"
#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"

View File

@ -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"

View File

@ -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;

View File

@ -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"

View File

@ -13,21 +13,23 @@
#include <iostream>
#include <boost/scoped_ptr.hpp>
#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;

View File

@ -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

View File

@ -19,7 +19,7 @@
#include <config.h>
#include "debug.h"
#include "support/lstrings.h"
#include "support/tostr.h"
#include "support/systemcall.h"
#include "support/LAssert.h"

View File

@ -18,8 +18,6 @@
#include <vector>
#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<typename T>
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<char>. (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 *);

View File

@ -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"

41
src/support/tostr.C Normal file
View File

@ -0,0 +1,41 @@
#include <config.h>
#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;
}

35
src/support/tostr.h Normal file
View File

@ -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 <string> 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

View File

@ -15,6 +15,7 @@
#include "tabular_funcs.h"
#include "support/LIstream.h"
#include "support/lstrings.h"
#ifndef CXX_GLOBAL_CSTD
using std::strlen;

View File

@ -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 <iosfwd>

View File

@ -13,8 +13,7 @@
#include <cstdlib>
#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

View File

@ -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"

View File

@ -15,17 +15,20 @@
#include <config.h>
#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;