STRCONV() all over the place

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6956 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-05-13 16:24:49 +00:00
parent dbef37d522
commit 0e9bd2e87d
34 changed files with 92 additions and 94 deletions

View File

@ -12,6 +12,13 @@
* toc.C:
* tabular_funcs.h: tostr() from its own header
* ParagraphParameters.C:
* ToolbarBackend.C:
* bufferparams.C:
* format.C:
* lyxlex_pimpl.C:
* text3.C: STRCONV()
2003-05-12 André Pönitz <poenitz@gmx.net>
* BufferView.C:

View File

@ -7,6 +7,7 @@
#include "buffer.h"
#include "BufferView.h"
#include "Lsstream.h"
#include "gettext.h"
#include "paragraph.h"
#include "lyxtext.h"
@ -420,7 +421,7 @@ void ParagraphParameters::write(ostream & os) const
void setParagraphParams(BufferView & bv, string const & data)
{
istringstream is(data);
istringstream is(STRCONV(data));
LyXLex lex(0,0);
lex.setStream(is);
@ -471,5 +472,5 @@ void params2string(Paragraph const & par, string & data)
/// is paragraph in inset
os << "\\ininset " << par.inInset() << '\n';
data = os.str();
data = STRCONV(os.str());
}

View File

@ -26,6 +26,7 @@
using std::endl;
using std::vector;
using std::make_pair;
ToolbarBackend toolbarbackend;

View File

@ -43,6 +43,7 @@ using std::pair;
#endif
bool use_babel;
BufferParams::BufferParams()
// Initialize textclass to point to article. if `first' is
// true in the returned pair, then `second' is the textclass
@ -195,7 +196,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
tracking_changes = lex.getInteger();
} else if (token == "\\author") {
lex.nextToken();
istringstream ss(lex.getString());
istringstream ss(STRCONV(lex.getString()));
Author a;
ss >> a;
author_map.push_back(authorlist.record(a));

View File

@ -24,7 +24,6 @@
#include "support/lyxfunctional.h"
namespace {
string const token_from("$$i");

View File

@ -28,7 +28,7 @@ ControlParagraph::ControlParagraph(Dialog & parent)
bool ControlParagraph::initialiseParams(string const & data)
{
istringstream is(data);
istringstream is(STRCONV(data));
LyXLex lex(0,0);
lex.setStream(is);
@ -118,7 +118,7 @@ void ControlParagraph::dispatchParams()
{
ostringstream data;
params().write(data);
FuncRequest const fr(LFUN_PARAGRAPH_APPLY, data.str());
FuncRequest const fr(LFUN_PARAGRAPH_APPLY, STRCONV(data.str()));
kernel().dispatch(fr);
}

View File

@ -12,6 +12,8 @@
#include <config.h>
#include "biblio.h"
#include "Lsstream.h"
#include "gettext.h" // for _()
#include "helper_funcs.h"
#include "Lsstream.h"
@ -26,6 +28,7 @@
using std::vector;
namespace biblio {
string const familyName(string const & name)
@ -78,6 +81,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
}
string author = parseBibTeX(data, "author");
if (author.empty())
author = parseBibTeX(data, "editor");
@ -252,9 +256,7 @@ string const escape_special_chars(string const & expr)
// The '$' must be prefixed with the escape character '\' for
// boost to treat it as a literal.
// Thus, to prefix a matched expression with '\', we use:
string const fmt("\\\\$&");
return reg.Merge(expr, fmt);
return STRCONV(reg.Merge(STRCONV(expr), "\\\\$&"));
}
@ -265,7 +267,7 @@ struct RegexMatch
// re and icase are used to construct an instance of boost::RegEx.
// if icase is true, then matching is insensitive to case
RegexMatch(InfoMap const & m, string const & re, bool icase)
: map_(m), regex_(re, icase) {}
: map_(m), regex_(STRCONV(re), icase) {}
bool operator()(string const & key) {
if (!validRE())
@ -280,7 +282,7 @@ struct RegexMatch
// Attempts to find a match for the current RE
// somewhere in data.
return regex_.Search(data);
return regex_.Search(STRCONV(data));
}
bool validRE() const { return regex_.error_code() == 0; }

View File

@ -10,7 +10,6 @@
#include <config.h>
#include "FormBase.h"
#include "ControlButtons.h"
@ -321,7 +320,7 @@ void FormBase::postMessage(string const & message)
boost::format(_("WARNING! %1$s")) :
boost::format("%1$s");
string const str = formatted(boost::io::str(fmter % message),
string const str = formatted(STRCONV(boost::io::str(fmter % message)),
width, FL_NORMAL_SIZE);
#else
string const tmp = warning_posted_ ?

View File

@ -10,7 +10,6 @@
#include <config.h>
#include "FormDialogView.h"
#include "Dialog.h"
@ -323,7 +322,7 @@ void FormDialogView::postMessage(string const & message)
boost::format(_("WARNING! %1$s")) :
boost::format("%1$s");
string const str = formatted(boost::io::str(fmter % message),
string const str = formatted(STRCONV(boost::io::str(fmter % message)),
width, FL_NORMAL_SIZE);
#else
string const tmp = warning_posted_ ?

View File

@ -8,6 +8,19 @@
* insetinclude.C:
* insetwrap.C: tostr from own header
* insetcommand.C:
* insetexternal.C:
* insetfloat.C:
* insetfloat.h:
* insetgraphics.C:
* insetinclude.C:
* insetminipage.C:
* insetparent.C:
* insettabular.C:
* insettext.C:
* insetwrap.C: STRCONV
2003-05-12 André Pönitz <poenitz@gmx.net>
* insetcaption.C:

View File

@ -124,7 +124,7 @@ void InsetCommandMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -147,14 +147,12 @@ void InsetCommandMailer::string2params(string const & in,
}
string const
InsetCommandMailer::params2string(string const & name,
string const InsetCommandMailer::params2string(string const & name,
InsetCommandParams const & params)
{
ostringstream data;
data << name << ' ';
params.write(data);
data << "\\end_inset\n";
return data.str();
return STRCONV(data.str());
}

View File

@ -385,7 +385,7 @@ void InsetExternalMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -422,6 +422,5 @@ InsetExternalMailer::params2string(InsetExternal::Params const & params)
data << name_ << ' ';
inset.write(0, data);
data << "\\end_inset\n";
return data.str();
return STRCONV(data.str());
}

View File

@ -23,6 +23,7 @@
#include "gettext.h"
#include "iterators.h"
#include "LaTeXFeatures.h"
#include "Lsstream.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxtext.h"
@ -38,6 +39,7 @@
using std::ostream;
using std::endl;
// With this inset it will be possible to support the latex package
// float.sty, and I am sure that with this and some additional support
// classes we can support similar functionality in other formats
@ -400,7 +402,7 @@ void InsetFloatMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -426,12 +428,10 @@ void InsetFloatMailer::string2params(string const & in,
}
string const
InsetFloatMailer::params2string(InsetFloatParams const & params)
string const InsetFloatMailer::params2string(InsetFloatParams const & params)
{
ostringstream data;
data << name_ << ' ';
params.write(data);
return data.str();
return STRCONV(data.str());
}

View File

@ -10,9 +10,8 @@
* Full author contact details are available in file CREDITS
*/
#ifndef InsetFloat_H
#define InsetFloat_H
#ifndef INSETFLOAT_H
#define INSETFLOAT_H
#include "insetcollapsable.h"
#include "toc.h"

View File

@ -84,6 +84,7 @@ TODO
#include "support/lyxalgo.h" // lyx::count
#include "support/lyxlib.h" // float_equal
#include "support/path.h"
#include "support/tostr.h"
#include "support/systemcall.h"
#include "support/os.h"
@ -120,12 +121,7 @@ string const RemoveExtension(string const & filename)
string const uniqueID()
{
static unsigned int seed = 1000;
ostringstream ost;
ost << "graph" << ++seed;
// Needed if we use lyxstring.
return STRCONV(ost.str());
return "graph" + tostr(++seed);
}
@ -891,7 +887,7 @@ void InsetGraphicsMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -917,6 +913,5 @@ InsetGraphicsMailer::params2string(InsetGraphicsParams const & params)
data << name_ << ' ';
params.Write(data);
data << "\\end_inset\n";
return data.str();
return STRCONV(data.str());
}

View File

@ -18,6 +18,7 @@
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "Lsstream.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "Lsstream.h"
@ -39,7 +40,6 @@
#include <cstdlib>
using std::ostream;
using std::endl;
using std::vector;
@ -82,12 +82,7 @@ namespace {
string const uniqueID()
{
static unsigned int seed = 1000;
ostringstream ost;
ost << "file" << ++seed;
// Needed if we use lyxstring.
return STRCONV(ost.str());
return "file" + tostr(++seed);
}
} // namespace anon
@ -646,7 +641,7 @@ void InsetIncludeMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -683,6 +678,5 @@ InsetIncludeMailer::params2string(InsetInclude::Params const & params)
data << name_ << ' ';
inset.write(0, data);
data << "\\end_inset\n";
return data.str();
return STRCONV(data.str());
}

View File

@ -378,7 +378,7 @@ void InsetMinipageMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -410,6 +410,5 @@ InsetMinipageMailer::params2string(InsetMinipage::Params const & params)
ostringstream data;
data << name_ << ' ';
params.write(data);
return data.str();
return STRCONV(data.str());
}

View File

@ -40,7 +40,8 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
string const InsetParent::getScreenLabel(Buffer const *) const
{
#if USE_BOOST_FORMAT
return boost::io::str(boost::format(_("Parent: %s")) % getContents());
return STRCONV(boost::io::str(boost::format(_("Parent: %s"))
% STRCONV(getContents())));
#else
return _("Parent: ") + getContents();
#endif

View File

@ -2868,7 +2868,7 @@ string const InsetTabularMailer::inset2string() const
int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
{
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -2916,8 +2916,7 @@ int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
}
string const
InsetTabularMailer::params2string(InsetTabular const & inset)
string const InsetTabularMailer::params2string(InsetTabular const & inset)
{
BufferView * const bv = inset.view();
Buffer const * const buffer = bv ? bv->buffer() : 0;
@ -2928,6 +2927,5 @@ InsetTabularMailer::params2string(InsetTabular const & inset)
data << name_ << " \\active_cell " << inset.getActCell() << '\n';
inset.write(buffer, data);
data << "\\end_inset\n";
return data.str();
return STRCONV(data.str());
}

View File

@ -1405,7 +1405,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
cur_value = pit->params().spacing().getValue();
}
istringstream istr(ev.argument.c_str());
istringstream istr(STRCONV(ev.argument));
string tmp;
istr >> tmp;
Spacing::Space new_spacing = cur_spacing;

View File

@ -20,6 +20,7 @@
#include "FloatList.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "Lsstream.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxtext.h"
@ -34,11 +35,13 @@
using std::ostream;
using std::endl;
namespace {
// this should not be hardcoded, but be part of the definition
// of the float (JMarc)
string const caplayout("Caption");
string floatname(string const & type, BufferParams const & bp)
{
FloatList const & floats = bp.getLyXTextClass().floats();
@ -305,7 +308,7 @@ void InsetWrapMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(in);
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);
@ -331,12 +334,10 @@ void InsetWrapMailer::string2params(string const & in,
}
string const
InsetWrapMailer::params2string(InsetWrapParams const & params)
string const InsetWrapMailer::params2string(InsetWrapParams const & params)
{
ostringstream data;
data << name_ << ' ';
params.write(data);
return data.str();
return STRCONV(data.str());
}

View File

@ -51,8 +51,7 @@ string const CommandInset::createDialogStr(string const & name) const
WriteStream wsdata(data);
write(wsdata);
wsdata << "\n\\end_inset\n\n";
return data.str();
return STRCONV(data.str());
}

View File

@ -34,7 +34,7 @@ public:
data << name() << " active_cell " << 0 << '\n';
WriteStream ws(data);
inset_.write(ws);
return data.str();
return STRCONV(data.str());
}
protected:
@ -1075,7 +1075,7 @@ dispatch_result MathGridInset::dispatch
case LFUN_TABULAR_FEATURE: {
//lyxerr << "handling tabular-feature " << cmd.argument << "\n";
istringstream is(cmd.argument);
istringstream is(STRCONV(cmd.argument));
string s;
is >> s;
if (s == "valign-top")

View File

@ -65,7 +65,6 @@ following hack as starting point to write some macros:
#include "Lsstream.h"
#include "debug.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include <cctype>
#include <algorithm>

View File

@ -5,6 +5,8 @@
2003-05-12 André Pönitz <poenitz@gmx.net>
* lstrings.[Ch]: bformat() as wrapper around boost::format
* lyxstring.h: enable templatized constructor
2003-05-06 Lars Gullik Bjønnes <larsbj@gullik.net>

View File

@ -14,6 +14,7 @@
#include "LString.h"
#include "lstrings.h"
#include "LAssert.h"
#include "Lsstream.h"
#include "debug.h"
#include "BoostFormat.h"
@ -481,7 +482,7 @@ string const subst(string const & a,
string const subst(string const & a,
string const & oldstr, string const & newstr)
{
string lstr(a);
string lstr = a;
string::size_type i = 0;
string::size_type const olen = oldstr.length();
while ((i = lstr.find(oldstr, i)) != string::npos) {
@ -581,7 +582,7 @@ string const rsplit(string const & a, string & piece, char delim)
if (i != string::npos) { // delimiter was found
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else { // delimter was not found
} else { // delimiter was not found
piece.erase();
}
return tmp;

View File

@ -161,7 +161,7 @@ public:
/// lyxstring(5, 'n') -> "nnnnn"
lyxstring(size_type n, value_type c);
#if 1
#if 0
///
lyxstring(const_iterator first, const_iterator last);
#else
@ -169,7 +169,7 @@ public:
template<class InputIterator>
lyxstring::lyxstring(InputIterator begin, InputIterator end) {
while (begin != end) {
push_back((*begin));
push_back(*begin);
++begin;
}
}

View File

@ -10,13 +10,11 @@
#include "tex2lyx.h"
#include <iostream>
#include <string>
#include <vector>
using std::cerr;
using std::endl;
using std::ostream;
using std::string;
using std::vector;

View File

@ -21,7 +21,6 @@ using std::istream;
using std::istringstream;
using std::ostream;
using std::ostringstream;
using std::string;
using std::vector;

View File

@ -12,7 +12,6 @@
#include <cctype>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using std::cerr;
@ -20,7 +19,6 @@ using std::endl;
using std::istringstream;
using std::ostream;
using std::ostringstream;
using std::string;
using std::vector;
#include "mathed/math_gridinfo.h"
@ -29,7 +27,7 @@ namespace {
int string2int(string const & s, int deflt = 0)
{
istringstream is(s);
istringstream is(STRCONV(s));
int i = deflt;
is >> i;
return i;
@ -53,7 +51,7 @@ string read_hlines(Parser & p)
};
//cerr << "read_hlines(), read: '" << os.str() << "'\n";
//cerr << "read_hlines(), next token: " << p.next_token() << "\n";
return os.str();
return STRCONV(os.str());
}
@ -285,7 +283,7 @@ void handle_tabular(Parser & p, ostream & os)
ostringstream ss;
ss << read_hlines(p) << HLINE; // handle initial hlines
parse_table(p, ss, FLAG_END);
split(ss.str(), lines, LINE);
split(STRCONV(ss.str()), lines, LINE);
vector< vector<CellInfo> > cellinfo(lines.size());
vector<RowInfo> rowinfo(lines.size());

View File

@ -25,11 +25,9 @@ using std::istringstream;
using std::ostream;
using std::ostringstream;
using std::stringstream;
using std::string;
using std::vector;
void handle_comment(Parser & p)
{
string s;
@ -65,7 +63,7 @@ string const trim(string const & a, char const * p)
void split(string const & s, vector<string> & result, char delim)
{
//cerr << "split 1: '" << s << "'\n";
istringstream is(s);
istringstream is(STRCONV(s));
string t;
while (getline(is, t, delim))
result.push_back(t);
@ -81,7 +79,7 @@ string join(vector<string> const & input, char const * delim)
os << delim;
os << input[i];
}
return os.str();
return STRCONV(os.str());
}

View File

@ -13,7 +13,6 @@ using std::ios;
using std::istream;
using std::istringstream;
using std::ostream;
using std::string;
using std::vector;
@ -127,7 +126,7 @@ Parser::Parser(istream & is)
Parser::Parser(string const & s)
: lineno_(0), pos_(0)
{
istringstream is(s);
istringstream is(STRCONV(s));
tokenize(is);
}

View File

@ -11,7 +11,6 @@
#include <iostream>
#include <map>
#include <string>
#include <vector>
using std::cerr;
@ -19,7 +18,6 @@ using std::endl;
using std::map;
using std::ostream;
using std::ostringstream;
using std::string;
using std::vector;
@ -599,7 +597,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer)
ss << "\\fancyhead";
ss << p.getOpt();
ss << '{' << p.verbatim_item() << "}\n";
handle_ert(os, ss.str());
handle_ert(os, STRCONV(ss.str()));
}
else {
@ -631,7 +629,7 @@ string parse_text(Parser & p, unsigned flags, const bool outer)
{
ostringstream os;
parse_text(p, os, flags, outer);
return os.str();
return STRCONV(os.str());
}

View File

@ -16,6 +16,7 @@
#include "BufferView.h"
#include "funcrequest.h"
#include "lyxrc.h"
#include "Lsstream.h"
#include "debug.h"
#include "bufferparams.h"
#include "buffer.h"
@ -877,7 +878,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (cur_spacing == Spacing::Other)
cur_value = pit->params().spacing().getValue();
istringstream is(cmd.argument.c_str());
istringstream is(STRCONV(cmd.argument));
string tmp;
is >> tmp;
Spacing::Space new_spacing = cur_spacing;
@ -1062,7 +1063,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_SETXY: {
int x = 0;
int y = 0;
istringstream is(cmd.argument.c_str());
istringstream is(STRCONV(cmd.argument));
is >> x >> y;
if (!is)
lyxerr << "SETXY: Could not parse coordinates in '"