Get rid of lyxstring, remove usage of STRCONV.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7751 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-09-15 11:00:00 +00:00
parent 5c4bfd0354
commit cd03e2b7db
64 changed files with 248 additions and 2610 deletions

View File

@ -185,6 +185,7 @@ src/mathed/ref_inset.C
src/paragraph.C src/paragraph.C
src/paragraph_funcs.C src/paragraph_funcs.C
src/rowpainter.C src/rowpainter.C
src/support/path_defines.C
src/text.C src/text.C
src/text2.C src/text2.C
src/text3.C src/text3.C

View File

@ -1,3 +1,24 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* Chktex.C
* LaTeX.C
* LaTeXFeatures.C
* ParagraphParameters.C
* Spacing.C
* buffer.C
* bufferparams.C
* bufferview_funcs.C
* chset.C
* counters.C
* funcrequest.C
* lyxfont.C
* lyxgluelength.C
* lyxlength.C
* paragraph.C
* paragraph_funcs.C
* text3.C
* vc-backend.C: remove usage of STRCONV
2003-09-15 Angus Leeming <leeming@lyx.org> 2003-09-15 Angus Leeming <leeming@lyx.org>
* rowpainter.C (paintLengthMarker, paintPageBreak, paintAppendixStart): * rowpainter.C (paintLengthMarker, paintPageBreak, paintAppendixStart):

View File

@ -64,7 +64,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
string const tmp = OnlyFilename(ChangeExtension(file, ".log")); string const tmp = OnlyFilename(ChangeExtension(file, ".log"));
#if USE_BOOST_FORMAT #if USE_BOOST_FORMAT
boost::format msg(STRCONV(_("ChkTeX warning id # %1$d"))); boost::format msg(_("ChkTeX warning id # %1$d"));
#else #else
string const msg(_("ChkTeX warning id # ")); string const msg(_("ChkTeX warning id # "));
#endif #endif
@ -85,7 +85,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
#if USE_BOOST_FORMAT #if USE_BOOST_FORMAT
msg % warno; msg % warno;
terr.insertError(lineno, STRCONV(msg.str()), warning); terr.insertError(lineno, msg.str(), warning);
msg.clear(); msg.clear();
#else #else
terr.insertError(lineno, msg + warno, warning); terr.insertError(lineno, msg + warno, warning);

View File

@ -48,6 +48,10 @@ using lyx::support::suffixIs;
using lyx::support::Systemcall; using lyx::support::Systemcall;
using lyx::support::unlink; using lyx::support::unlink;
using boost::regex;
using boost::smatch;
#ifndef CXX_GLOBAL_CSTD #ifndef CXX_GLOBAL_CSTD
using std::sscanf; using std::sscanf;
#endif #endif
@ -59,15 +63,6 @@ using std::ifstream;
using std::set; using std::set;
using std::vector; using std::vector;
using boost::regex;
#ifndef USE_INCLUDED_STRING
using boost::smatch;
#else
using boost::cmatch;
#endif
// TODO: in no particular order // TODO: in no particular order
// - get rid of the extern BufferList and the call to // - get rid of the extern BufferList and the call to
// BufferList::updateIncludedTeXfiles, this should either // BufferList::updateIncludedTeXfiles, this should either
@ -456,13 +451,9 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
while (getline(ifs, token)) { while (getline(ifs, token)) {
token = rtrim(token, "\r"); token = rtrim(token, "\r");
#ifndef USE_INCLUDED_STRING
smatch sub; smatch sub;
#else if (regex_match(token, sub, reg1)) {
cmatch sub; string data = sub.str(1);
#endif
if (regex_match(STRCONV(token), sub, reg1)) {
string data = STRCONV(sub.str(1));
while (!data.empty()) { while (!data.empty()) {
string citation; string citation;
data = split(data, citation, ','); data = split(data, citation, ',');
@ -470,8 +461,8 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
<< citation << endl; << citation << endl;
aux_info.citations.insert(citation); aux_info.citations.insert(citation);
} }
} else if (regex_match(STRCONV(token), sub, reg2)) { } else if (regex_match(token, sub, reg2)) {
string data = sub.STRCONV(str(1)); string data = sub.str(1);
// data is now all the bib files separated by ',' // data is now all the bib files separated by ','
// get them one by one and pass them to the helper // get them one by one and pass them to the helper
while (!data.empty()) { while (!data.empty()) {
@ -482,16 +473,16 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
<< database << '\'' << endl; << database << '\'' << endl;
aux_info.databases.insert(database); aux_info.databases.insert(database);
} }
} else if (regex_match(STRCONV(token), sub, reg3)) { } else if (regex_match(token, sub, reg3)) {
string style = STRCONV(sub.str(1)); string style = sub.str(1);
// token is now the style file // token is now the style file
// pass it to the helper // pass it to the helper
style = ChangeExtension(style, "bst"); style = ChangeExtension(style, "bst");
lyxerr[Debug::LATEX] << "BibTeX style: `" lyxerr[Debug::LATEX] << "BibTeX style: `"
<< style << '\'' << endl; << style << '\'' << endl;
aux_info.styles.insert(style); aux_info.styles.insert(style);
} else if (regex_match(STRCONV(token), sub, reg4)) { } else if (regex_match(token, sub, reg4)) {
string const file2 = STRCONV(sub.str(1)); string const file2 = sub.str(1);
scanAuxFile(file2, aux_info); scanAuxFile(file2, aux_info);
} }
} }
@ -711,21 +702,18 @@ void LaTeX::deplog(DepTable & head)
token = rtrim(token, "\r"); token = rtrim(token, "\r");
if (token.empty()) continue; if (token.empty()) continue;
#ifndef USE_INCLUDED_STRING
smatch sub; smatch sub;
#else
cmatch sub; if (regex_match(token, sub, reg1)) {
#endif foundfile = sub.str(1);
if (regex_match(STRCONV(token), sub, reg1)) { } else if (regex_match(token, sub, reg2)) {
foundfile = STRCONV(sub.str(1)); foundfile = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg2)) { } else if (regex_match(token, sub, reg3)) {
foundfile = STRCONV(sub.str(1)); foundfile = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg3)) { } else if (regex_match(token, sub, reg4)) {
foundfile = STRCONV(sub.str(1)); foundfile = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg4)) { } else if (regex_match(token, sub, reg5)) {
foundfile = STRCONV(sub.str(1)); foundfile = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg5)) {
foundfile = STRCONV(sub.str(1));
} else { } else {
continue; continue;
} }
@ -758,7 +746,7 @@ void LaTeX::deplog(DepTable & head)
// (2) foundfile is in the tmpdir // (2) foundfile is in the tmpdir
// insert it into head // insert it into head
else if (FileInfo(OnlyFilename(foundfile)).exist()) { else if (FileInfo(OnlyFilename(foundfile)).exist()) {
if (regex_match(STRCONV(foundfile), unwanted)) { if (regex_match(foundfile, unwanted)) {
lyxerr[Debug::DEPEND] lyxerr[Debug::DEPEND]
<< "We don't want " << "We don't want "
<< OnlyFilename(foundfile) << OnlyFilename(foundfile)

View File

@ -159,7 +159,7 @@ string LaTeXFeatures::getLanguages() const
++cit) ++cit)
languages << (*cit)->babel() << ','; languages << (*cit)->babel() << ',';
return STRCONV(languages.str()); return languages.str();
} }
@ -304,7 +304,7 @@ string const LaTeXFeatures::getPackages() const
packages << "]{natbib}\n"; packages << "]{natbib}\n";
} }
return STRCONV(packages.str()); return packages.str();
} }
@ -373,7 +373,7 @@ string const LaTeXFeatures::getMacros() const
// floats // floats
getFloatDefinitions(macros); getFloatDefinitions(macros);
return STRCONV(macros.str()); return macros.str();
} }
@ -388,7 +388,7 @@ string const LaTeXFeatures::getBabelOptions() const
if (!params.language->latex_options().empty()) if (!params.language->latex_options().empty())
tmp << params.language->latex_options() << '\n'; tmp << params.language->latex_options() << '\n';
return STRCONV(tmp.str()); return tmp.str();
} }
@ -406,7 +406,7 @@ string const LaTeXFeatures::getTClassPreamble() const
tcpreamble << tclass[*cit]->preamble(); tcpreamble << tclass[*cit]->preamble();
} }
return STRCONV(tcpreamble.str()); return tcpreamble.str();
} }
@ -419,7 +419,7 @@ string const LaTeXFeatures::getLyXSGMLEntities() const
entities << "<!ENTITY lyxarrow \"-&gt;\">" << '\n'; entities << "<!ENTITY lyxarrow \"-&gt;\">" << '\n';
} }
return STRCONV(entities.str()); return entities.str();
} }
@ -435,7 +435,7 @@ string const LaTeXFeatures::getIncludedFiles(string const & fname) const
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"") << (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
<< MakeRelPath(fi->second, basename) << "\">"; << MakeRelPath(fi->second, basename) << "\">";
return STRCONV(sgmlpreamble.str()); return sgmlpreamble.str();
} }

View File

@ -446,7 +446,7 @@ void ParagraphParameters::write(ostream & os) const
void setParagraphParams(BufferView & bv, string const & data) void setParagraphParams(BufferView & bv, string const & data)
{ {
istringstream is(STRCONV(data)); istringstream is(data);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(is); lex.setStream(is);
@ -495,5 +495,5 @@ void params2string(Paragraph const & par, string & data)
/// is paragraph in inset /// is paragraph in inset
os << "\\ininset " << (par.inInset()?1:0) << '\n'; os << "\\ininset " << (par.inInset()?1:0) << '\n';
data = STRCONV(os.str()); data = os.str();
} }

View File

@ -91,7 +91,7 @@ string const Spacing::writeEnvirBegin() const
ostringstream ost; ostringstream ost;
ost << "\\begin{spacing}{" ost << "\\begin{spacing}{"
<< getValue() << '}'; << getValue() << '}';
return STRCONV(ost.str()); return ost.str();
} }
} }
return string(); return string();

View File

@ -1053,7 +1053,7 @@ string const Buffer::asciiParagraph(Paragraph const & par,
} }
} }
buffer << word; buffer << word;
return STRCONV(buffer.str()); return buffer.str();
} }

View File

@ -337,7 +337,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
} }
} else if (token == "\\author") { } else if (token == "\\author") {
lex.nextToken(); lex.nextToken();
istringstream ss(STRCONV(lex.getString())); istringstream ss(lex.getString());
Author a; Author a;
ss >> a; ss >> a;
author_map.push_back(pimpl_->authorlist.record(a)); author_map.push_back(pimpl_->authorlist.record(a));
@ -700,7 +700,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
clsoptions << options << ','; clsoptions << options << ',';
} }
string strOptions(STRCONV(clsoptions.str())); string strOptions(clsoptions.str());
if (!strOptions.empty()) { if (!strOptions.empty()) {
strOptions = rtrim(strOptions, ","); strOptions = rtrim(strOptions, ",");
os << '[' << strOptions << ']'; os << '[' << strOptions << ']';
@ -977,7 +977,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
if (!lyxrc.language_global_options if (!lyxrc.language_global_options
&& tmp == "\\usepackage{babel}") && tmp == "\\usepackage{babel}")
tmp = string("\\usepackage[") + tmp = string("\\usepackage[") +
STRCONV(language_options.str()) + language_options.str() +
"]{babel}"; "]{babel}";
lyxpreamble += tmp + "\n"; lyxpreamble += tmp + "\n";
lyxpreamble += features.getBabelOptions(); lyxpreamble += features.getBabelOptions();

View File

@ -72,7 +72,7 @@ bool font2string(LyXFont const & font, bool toggle, string & data)
<< "color " << font.color() << '\n' << "color " << font.color() << '\n'
<< "language " << lang << '\n' << "language " << lang << '\n'
<< "toggleall " << tostr(toggle); << "toggleall " << tostr(toggle);
data = STRCONV(os.str()); data = os.str();
return true; return true;
} }
@ -81,7 +81,7 @@ bool font2string(LyXFont const & font, bool toggle, string & data)
// If successful, returns true // If successful, returns true
bool string2font(string const & data, LyXFont & font, bool & toggle) bool string2font(string const & data, LyXFont & font, bool & toggle)
{ {
istringstream is(STRCONV(data)); istringstream is(data);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(is); lex.setStream(is);
@ -370,7 +370,7 @@ string const currentState(BufferView * bv)
state << _(", Inset: ") << state << _(", Inset: ") <<
(text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1); (text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1);
#endif #endif
return STRCONV(state.str()); return state.str();
} }

View File

@ -25,6 +25,9 @@
using lyx::support::atoi; using lyx::support::atoi;
using lyx::support::LibFileSearch; using lyx::support::LibFileSearch;
using boost::regex;
using boost::smatch;
using std::endl; using std::endl;
using std::getline; using std::getline;
using std::make_pair; using std::make_pair;
@ -32,13 +35,6 @@ using std::make_pair;
using std::ifstream; using std::ifstream;
using std::pair; using std::pair;
using boost::regex;
#ifndef USE_INCLUDED_STRING
using boost::smatch;
#else
using boost::cmatch;
#endif
bool CharacterSet::loadFile(string const & fname) bool CharacterSet::loadFile(string const & fname)
@ -68,14 +64,10 @@ bool CharacterSet::loadFile(string const & fname)
// without the use of a keyword table. // without the use of a keyword table.
regex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*"); regex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
while (getline(ifs, line)) { while (getline(ifs, line)) {
#ifndef USE_INCLUDED_STRING
smatch sub; smatch sub;
#else if (regex_match(line, sub, reg)) {
cmatch sub; int const n = atoi(sub.str(1));
#endif string const str = sub.str(2);
if (regex_match(STRCONV(line), sub, reg)) {
int const n = atoi(STRCONV(sub.str(1)));
string const str = STRCONV(sub.str(2));
if (lyxerr.debugging(Debug::KBMAP)) if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "Chardef: " << n lyxerr << "Chardef: " << n
<< " to [" << str << ']' << endl; << " to [" << str << ']' << endl;

View File

@ -288,6 +288,8 @@ string Counters::counterLabel(string const & format)
{ {
string label = format; string label = format;
while (true) { while (true) {
#warning Using boost::regex would make this code a lot simpler... (Lgb)
size_t const i = label.find('\\', 0); size_t const i = label.find('\\', 0);
if (i == string::npos) if (i == string::npos)
break; break;
@ -333,5 +335,5 @@ string Counters::enumLabel(string const & ctr, string const & langtype)
os << alphaCounter(value("enumiv")) << '.'; os << alphaCounter(value("enumiv")) << '.';
} }
return STRCONV(os.str()); return os.str();
} }

View File

@ -1,3 +1,10 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlAboutlyx.C
* ControlParagraph.C
* biblio.C
* tex_helpers.C: remove usage of STRCONV
2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org> 2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
* several files: change Assert to BOOST_ASSERT * several files: change Assert to BOOST_ASSERT

View File

@ -89,5 +89,5 @@ string const ControlAboutlyx::getVersion() const
<< _("User directory: ") << _("User directory: ")
<< MakeDisplayPath(user_lyxdir()); << MakeDisplayPath(user_lyxdir());
return STRCONV(ss.str()); return ss.str();
} }

View File

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

View File

@ -239,7 +239,7 @@ string const getInfo(InfoMap const & map, string const & key)
if (!year.empty()) if (!year.empty())
result << ", " << year; result << ", " << year;
string const result_str = rtrim(STRCONV(result.str())); string const result_str = rtrim(result.str());
if (!result_str.empty()) if (!result_str.empty())
return result_str; return result_str;
@ -265,7 +265,7 @@ string const escape_special_chars(string const & expr)
// The '$' must be prefixed with the escape character '\' for // The '$' must be prefixed with the escape character '\' for
// boost to treat it as a literal. // boost to treat it as a literal.
// Thus, to prefix a matched expression with '\', we use: // Thus, to prefix a matched expression with '\', we use:
return STRCONV(reg.Merge(STRCONV(expr), "\\\\$&")); return reg.Merge(expr, "\\\\$&");
} }
@ -276,7 +276,7 @@ struct RegexMatch
// re and icase are used to construct an instance of boost::RegEx. // re and icase are used to construct an instance of boost::RegEx.
// if icase is true, then matching is insensitive to case // if icase is true, then matching is insensitive to case
RegexMatch(InfoMap const & m, string const & re, bool icase) RegexMatch(InfoMap const & m, string const & re, bool icase)
: map_(m), regex_(STRCONV(re), icase) {} : map_(m), regex_(re, icase) {}
bool operator()(string const & key) { bool operator()(string const & key) {
if (!validRE()) if (!validRE())
@ -291,7 +291,7 @@ struct RegexMatch
// Attempts to find a match for the current RE // Attempts to find a match for the current RE
// somewhere in data. // somewhere in data.
return regex_.Search(STRCONV(data)); return regex_.Search(data);
} }
bool validRE() const { return regex_.error_code() == 0; } bool validRE() const { return regex_.error_code() == 0; }

View File

@ -76,7 +76,7 @@ void getTexFileList(string const & filename, std::vector<string> & list)
std::vector<string>::iterator it = list.begin(); std::vector<string>::iterator it = list.begin();
std::vector<string>::iterator end = list.end(); std::vector<string>::iterator end = list.end();
for (; it != end; ++it) { for (; it != end; ++it) {
*it = STRCONV(regex.Merge(STRCONV((*it)), "/")); *it = regex.Merge((*it), "/");
} }
lyx::eliminate_duplicates(list); lyx::eliminate_duplicates(list);

View File

@ -1,3 +1,10 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* Color.C
* FormMathsDelim.C
* FormMathsMatrix.C
* lyx_gui.C: remove usage of STRCONV
2003-09-15 Angus Leeming <leeming@lyx.org> 2003-09-15 Angus Leeming <leeming@lyx.org>
* xforms_helpers.C: * xforms_helpers.C:

View File

@ -79,7 +79,7 @@ string const X11hexname(RGBColor const & col)
<< setw(2) << col.g << setw(2) << col.g
<< setw(2) << col.b; << setw(2) << col.b;
return STRCONV(ostr.str()); return ostr.str();
} }

View File

@ -87,7 +87,7 @@ void FormMathsDelim::apply()
ostringstream os; ostringstream os;
os << delim_values[left] << ' ' << delim_values[right]; os << delim_values[left] << ' ' << delim_values[right];
controller().dispatchDelim(STRCONV(os.str())); controller().dispatchDelim(os.str());
} }

View File

@ -95,7 +95,7 @@ void FormMathsMatrix::apply()
ostringstream os; ostringstream os;
os << nx << ' ' << ny << ' ' << c << ' ' << sh; os << nx << ' ' << ny << ' ' << c << ' ' << sh;
controller().dispatchMatrix(STRCONV(os.str())); controller().dispatchMatrix(os.str());
} }

View File

@ -347,7 +347,7 @@ string const hexname(LColor::color col)
<< setw(2) << g << setw(2) << g
<< setw(2) << b; << setw(2) << b;
return STRCONV(os.str()); return os.str();
} }

View File

@ -111,7 +111,7 @@ void FuncRequest::errorMessage(string const & msg) const
void split(vector<string> & args, string str) void split(vector<string> & args, string str)
{ {
istringstream is(STRCONV(str)); istringstream is(str);
while (is) { while (is) {
char c; char c;
string s; string s;

View File

@ -1,3 +1,8 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* GraphicsConverter.C
* PreviewLoader.C: remove usage of STRCONV
2003-09-14 Angus Leeming <leeming@lyx.org> 2003-09-14 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C (remove): consider all InProgressProcesses when * PreviewLoader.C (remove): consider all InProgressProcesses when

View File

@ -177,7 +177,7 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base,
lyxerr[Debug::GRAPHICS] << "\tConversion script:" lyxerr[Debug::GRAPHICS] << "\tConversion script:"
<< "\n--------------------------------------\n" << "\n--------------------------------------\n"
<< STRCONV(script.str()) << script.str()
<< "\n--------------------------------------\n"; << "\n--------------------------------------\n";
// Output the script to file. // Output the script to file.
@ -189,7 +189,7 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base,
if (!fs.good()) if (!fs.good())
return; return;
fs << STRCONV(script.str()); fs << script.str();
fs.close(); fs.close();
// The command needed to run the conversion process // The command needed to run the conversion process
@ -259,7 +259,7 @@ string const move_file(string const & from_file, string const & to_file)
<< "\t'rm' -f ${fromfile}\n" << "\t'rm' -f ${fromfile}\n"
<< "}\n"; << "}\n";
return STRCONV(command.str()); return command.str();
} }

View File

@ -255,7 +255,7 @@ struct IncrementedFileName {
{ {
ostringstream os; ostringstream os;
os << base_ << counter_++ << '.' << to_format_; os << base_ << counter_++ << '.' << to_format_;
string const file = STRCONV(os.str()); string const file = os.str();
return make_pair(snippet, file); return make_pair(snippet, file);
} }
@ -480,7 +480,7 @@ void PreviewLoader::Impl::startLoading()
cs << pconverter_->command << ' ' << latexfile << ' ' cs << pconverter_->command << ' ' << latexfile << ' '
<< int(font_scaling_factor_) << ' ' << pconverter_->to; << int(font_scaling_factor_) << ' ' << pconverter_->to;
string const command = "sh " + support::LibScriptSearch(STRCONV(cs.str())); string const command = "sh " + support::LibScriptSearch(cs.str());
// Initiate the conversion from LaTeX to bitmap images files. // Initiate the conversion from LaTeX to bitmap images files.
support::Forkedcall::SignalTypePtr support::Forkedcall::SignalTypePtr

View File

@ -1,7 +1,20 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetcommand.C
* insetexternal.C
* insetfloat.C
* insetgraphics.C
* insetinclude.C
* insetminipage.C
* insetnote.C
* insettabular.C
* insetwrap.C: remove usage of STRCONV
2003-09-15 Angus Leeming <leeming@lyx.org> 2003-09-15 Angus Leeming <leeming@lyx.org>
* renderers.C (draw): * renderers.C (draw):
* insetlatexaccent.C (draw): explicitly define the color passed to the painter. * insetlatexaccent.C (draw): explicitly define the color passed to
the painter.
2003-09-10 Martin Vermeer <martin.vermeer@hut.fi> 2003-09-10 Martin Vermeer <martin.vermeer@hut.fi>

View File

@ -213,7 +213,7 @@ string const InsetBranchMailer::params2string(string const & name,
params.write(data); params.write(data);
// Add all_branches parameter to data: // Add all_branches parameter to data:
data << params.branchlist.allBranches() << "\n"; data << params.branchlist.allBranches() << "\n";
return STRCONV(data.str()); return data.str();
} }
@ -225,7 +225,7 @@ void InsetBranchMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
params.read(lex); params.read(lex);

View File

@ -140,7 +140,7 @@ void InsetCommandMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
@ -170,5 +170,5 @@ string const InsetCommandMailer::params2string(string const & name,
data << name << ' '; data << name << ' ';
params.write(data); params.write(data);
data << "\\end_inset\n"; data << "\\end_inset\n";
return STRCONV(data.str()); return data.str();
} }

View File

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

View File

@ -432,7 +432,7 @@ void InsetFloatMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
@ -463,5 +463,5 @@ string const InsetFloatMailer::params2string(InsetFloatParams const & params)
ostringstream data; ostringstream data;
data << name_ << ' '; data << name_ << ' ';
params.write(data); params.write(data);
return STRCONV(data.str()); return data.str();
} }

View File

@ -335,7 +335,7 @@ string const InsetGraphics::createLatexOptions() const
if (!params().special.empty()) if (!params().special.empty())
options << params().special << ",\n"; options << params().special << ",\n";
string opts = STRCONV(options.str()); string opts = options.str();
// delete last ",\n" // delete last ",\n"
return opts.substr(0, opts.size() - 2); return opts.substr(0, opts.size() - 2);
} }
@ -707,7 +707,7 @@ void InsetGraphicsMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
@ -734,5 +734,5 @@ InsetGraphicsMailer::params2string(InsetGraphicsParams const & params,
data << name_ << ' '; data << name_ << ' ';
params.Write(data, buffer.filePath()); params.Write(data, buffer.filePath());
data << "\\end_inset\n"; data << "\\end_inset\n";
return STRCONV(data.str()); return data.str();
} }

View File

@ -608,7 +608,7 @@ string const InsetInclude::PreviewImpl::latexString() const
runparams.flavor = LatexRunParams::LATEX; runparams.flavor = LatexRunParams::LATEX;
parent().latex(*view()->buffer(), os, runparams); parent().latex(*view()->buffer(), os, runparams);
return STRCONV(os.str()); return os.str();
} }
@ -651,7 +651,7 @@ void InsetIncludeMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
@ -688,5 +688,5 @@ InsetIncludeMailer::params2string(InsetInclude::Params const & params)
data << name_ << ' '; data << name_ << ' ';
inset.write(data); inset.write(data);
data << "\\end_inset\n"; data << "\\end_inset\n";
return STRCONV(data.str()); return data.str();
} }

View File

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

View File

@ -275,7 +275,7 @@ string const InsetNoteMailer::params2string(string const & name,
ostringstream data; ostringstream data;
data << name << ' '; data << name << ' ';
params.write(data); params.write(data);
return STRCONV(data.str()); return data.str();
} }
@ -287,7 +287,7 @@ void InsetNoteMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
params.read(lex); params.read(lex);

View File

@ -2237,7 +2237,7 @@ bool InsetTabular::copySelection(BufferView * bv)
ostringstream os; ostringstream os;
paste_tabular->ascii(*bv->buffer(), os, paste_tabular->ascii(*bv->buffer(), os,
ownerPar(*bv->buffer(), this).params().depth(), true, '\t'); ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
bv->stuffClipboard(STRCONV(os.str())); bv->stuffClipboard(os.str());
return true; return true;
} }
@ -2665,7 +2665,7 @@ string const InsetTabularMailer::inset2string(Buffer const &) const
int InsetTabularMailer::string2params(string const & in, InsetTabular & inset) int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
{ {
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
@ -2719,5 +2719,5 @@ string const InsetTabularMailer::params2string(InsetTabular const & inset)
data << name_ << " \\active_cell " << inset.getActCell() << '\n'; data << name_ << " \\active_cell " << inset.getActCell() << '\n';
inset.write(buffer, data); inset.write(buffer, data);
data << "\\end_inset\n"; data << "\\end_inset\n";
return STRCONV(data.str()); return data.str();
} }

View File

@ -272,7 +272,7 @@ void InsetWrapMailer::string2params(string const & in,
if (in.empty()) if (in.empty())
return; return;
istringstream data(STRCONV(in)); istringstream data(in);
LyXLex lex(0,0); LyXLex lex(0,0);
lex.setStream(data); lex.setStream(data);
@ -303,5 +303,5 @@ string const InsetWrapMailer::params2string(InsetWrapParams const & params)
ostringstream data; ostringstream data;
data << name_ << ' '; data << name_ << ' ';
params.write(data); params.write(data);
return STRCONV(data.str()); return data.str();
} }

View File

@ -544,7 +544,7 @@ string const LyXFont::stateText(BufferParams * params) const
os << bformat(_("Language: %1$s, "), _(language()->display())); os << bformat(_("Language: %1$s, "), _(language()->display()));
if (number() != OFF) if (number() != OFF)
os << bformat(_(" Number %1$s"), _(GUIMiscNames[number()])); os << bformat(_(" Number %1$s"), _(GUIMiscNames[number()]));
return rtrim(STRCONV(os.str()), ", "); return rtrim(os.str(), ", ");
} }

View File

@ -45,7 +45,7 @@ string const LyXGlueLength::asString() const
if (plus_.zero() && minus_.zero()) { if (plus_.zero() && minus_.zero()) {
buffer << unit_name[len_.unit()]; buffer << unit_name[len_.unit()];
return STRCONV(buffer.str()); return buffer.str();
} }
// just len and plus // just len and plus
@ -54,7 +54,7 @@ string const LyXGlueLength::asString() const
buffer << unit_name[len_.unit()]; buffer << unit_name[len_.unit()];
buffer << '+' << plus_.value(); buffer << '+' << plus_.value();
buffer << unit_name[plus_.unit()]; buffer << unit_name[plus_.unit()];
return STRCONV(buffer.str()); return buffer.str();
} }
// just len and minus // just len and minus
@ -63,7 +63,7 @@ string const LyXGlueLength::asString() const
buffer << unit_name[len_.unit()]; buffer << unit_name[len_.unit()];
buffer << '-' << minus_.value(); buffer << '-' << minus_.value();
buffer << unit_name[minus_.unit()]; buffer << unit_name[minus_.unit()];
return STRCONV(buffer.str()); return buffer.str();
} }
// ok, len, plus AND minus // ok, len, plus AND minus
@ -74,7 +74,7 @@ string const LyXGlueLength::asString() const
buffer << unit_name[len_.unit()]; buffer << unit_name[len_.unit()];
buffer << "+-" << minus_.value(); buffer << "+-" << minus_.value();
buffer << unit_name[minus_.unit()]; buffer << unit_name[minus_.unit()];
return STRCONV(buffer.str()); return buffer.str();
} }
// this is so rare a case, why bother minimising units ? // this is so rare a case, why bother minimising units ?
@ -83,7 +83,7 @@ string const LyXGlueLength::asString() const
buffer << '+' << plus_.value() << unit_name[plus_.unit()]; buffer << '+' << plus_.value() << unit_name[plus_.unit()];
buffer << '-' << minus_.value() << unit_name[minus_.unit()]; buffer << '-' << minus_.value() << unit_name[minus_.unit()];
return STRCONV(buffer.str()); return buffer.str();
} }
@ -97,7 +97,7 @@ string const LyXGlueLength::asLatexString() const
buffer << " plus " << plus_.value() << unit_name[plus_.unit()]; buffer << " plus " << plus_.value() << unit_name[plus_.unit()];
if (!minus_.zero()) if (!minus_.zero())
buffer << " minus " << minus_.value() << unit_name[minus_.unit()]; buffer << " minus " << minus_.value() << unit_name[minus_.unit()];
return STRCONV(buffer.str()); return buffer.str();
} }

View File

@ -53,7 +53,7 @@ string const LyXLength::asString() const
{ {
ostringstream buffer; ostringstream buffer;
buffer << val_ << unit_name[unit_]; // setw? buffer << val_ << unit_name[unit_]; // setw?
return STRCONV(buffer.str()); return buffer.str();
} }
@ -89,7 +89,7 @@ string const LyXLength::asLatexString() const
buffer << val_ << unit_name[unit_]; // setw? buffer << val_ << unit_name[unit_]; // setw?
break; break;
} }
return STRCONV(buffer.str()); return buffer.str();
} }

View File

@ -1,6 +1,21 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* command_inset.C
* formula.C
* formulabase.C
* formulamacro.C
* math_arrayinset.C
* math_autocorrect.C
* math_cursor.C
* math_extern.C
* math_factory.C
* math_gridinset.C
* math_support.C: remove usage of STRCONV
2003-09-15 Angus Leeming <leeming@lyx.org> 2003-09-15 Angus Leeming <leeming@lyx.org>
* math_gridinset.C (draw): explicitly define the color to draw the line. * math_gridinset.C (draw): explicitly define the color to draw the
line.
2003-09-12 André Pönitz <poenitz@gmx.net> 2003-09-12 André Pönitz <poenitz@gmx.net>

View File

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

View File

@ -317,5 +317,5 @@ string const InsetFormula::PreviewImpl::latexString() const
ostringstream ls; ostringstream ls;
WriteStream wi(ls, false, false); WriteStream wi(ls, false, false);
parent().par_->write(wi); parent().par_->write(wi);
return STRCONV(ls.str()); return ls.str();
} }

View File

@ -571,7 +571,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
unsigned int n = 1; unsigned int n = 1;
string v_align; string v_align;
string h_align; string h_align;
istringstream is(STRCONV(argument)); istringstream is(argument);
is >> m >> n >> v_align >> h_align; is >> m >> n >> v_align >> h_align;
m = max(1u, m); m = max(1u, m);
n = max(1u, n); n = max(1u, n);

View File

@ -50,7 +50,7 @@ InsetFormulaMacro::InsetFormulaMacro
InsetFormulaMacro::InsetFormulaMacro(string const & s) InsetFormulaMacro::InsetFormulaMacro(string const & s)
{ {
std::istringstream is(STRCONV(s)); std::istringstream is(s);
read(is); read(is);
} }

View File

@ -48,10 +48,10 @@ MathArrayInset::MathArrayInset(string const & name, string const & str)
: MathGridInset(1, 1), name_(name) : MathGridInset(1, 1), name_(name)
{ {
vector< vector<string> > dat; vector< vector<string> > dat;
istringstream is(STRCONV(str)); istringstream is(str);
string line; string line;
while (getline(is, line)) { while (getline(is, line)) {
istringstream ls(STRCONV(line)); istringstream ls(line);
typedef istream_iterator<string> iter; typedef istream_iterator<string> iter;
vector<string> v = vector<string>(iter(ls), iter()); vector<string> v = vector<string>(iter(ls), iter());
if (v.size()) if (v.size())

View File

@ -153,7 +153,7 @@ void initAutoCorrect()
//lyxerr[Debug::MATHED] << "ignoring line '" << line << '\'' << endl; //lyxerr[Debug::MATHED] << "ignoring line '" << line << '\'' << endl;
continue; continue;
} }
istringstream il(STRCONV(line)); istringstream il(line);
//lyxerr[Debug::MATHED] << "line '" << line << '\'' << endl; //lyxerr[Debug::MATHED] << "line '" << line << '\'' << endl;
Correction corr; Correction corr;

View File

@ -1288,7 +1288,7 @@ string MathCursor::info() const
if (hasPrevAtom()) if (hasPrevAtom())
prevAtom()->infoize2(os); prevAtom()->infoize2(os);
os << " "; os << " ";
return STRCONV(os.str()); return os.str();
} }

View File

@ -938,7 +938,7 @@ namespace {
ostringstream os; ostringstream os;
MaximaStream ms(os); MaximaStream ms(os);
ms << ar; ms << ar;
string expr = STRCONV(os.str()); string expr = os.str();
string const header = "SIMPSUM:true;"; string const header = "SIMPSUM:true;";
string out; string out;
@ -1061,7 +1061,7 @@ namespace {
ostringstream os; ostringstream os;
MapleStream ms(os); MapleStream ms(os);
ms << ar; ms << ar;
string expr = STRCONV(os.str()); string expr = os.str();
lyxerr << "ar: '" << ar << "'\n" lyxerr << "ar: '" << ar << "'\n"
<< "ms: '" << os.str() << "'" << endl; << "ms: '" << os.str() << "'" << endl;
@ -1109,7 +1109,7 @@ namespace {
ostringstream os; ostringstream os;
OctaveStream vs(os); OctaveStream vs(os);
vs << ar; vs << ar;
string expr = STRCONV(os.str()); string expr = os.str();
string out; string out;
lyxerr << "pipe: ar: '" << ar << "'\n" lyxerr << "pipe: ar: '" << ar << "'\n"
@ -1193,7 +1193,7 @@ MathArray pipeThroughExtern(string const & lang, string const & extra,
os << '[' << extra << ' '; os << '[' << extra << ' ';
ns << ar; ns << ar;
os << ']'; os << ']';
string data = STRCONV(os.str()); string data = os.str();
// search external script // search external script
string file = LibFileSearch("mathed", "extern_" + lang); string file = LibFileSearch("mathed", "extern_" + lang);

View File

@ -118,7 +118,7 @@ void initSymbols()
// special case of iffont/else/endif // special case of iffont/else/endif
if (line.size() >= 7 && line.substr(0, 6) == "iffont") { if (line.size() >= 7 && line.substr(0, 6) == "iffont") {
istringstream is(STRCONV(line)); istringstream is(line);
string tmp; string tmp;
is >> tmp; is >> tmp;
is >> tmp; is >> tmp;
@ -135,12 +135,12 @@ void initSymbols()
// special case of pre-defined macros // special case of pre-defined macros
if (line.size() > 8 && line.substr(0, 5) == "\\def\\") { if (line.size() > 8 && line.substr(0, 5) == "\\def\\") {
//lyxerr << "defining: '" << line << '\'' << endl; //lyxerr << "defining: '" << line << '\'' << endl;
istringstream is(STRCONV(line)); istringstream is(line);
MathMacroTable::create(MathAtom(new MathMacroTemplate(is))); MathMacroTable::create(MathAtom(new MathMacroTemplate(is)));
continue; continue;
} }
istringstream is(STRCONV(line)); istringstream is(line);
latexkeys tmp; latexkeys tmp;
is >> tmp.name >> tmp.inset; is >> tmp.name >> tmp.inset;
if (isFontName(tmp.inset)) if (isFontName(tmp.inset))

View File

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

View File

@ -697,7 +697,7 @@ string asString(MathArray const & ar)
std::ostringstream os; std::ostringstream os;
WriteStream ws(os); WriteStream ws(os);
ws << ar; ws << ar;
return STRCONV(os.str()); return os.str();
} }

View File

@ -1160,7 +1160,7 @@ string const Paragraph::asString(Buffer const & buffer,
getInset(i)->ascii(buffer, os); getInset(i)->ascii(buffer, os);
} }
return STRCONV(os.str()); return os.str();
} }

View File

@ -968,14 +968,14 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
change = Change(Change::UNCHANGED); change = Change(Change::UNCHANGED);
} else if (token == "\\change_inserted") { } else if (token == "\\change_inserted") {
lex.nextToken(); lex.nextToken();
istringstream is(STRCONV(lex.getString())); istringstream is(lex.getString());
int aid; int aid;
lyx::time_type ct; lyx::time_type ct;
is >> aid >> ct; is >> aid >> ct;
change = Change(Change::INSERTED, bp.author_map[aid], ct); change = Change(Change::INSERTED, bp.author_map[aid], ct);
} else if (token == "\\change_deleted") { } else if (token == "\\change_deleted") {
lex.nextToken(); lex.nextToken();
istringstream is(STRCONV(lex.getString())); istringstream is(lex.getString());
int aid; int aid;
lyx::time_type ct; lyx::time_type ct;
is >> aid >> ct; is >> aid >> ct;

View File

@ -1,3 +1,18 @@
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* tostr.C:
* lstrings.C:
* filetools.C: Remove usage of STRCONV
* Makefile.am (libsupport_la_SOURCES): remove lyxstring.C and
lyxstring.h
* std_string.h: modify to always work with std::string, but if
with-included-string then use it through namespace lyx. Remove
STRCONV.
* lyxstring.[Ch]: remove files
2003-09-15 Angus Leeming <leeming@lyx.org> 2003-09-15 Angus Leeming <leeming@lyx.org>
* translator.h: add #include <boost/assert.hpp>, so that the template is * translator.h: add #include <boost/assert.hpp>, so that the template is

View File

@ -6,12 +6,7 @@ CLEANFILES = path_defines.C
INCLUDES = -I$(srcdir)/../ $(BOOST_INCLUDES) INCLUDES = -I$(srcdir)/../ $(BOOST_INCLUDES)
EXTRA_DIST = path_defines.C.in lyxstring.C lyxstring.h \ EXTRA_DIST = path_defines.C.in os_unix.C os_win32.C os_os2.C
os_unix.C os_win32.C os_os2.C
if USE_LYXSTRING
LYXSTRING = lyxstring.C lyxstring.h
endif
if USE_COMPRESSION if USE_COMPRESSION
COMPRESSION = gzstream.C gzstream.h COMPRESSION = gzstream.C gzstream.h
@ -55,7 +50,7 @@ libsupport_la_SOURCES = \
lyxmanip.h \ lyxmanip.h \
lyxtime.C \ lyxtime.C \
lyxtime.h \ lyxtime.h \
$(LYXSTRING) lyxsum.C \ lyxsum.C \
mkdir.C \ mkdir.C \
nt_defines.h \ nt_defines.h \
os.C \ os.C \

View File

@ -693,7 +693,7 @@ string const NormalizePath(string const & path)
// Normalise paths like /foo//bar ==> /foo/bar // Normalise paths like /foo//bar ==> /foo/bar
boost::RegEx regex("/{2,}"); boost::RegEx regex("/{2,}");
RTemp = STRCONV(regex.Merge(STRCONV(RTemp), "/")); RTemp = regex.Merge(RTemp, "/");
while (!RTemp.empty()) { while (!RTemp.empty()) {
// Split by next / // Split by next /
@ -729,7 +729,7 @@ string const GetFileContents(string const & fname)
if (ifs && ofs) { if (ifs && ofs) {
ofs << ifs.rdbuf(); ofs << ifs.rdbuf();
ifs.close(); ifs.close();
return STRCONV(ofs.str()); return ofs.str();
} }
} }
lyxerr << "LyX was not able to read file '" << fname << '\'' << endl; lyxerr << "LyX was not able to read file '" << fname << '\'' << endl;

View File

@ -399,8 +399,8 @@ bool regexMatch(string const & a, string const & pattern)
string regex(pattern); string regex(pattern);
regex = subst(regex, ".", "\\."); regex = subst(regex, ".", "\\.");
regex = subst(regex, "*", ".*"); regex = subst(regex, "*", ".*");
boost::regex reg(STRCONV(regex)); boost::regex reg(regex);
return boost::regex_match(STRCONV(a), reg); return boost::regex_match(a, reg);
} }
@ -616,45 +616,40 @@ string const getStringFromVector(vector<string> const & vec,
string bformat(string const & fmt, string const & arg1) string bformat(string const & fmt, string const & arg1)
{ {
return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1)).str()); return (boost::format(fmt) % arg1).str();
} }
string bformat(string const & fmt, string const & arg1, string const & arg2) string bformat(string const & fmt, string const & arg1, string const & arg2)
{ {
return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1) return (boost::format(fmt) % arg1 % arg2).str();
% STRCONV(arg2)).str());
} }
string bformat(string const & fmt, int arg1, int arg2) string bformat(string const & fmt, int arg1, int arg2)
{ {
return STRCONV((boost::format(STRCONV(fmt)) % arg1 % arg2).str()); return (boost::format(fmt) % arg1 % arg2).str();
} }
string bformat(string const & fmt, string const & arg1, string const & arg2, string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3) string const & arg3)
{ {
return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1) return (boost::format(fmt) % arg1 % arg2 % arg3).str();
% STRCONV(arg2) % STRCONV(arg3)).str());
} }
string bformat(string const & fmt, string const & arg1, string const & arg2, string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3, string const & arg4) string const & arg3, string const & arg4)
{ {
return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1) return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4).str();
% STRCONV(arg2) % STRCONV(arg3) % STRCONV(arg4)).str());
} }
string bformat(string const & fmt, string const & arg1, string const & arg2, string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3, string const & arg4, string const & arg5) string const & arg3, string const & arg4, string const & arg5)
{ {
return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1) return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4 % arg5).str();
% STRCONV(arg2) % STRCONV(arg3) % STRCONV(arg4)
% STRCONV(arg5)).str());
} }
#else #else

File diff suppressed because it is too large Load Diff

View File

@ -1,605 +0,0 @@
// -*- C++ -*-
/**
* \file lyxstring.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
// This one is heavily based on the string class in The C++
// Programming Language by Bjarne Stroustrup
// This class is supposed to be functionaly equivalent to a
// standard conformant string. This mean among others that we
// are useing the same requirements. Before you change anything
// in this file consult me and/or the standard to discover the
// right behavior.
#ifndef LYXSTRING_H
#define LYXSTRING_H
#include <iosfwd>
#if 0
#include <iterator>
#endif
#include <cstring> // for size_t
namespace lyx {
/** A string class for LyX
This is a permanent String class. It is modeled closely after the C++ STL
string class. In comparison with STL string lyxstring lack support for
reverse iterators and allocators, also char_traits is not used. In most
other senses it is written to be a drop in replacement for STL string
(or as a transition tool). So documentation for STL string should be
valid for lyxstring too.
Notes for usage:
When you declare an lyxstring, it is initially empty. There is no need to
do things like #lyxstring a= "";#, especially not in constructors.
If you want to use a default empty lyxstring as a parameter, use
#void foo(lyxstring par = lyxstring()); // Correct#
rather than
#void foo(lyxstring par = ""); // WRONG!#
#void foo(lyxstring par = 0); // WRONG!#
(The last one is only wrong because some compilers can't handle it.)
Methods that take an index as parameter all follow this rule: Valid indexes
go from 0 to length()-1.
\begin{tabular}{rl}
Correct: & #foo.substring(0, length()-1);# \\
Wrong: & #bar.substring(0, length());#
\end{tabular}
It is important that you declare lyxstring as const if possible, because
some methods are much more efficient in const versions.
If you want to check whether a string is empty, do
#if (foo.empty()) something right#
rather than something along the lines of
#if (!foo) completely wrong#
When you want to copy an lyxstring, just do
#lyxstring a, b = "String";#
#a = b; // That's it!#
not something like
#lyxstring a, b = "String";#
#a = b.copy(); // This leaks. // and does not work either. #
The class automatically handles deep copying when required.
*/
class string {
public:
/* Typedefs */
///
typedef char value_type;
///
typedef value_type * pointer;
///
typedef value_type & reference;
///
typedef value_type const & const_reference;
///
typedef size_t size_type;
///
typedef int difference_type;
///
typedef value_type * iterator;
///
typedef const value_type * const_iterator;
#if 0
///
typedef reverse_iterator<iterator, value_type, reference>
reverse_iterator;
///
typedef reverse_iterator<const_iterator, const value_type,
const_reference> const_reverse_iterator;
#endif
///
iterator begin();
///
const_iterator begin() const;
///
iterator end();
///
const_iterator end() const;
#if 0
///
reverse_iterator rbegin();
///
const_reverse_iterator rbegin() const;
///
reverse_iterator rend();
///
const_reverse_iterator rend() const;
#endif
/* Constructors and Deconstructors. lyxstring has the same
constructors as STL, except the one using iterators, one other
difference is that lyxstring, do not allow the optional allocator
parameter. */
/// "all characters" marker
static const size_type npos;
/// #string x;#
string();
/// #string x(string ...)#
string(string const &, size_type pos = 0, size_type n = npos);
/// #string x("abc", 2) -> "ab"#
string(value_type const *, size_type n);
// #string x("abc")#
string(value_type const *);
/// string(5, 'n') -> "nnnnn"
string(size_type n, value_type c);
#if 0
///
string(const_iterator first, const_iterator last);
#else
///
template<class InputIterator>
string(InputIterator begin, InputIterator end) {
while (begin != end) {
push_back(*begin);
++begin;
}
}
#endif
///
~string();
/// number of characters
size_type size() const;
/// largest possible string
size_type max_size() const { return npos - 1; }
///
size_type length() const { return size(); }
///
bool empty() const { return size() == 0; }
///
void resize(size_type n, value_type c);
///
void resize(size_type n) { resize(n, ' '); }
/// size of the memory (in number of elements) allocated.
size_type capacity() const;
///
void reserve(size_type res_arg = 0);
///
string & operator=(string const &);
///
string & operator=(value_type const *);
///
string & operator=(value_type);
///
string & assign(string const &);
///
string & assign(string const &, size_type pos, size_type n);
///
string & assign(value_type const * p, size_type n);
///
string & assign(value_type const * p);
///
string & assign(size_type n, value_type c);
#if 1
///
string & assign(const_iterator first, const_iterator last);
#else
///
template<class InputIterator>
string & assign(InputIterator begin, InputIterator end) {
clear;
while (begin != end) {
push_back((*begin));
++begin;
}
}
#endif
/// unchecked access
const_reference operator[](size_type) const;
/// unchecked access
reference operator[](size_type);
/// checked access
const_reference at(size_type) const;
/// checked access
reference at(size_type);
// add characters after (*this)[length()-1]:
///
string & operator+=(string const &);
///
string & operator+=(value_type const *);
///
string & operator+=(value_type);
///
void push_back(value_type);
///
string & append(string const &);
///
string & append(string const &, size_type pos, size_type n);
///
string & append(value_type const *, size_type n);
///
string & append(value_type const *);
///
string & append(size_type n, value_type);
#if 1
///
string & append(iterator first, iterator last);
#else
///
template<class InputIterator>
string & append(InputIterator begin, InputIterator end) {
while (begin != end) {
push_back((*begin));
++begin;
}
return *this;
}
#endif
// insert characters before (*this)[pos]:
///
string & insert(size_type pos, string const &);
///
string & insert(size_type pos, string const &,
size_type pos2, size_type n);
///
string & insert(size_type pos, value_type const * p,
size_type n);
///
string & insert(size_type pos, value_type const * p);
///
string & insert(size_type pos, size_type n, value_type c);
// insert characters before p
///
iterator insert(iterator p, value_type c);
///
void insert(iterator p, size_type n , value_type c);
#if 1
///
void insert(iterator p, iterator first, iterator last);
#else
///
template<class InputIterator>
void insert(iterator p, InputIterator begin, InputIterator end) {
iterator it;
while (begin != end) {
it = insert(p, (*begin));
++begin;
}
}
#endif
///
size_type find(string const &, size_type i = 0) const;
///
size_type find(value_type const * p,
size_type i, size_type n) const;
///
size_type find(value_type const * p, size_type i = 0) const;
///
size_type find(value_type c, size_type i = 0) const;
///
size_type rfind(string const &, size_type i = npos) const;
///
size_type rfind(value_type const * p, size_type i, size_type n) const;
///
size_type rfind(value_type const * p, size_type i = npos) const;
///
size_type rfind(value_type c, size_type i = npos) const;
///
size_type find_first_of(string const &, size_type i = 0) const;
///
size_type find_first_of(value_type const * p, size_type i,
size_type n) const;
///
size_type find_first_of(value_type const * p, size_type i = 0) const;
///
size_type find_first_of(value_type c, size_type i = 0) const;
///
size_type find_last_of(string const &, size_type i = npos) const;
///
size_type find_last_of(value_type const * p, size_type i,
size_type n) const;
///
size_type find_last_of(value_type const * p, size_type i = npos) const;
///
size_type find_last_of(value_type c, size_type i = npos) const;
///
size_type find_first_not_of(string const &, size_type i = 0) const;
///
size_type find_first_not_of(value_type const * p, size_type i,
size_type n) const;
///
size_type find_first_not_of(value_type const * p,
size_type i = 0) const;
///
size_type find_first_not_of(value_type c, size_type i = 0) const;
///
size_type find_last_not_of(string const &,
size_type i = npos) const;
///
size_type find_last_not_of(value_type const * p, size_type i,
size_type n) const;
///
size_type find_last_not_of(value_type const * p,
size_type i = npos) const;
///
size_type find_last_not_of(value_type c, size_type i = npos) const;
// replace [(*this)[i], (*this)[i+n]] with other characters:
///
string & replace(size_type i, size_type n, string const & str);
///
string & replace(size_type i, size_type n, string const & s,
size_type i2, size_type n2);
///
string & replace(size_type i, size_type n, value_type const * p,
size_type n2);
///
string & replace(size_type i, size_type n, value_type const * p);
///
string & replace(size_type i, size_type n,
size_type n2, value_type c);
/// FY! FY! FY! go away !
string & replace(size_type i, size_type n,
value_type c);
///
string & replace(iterator i, iterator i2, const string & str);
///
string & replace(iterator i, iterator i2,
value_type const * p, size_type n);
///
string & replace(iterator i, iterator i2, value_type const * p);
///
string & replace(iterator i, iterator i2,
size_type n , value_type c);
///
string & replace(iterator i, iterator i2, iterator j, iterator j2);
///
void swap(string & str);
/// Erase n chars from position i.
string & erase(size_type i = 0, size_type n = npos);
///
string & clear() {
return erase(0, npos);
}
///
iterator erase(iterator i);
///
iterator erase(iterator first, iterator last);
///
value_type const * c_str() const;
/* Note that this is STL compilant, so you can not assume
that the returned array has a trailing '\0'. */
value_type const * data() const;
/* This one returns a verbatim copy. Not the trailing '\0'
The caller must provide a buffer with engough room.
*/
size_type copy(value_type * buf, size_type len,
size_type pos = 0) const;
///
int compare(string const & str) const;
///
int compare(value_type const * p) const;
///
int compare(size_type pos, size_type n, string const & str) const;
///
int compare(size_type pos, size_type n, string const & str,
size_type pos2, size_type n2) const;
///
int compare(size_type pos, size_type n, value_type const * p,
size_type n2 = npos) const;
///
string substr(size_type i = 0, size_type n = npos) const;
private:
// These three operators can be used to discover erronous use of
// ints and strings. However a conforming C++ compiler will flag
// a lot of char operations as ambigous when they are compiled
// in. Use them for debugging only (or perhaps not even then.)
// Lgb.
//
//string & operator+(int);
//
//string & operator=(int);
//
//string & operator+=(int);
/// Compare this with s. works with embedded '\0' chars also.
int internal_compare(size_type pos, size_type n,
value_type const * s,
size_type slen, size_type n2) const;
/// Forward declaration of the string representation
struct Srep;
// DEC cxx requires this.
friend struct Srep;
/// A string is a pointer to it's representation
Srep * rep;
/* Note: The empty_rep is a local static in each function that
benefits from one. There is no "global" empty srep but string
doesn't need one (no code actually relies upon a single
empty srep).
This overcomes *all* "static initialization" problems,
at maximum speed, with a small overhead of a few local static
empty_reps.
*/
#ifdef ENABLE_ASSERTIONS
/// lyxstringInvariant is used to test the lyxstring Invariant
friend class stringInvariant;
#endif
};
// The usual comparison operators ==, !=, >, <, >=, <= are
// provided for lyxstrings
bool operator==(string const &, string const &);
bool operator==(string::value_type const *, string const &);
bool operator==(string const &, string::value_type const *);
bool operator!=(string const &, string const &);
bool operator!=(string::value_type const *, string const &);
bool operator!=(string const &, string::value_type const *);
bool operator>(string const &, string const &);
bool operator>(string::value_type const *, string const &);
bool operator>(string const &, string::value_type const *);
bool operator<(string const &, string const &);
bool operator<(string::value_type const *, string const &);
bool operator<(string const &, string::value_type const *);
bool operator>=(string const &, string const &);
bool operator>=(string::value_type const *, string const &);
bool operator>=(string const &, string::value_type const *);
bool operator<=(string const &, string const &);
bool operator<=(string::value_type const *, string const &);
bool operator<=(string const &, string::value_type const *);
// Concatenation
string operator+(string const & a, string const & b);
string operator+(char const * a, string const & b);
string operator+(string::value_type a, string const & b);
string operator+(string const & a, string::value_type const * b);
string operator+(string const & a, string::value_type b);
void swap(string & s1, string & s2);
std::istream & operator>>(std::istream &, string &);
std::ostream & operator<<(std::ostream &, string const &);
std::istream & getline(std::istream &, string &, string::value_type delim = '\n');
} // namespace lyx
#endif

View File

@ -13,27 +13,23 @@
#ifndef STD_STRING_H #ifndef STD_STRING_H
#define STD_STRING_H #define STD_STRING_H
#if 0
#ifndef _CONFIG_H
#error The <config.h> header should always be included before std_string.h
#endif
#endif
#ifndef USE_INCLUDED_STRING
#include <string> #include <string>
#ifdef USE_INCLUDED_STRING
using std::string; using std::string;
#define STRCONV(STR) STR
#else #else
#ifdef __STRING__ namespace lyx {
#error The <string> header has been included before std_string.h
#else using std::string;
#define __STRING__
#endif }
#include "support/lyxstring.h"
using lyx::string; using lyx::string;
#define STRCONV(STR) STR.c_str()
#endif #endif
#endif // NOT STD_STRING_H #endif // NOT STD_STRING_H

View File

@ -26,7 +26,7 @@ string const tostr(unsigned int i)
{ {
ostringstream os; ostringstream os;
os << i; os << i;
return STRCONV(os.str()); return os.str();
} }
@ -34,7 +34,7 @@ string const tostr(long int i)
{ {
ostringstream os; ostringstream os;
os << i; os << i;
return STRCONV(os.str()); return os.str();
} }
@ -42,7 +42,7 @@ string const tostr(double d)
{ {
ostringstream os; ostringstream os;
os << d; os << d;
return STRCONV(os.str()); return os.str();
} }
@ -50,7 +50,7 @@ string const tostr(int i)
{ {
ostringstream os; ostringstream os;
os << i; os << i;
return STRCONV(os.str()); return os.str();
} }
@ -58,4 +58,3 @@ string const tostr(string const & s)
{ {
return s; return s;
} }

View File

@ -846,7 +846,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (cur_spacing == Spacing::Other) if (cur_spacing == Spacing::Other)
cur_value = pit->params().spacing().getValue(); cur_value = pit->params().spacing().getValue();
istringstream is(STRCONV(cmd.argument)); istringstream is(cmd.argument);
string tmp; string tmp;
is >> tmp; is >> tmp;
Spacing::Space new_spacing = cur_spacing; Spacing::Space new_spacing = cur_spacing;
@ -1018,7 +1018,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
case LFUN_SETXY: { case LFUN_SETXY: {
int x = 0; int x = 0;
int y = 0; int y = 0;
istringstream is(STRCONV(cmd.argument)); istringstream is(cmd.argument);
is >> x >> y; is >> x >> y;
if (!is) if (!is)
lyxerr << "SETXY: Could not parse coordinates in '" lyxerr << "SETXY: Could not parse coordinates in '"

View File

@ -35,6 +35,10 @@ using lyx::support::rtrim;
using lyx::support::split; using lyx::support::split;
using lyx::support::Systemcall; using lyx::support::Systemcall;
using boost::regex;
using boost::regex_match;
using boost::smatch;
#ifndef CXX_GLOBAL_CSTD #ifndef CXX_GLOBAL_CSTD
using std::asctime; using std::asctime;
using std::gmtime; using std::gmtime;
@ -45,15 +49,6 @@ using std::getline;
using std::ifstream; using std::ifstream;
using boost::regex;
using boost::regex_match;
#ifndef USE_INCLUDED_STRING
using boost::smatch;
#else
using boost::cmatch;
#endif
int VCS::doVCCommand(string const & cmd, string const & path) int VCS::doVCCommand(string const & cmd, string const & path)
{ {
@ -274,17 +269,14 @@ void CVS::scanMaster()
lyxerr[Debug::LYXVC] << "\t line: " << line << endl; lyxerr[Debug::LYXVC] << "\t line: " << line << endl;
if (contains(line, tmpf)) { if (contains(line, tmpf)) {
// Ok extract the fields. // Ok extract the fields.
#ifndef USE_INCLUDED_STRING
smatch sm; smatch sm;
#else
cmatch sm; regex_match(line, sm, reg);
#endif
regex_match(STRCONV(line), sm, reg);
//sm[0]; // whole matched string //sm[0]; // whole matched string
//sm[1]; // filename //sm[1]; // filename
version_ = STRCONV(sm.str(2)); version_ = sm.str(2);
string const file_date = STRCONV(sm.str(3)); string const file_date = sm.str(3);
//sm[4]; // options //sm[4]; // options
//sm[5]; // tag or tagdate //sm[5]; // tag or tagdate