Andre Poenitz <[EMAIL PROTECTED]> writes: | On Thu, Sep 11, 2003 at 03:41:41PM +0200, Lars Gullik Bjønnes wrote: >> Andre Poenitz <[EMAIL PROTECTED]> writes: >> >> | --with-included-string >> | 283 ./frontends/qt2/ui/moc >> | 569 ./frontends/qt2/ui >> >> Did you test this now? I had to make sevral small changes to get >> with-included-string to work. > | Me too. But I don't have the patch at hand, just the results.
Patch enclosed. >> And it must have been non-working for several days, so are anyone >> really using lyxstring? > | Probably not too many... So your vote is to...?
? lyxstring.diff Index: src/factory.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/factory.C,v retrieving revision 1.54 diff -u -p -r1.54 factory.C --- src/factory.C 9 Sep 2003 22:13:23 -0000 1.54 +++ src/factory.C 11 Sep 2003 15:22:52 -0000 @@ -144,7 +144,7 @@ InsetOld * createInset(FuncRequest const case LFUN_TABULAR_INSERT: if (!cmd.argument.empty()) { - std::istringstream ss(cmd.argument); + std::istringstream ss(STRCONV(cmd.argument)); int r, c; ss >> r >> c; if (r <= 0) r = 2; Index: src/lyxfind.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfind.C,v retrieving revision 1.51 diff -u -p -r1.51 lyxfind.C --- src/lyxfind.C 9 Sep 2003 22:13:25 -0000 1.51 +++ src/lyxfind.C 11 Sep 2003 15:22:52 -0000 @@ -193,7 +193,7 @@ int replace(BufferView * bv, str2 = lowercase(text->selectionAsString(*bv->buffer(), false)); } if (str1 != str2) { - if (!find(bv, searchstr, fw, casesens, matchwrd) || + if (!lyx::find::find(bv, searchstr, fw, casesens, matchwrd) || !replaceall) { return 0; } @@ -213,7 +213,7 @@ int replace(BufferView * bv, ++replace_count; } if (!once) - found = find(bv, searchstr, fw, casesens, matchwrd); + found = lyx::find::find(bv, searchstr, fw, casesens, matchwrd); } while (!once && replaceall && found); // FIXME: should be called via an LFUN Index: src/frontends/xforms/Color.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Color.C,v retrieving revision 1.31 diff -u -p -r1.31 Color.C --- src/frontends/xforms/Color.C 9 Sep 2003 17:25:30 -0000 1.31 +++ src/frontends/xforms/Color.C 11 Sep 2003 15:22:52 -0000 @@ -39,7 +39,7 @@ int const nohue = -1; int hexstrToInt(string const & str) { int val = 0; - istringstream is(str); + istringstream is(STRCONV(str)); is >> std::setbase(16) >> val; return val; } Index: src/support/lyxstring.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lyxstring.C,v retrieving revision 1.64 diff -u -p -r1.64 lyxstring.C --- src/support/lyxstring.C 9 Sep 2003 17:25:35 -0000 1.64 +++ src/support/lyxstring.C 11 Sep 2003 15:22:53 -0000 @@ -16,6 +16,8 @@ #include "debug.h" +#include <boost/assert.hpp> + #include <iostream> #include <cstdlib> #include <cctype> @@ -60,8 +62,6 @@ using std::ostream; // Lgb. namespace lyx { - -using support::BOOST_ASSERT; /////////////////////////////////////// // The internal string representation Index: src/tex2lyx/context.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/context.C,v retrieving revision 1.6 diff -u -p -r1.6 context.C --- src/tex2lyx/context.C 9 Sep 2003 18:27:24 -0000 1.6 +++ src/tex2lyx/context.C 11 Sep 2003 15:22:53 -0000 @@ -138,7 +138,7 @@ void Context::check_end_deeper(ostream & } -void Context::dump(ostream & os, string const & desc) const +void Context::dump(ostream & os, std::string const & desc) const { os << "\n" << desc <<" ["; if (need_layout) Index: src/tex2lyx/math.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/math.C,v retrieving revision 1.10 diff -u -p -r1.10 math.C --- src/tex2lyx/math.C 9 Sep 2003 18:27:24 -0000 1.10 +++ src/tex2lyx/math.C 11 Sep 2003 15:22:53 -0000 @@ -20,10 +20,9 @@ using std::cerr; using std::endl; using std::ostream; -using std::string; -bool is_math_env(string const & name) +bool is_math_env(std::string const & name) { static char const * known_math_envs[] = { "equation", "equation*", "eqnarray", "eqnarray*", "align", "align*", "gather", "gather*", @@ -154,7 +153,7 @@ void parse_math(Parser & p, ostream & os ; else if (t.cs() == "begin") { - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); active_environments.push_back(name); os << "\\begin{" << name << "}"; if (name == "tabular") @@ -167,7 +166,7 @@ void parse_math(Parser & p, ostream & os else if (t.cs() == "end") { if (flags & FLAG_END) { // eat environment name - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); if (name != active_environment()) p.error("\\end{" + name + "} does not match \\begin{" + active_environment() + "}"); @@ -203,7 +202,7 @@ void parse_math(Parser & p, ostream & os } else if (t.cs() == "\"") { - string const name = p.verbatim_item(); + std::string const name = p.verbatim_item(); if (name == "a") os << 'ä'; else if (name == "o") os << 'ö'; else if (name == "u") os << 'ü'; Index: src/tex2lyx/preamble.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/preamble.C,v retrieving revision 1.15 diff -u -p -r1.15 preamble.C --- src/tex2lyx/preamble.C 8 Sep 2003 00:33:41 -0000 1.15 +++ src/tex2lyx/preamble.C 11 Sep 2003 15:22:53 -0000 @@ -29,7 +29,6 @@ using std::istringstream; using std::ostream; using std::ostringstream; -using std::string; using std::vector; using lyx::support::LibFileSearch; @@ -56,40 +55,40 @@ char const * known_fontsizes[] = { "10pt // some ugly stuff ostringstream h_preamble; -string h_textclass = "article"; -string h_options = string(); -string h_language = "english"; -string h_inputencoding = "latin1"; -string h_fontscheme = "default"; -string h_graphics = "default"; -string h_paperfontsize = "default"; -string h_spacing = "single"; -string h_papersize = "default"; -string h_paperpackage = "default"; -string h_use_geometry = "0"; -string h_use_amsmath = "0"; -string h_use_natbib = "0"; -string h_use_numerical_citations = "0"; -string h_paperorientation = "portrait"; -string h_secnumdepth = "3"; -string h_tocdepth = "3"; -string h_paragraph_separation = "indent"; -string h_defskip = "medskip"; -string h_quotes_language = "english"; -string h_quotes_times = "2"; -string h_papercolumns = "1"; -string h_papersides = "1"; -string h_paperpagestyle = "default"; -string h_tracking_changes = "0"; +std::string h_textclass = "article"; +std::string h_options = std::string(); +std::string h_language = "english"; +std::string h_inputencoding = "latin1"; +std::string h_fontscheme = "default"; +std::string h_graphics = "default"; +std::string h_paperfontsize = "default"; +std::string h_spacing = "single"; +std::string h_papersize = "default"; +std::string h_paperpackage = "default"; +std::string h_use_geometry = "0"; +std::string h_use_amsmath = "0"; +std::string h_use_natbib = "0"; +std::string h_use_numerical_citations = "0"; +std::string h_paperorientation = "portrait"; +std::string h_secnumdepth = "3"; +std::string h_tocdepth = "3"; +std::string h_paragraph_separation = "indent"; +std::string h_defskip = "medskip"; +std::string h_quotes_language = "english"; +std::string h_quotes_times = "2"; +std::string h_papercolumns = "1"; +std::string h_papersides = "1"; +std::string h_paperpagestyle = "default"; +std::string h_tracking_changes = "0"; -void handle_opt(vector<string> & opts, char const ** what, string & target) +void handle_opt(vector<std::string> & opts, char const ** what, std::string & target) { if (opts.empty()) return; for ( ; *what; ++what) { - vector<string>::iterator it = find(opts.begin(), opts.end(), *what); + vector<std::string>::iterator it = find(opts.begin(), opts.end(), *what); if (it != opts.end()) { //cerr << "### found option '" << *what << "'\n"; target = *what; @@ -100,7 +99,7 @@ void handle_opt(vector<string> & opts, c } -void handle_package(string const & name, string const & options) +void handle_package(std::string const & name, std::string const & options) { //cerr << "handle_package: '" << name << "'\n"; if (name == "a4wide") { @@ -226,9 +225,9 @@ LyXTextClass const parse_preamble(Parser p.get_token(); star = true; } - string const name = p.verbatim_item(); - string const opts = p.getOpt(); - string const body = p.verbatim_item(); + std::string const name = p.verbatim_item(); + std::string const opts = p.getOpt(); + std::string const body = p.verbatim_item(); // only non-lyxspecific stuff if (name != "\\noun " && name != "\\tabularnewline " @@ -253,7 +252,7 @@ LyXTextClass const parse_preamble(Parser } else if (t.cs() == "documentclass") { - vector<string> opts; + vector<std::string> opts; split(p.getArg('[', ']'), opts, ','); handle_opt(opts, known_languages, h_language); handle_opt(opts, known_fontsizes, h_paperfontsize); @@ -263,22 +262,22 @@ LyXTextClass const parse_preamble(Parser } else if (t.cs() == "usepackage") { - string const options = p.getArg('[', ']'); - string const name = p.getArg('{', '}'); + std::string const options = p.getArg('[', ']'); + std::string const name = p.getArg('{', '}'); if (options.empty() && name.find(',')) { - vector<string> vecnames; + vector<std::string> vecnames; split(name, vecnames, ','); - vector<string>::const_iterator it = vecnames.begin(); - vector<string>::const_iterator end = vecnames.end(); + vector<std::string>::const_iterator it = vecnames.begin(); + vector<std::string>::const_iterator end = vecnames.end(); for (; it != end; ++it) - handle_package(trim(*it), string()); + handle_package(trim(*it), std::string()); } else { handle_package(name, options); } } else if (t.cs() == "newenvironment") { - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); ostringstream ss; ss << "\\newenvironment{" << name << "}"; ss << p.getOpt(); @@ -292,19 +291,19 @@ LyXTextClass const parse_preamble(Parser } else if (t.cs() == "def") { - string name = p.get_token().cs(); + std::string name = p.get_token().cs(); while (p.next_token().cat() != catBegin) name += p.get_token().asString(); h_preamble << "\\def\\" << name << '{' << p.verbatim_item() << "}\n"; } else if (t.cs() == "newcolumntype") { - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); trim(name); int nargs = 0; - string opts = p.getOpt(); + std::string opts = p.getOpt(); if (opts.size()) { - istringstream is(string(opts, 1)); + istringstream is(std::string(opts, 1)); //cerr << "opt: " << is.str() << "\n"; is >> nargs; } @@ -316,8 +315,8 @@ LyXTextClass const parse_preamble(Parser } else if (t.cs() == "setcounter") { - string const name = p.getArg('{', '}'); - string const content = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); + std::string const content = p.getArg('{', '}'); if (name == "secnumdepth") h_secnumdepth = content; else if (name == "tocdepth") @@ -327,8 +326,8 @@ LyXTextClass const parse_preamble(Parser } else if (t.cs() == "setlength") { - string const name = p.verbatim_item(); - string const content = p.verbatim_item(); + std::string const name = p.verbatim_item(); + std::string const content = p.verbatim_item(); if (name == "parskip") h_paragraph_separation = "skip"; else if (name == "parindent") @@ -341,7 +340,7 @@ LyXTextClass const parse_preamble(Parser h_preamble << '\n'; else if (t.cs() == "begin") { - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); if (name == "document") break; h_preamble << "\\begin{" << name << "}"; @@ -352,7 +351,7 @@ LyXTextClass const parse_preamble(Parser } LyXTextClass textclass; - textclass.Read(LibFileSearch("layouts", h_textclass, "layout")); + textclass.Read(LibFileSearch("layouts", STRCONV(h_textclass), "layout")); end_preamble(os, textclass); return textclass; } Index: src/tex2lyx/table.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/table.C,v retrieving revision 1.20 diff -u -p -r1.20 table.C --- src/tex2lyx/table.C 9 Sep 2003 18:27:24 -0000 1.20 +++ src/tex2lyx/table.C 11 Sep 2003 15:22:53 -0000 @@ -27,7 +27,6 @@ using std::endl; using std::istringstream; using std::ostream; using std::ostringstream; -using std::string; using std::vector; #include "mathed/math_gridinfo.h" @@ -38,7 +37,7 @@ std::map<char, int> special_columns; namespace { -int string2int(string const & s, int deflt = 0) +int string2int(std::string const & s, int deflt = 0) { istringstream is(s); int i = deflt; @@ -47,7 +46,7 @@ int string2int(string const & s, int def } -string read_hlines(Parser & p) +std::string read_hlines(Parser & p) { ostringstream os; p.skip_spaces(); @@ -116,7 +115,7 @@ void handle_colalign(Parser & p, vector< case 'p': colinfo.push_back(ColInfo()); colinfo.back().align = nextalign; - colinfo.back().width = p.verbatim_item(); + colinfo.back().width = STRCONV(p.verbatim_item()); nextalign = 'b'; break; case '|': @@ -126,7 +125,7 @@ void handle_colalign(Parser & p, vector< ++colinfo.back().rightline; break; case '>': { - string s = p.verbatim_item(); + std::string s = p.verbatim_item(); if (s == "\\raggedleft ") nextalign = 'l'; else if (s == "\\raggedright ") @@ -142,7 +141,7 @@ void handle_colalign(Parser & p, vector< ci.special += t.character(); int const nargs = special_columns[t.character()]; for (int i = 0; i < nargs; ++i) - ci.special += "{" + p.verbatim_item() + "}"; + ci.special += (std::string("{") + STRCONV(p.verbatim_item()) + std::string("}")).c_str(); //cerr << "handling special column '" << t << "' " << nargs // << " '" << ci.special << "'\n"; colinfo.push_back(ci); @@ -162,7 +161,7 @@ void handle_colalign(Parser & p, vector< void parse_table(Parser & p, ostream & os, unsigned flags) { - string hlines; + std::string hlines; while (p.good()) { Token const & t = p.get_token(); @@ -247,7 +246,7 @@ void parse_table(Parser & p, ostream & o } else if (t.cs() == "begin") { - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); active_environments.push_back(name); parse_table(p, os, FLAG_END); } @@ -255,7 +254,7 @@ void parse_table(Parser & p, ostream & o else if (t.cs() == "end") { if (flags & FLAG_END) { // eat environment name - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); if (name != active_environment()) p.error("\\end{" + name + "} does not match \\begin{" + active_environment() + "}"); @@ -290,7 +289,7 @@ void handle_hline_below(RowInfo & ri, ve void handle_tabular(Parser & p, ostream & os, Context & context) { - string posopts = p.getOpt(); + std::string posopts = p.getOpt(); if (posopts.size()) cerr << "vertical tabular positioning '" << posopts << "' ignored\n"; @@ -304,7 +303,7 @@ void handle_tabular(Parser & p, ostream // first scan of cells // use table mode to keep it minimal-invasive // not exactly what's TeX doing... - vector<string> lines; + vector<std::string> lines; ostringstream ss; ss << read_hlines(p) << HLINE; // handle initial hlines parse_table(p, ss, FLAG_END); @@ -321,7 +320,7 @@ void handle_tabular(Parser & p, ostream cellinfo[row].resize(colinfo.size()); // split row - vector<string> dummy; + vector<std::string> dummy; //cerr << "\n########### LINE: " << lines[row] << "########\n"; split(lines[row], dummy, HLINE); @@ -361,9 +360,9 @@ void handle_tabular(Parser & p, ostream handle_hline_below(rowinfo[row], cellinfo[row]); } } else if (t.cs() == "cline") { - string arg = p1.verbatim_item(); + std::string arg = p1.verbatim_item(); //cerr << "read cline arg: '" << arg << "'\n"; - vector<string> t; + vector<std::string> t; split(arg, t, '-'); t.resize(2); size_t from = string2int(t[0]) - 1; @@ -385,7 +384,7 @@ void handle_tabular(Parser & p, ostream } // split into cells - vector<string> cells; + vector<std::string> cells; split(lines[row], cells, TAB); for (size_t col = 0, cell = 0; cell < cells.size() && col < colinfo.size(); ++col, ++cell) { @@ -405,7 +404,7 @@ void handle_tabular(Parser & p, ostream cellinfo[row][col].align = t.front().align; ostringstream os; parse_text_in_inset(p, os, FLAG_ITEM, false, context); - cellinfo[row][col].content = os.str(); + cellinfo[row][col].content = STRCONV(os.str()); cellinfo[row][col].leftline |= t.front().leftline; cellinfo[row][col].rightline |= t.front().rightline; @@ -427,7 +426,7 @@ void handle_tabular(Parser & p, ostream cellinfo[row][col].align = colinfo[col].align; ostringstream os; parse_text_in_inset(p, os, FLAG_CELL, false, context); - cellinfo[row][col].content = os.str(); + cellinfo[row][col].content = STRCONV(os.str()); } } Index: src/tex2lyx/tex2lyx.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/tex2lyx.C,v retrieving revision 1.49 diff -u -p -r1.49 tex2lyx.C --- src/tex2lyx/tex2lyx.C 9 Sep 2003 17:25:35 -0000 1.49 +++ src/tex2lyx/tex2lyx.C 11 Sep 2003 15:22:53 -0000 @@ -37,7 +37,6 @@ using std::ifstream; using std::istringstream; using std::ostringstream; using std::stringstream; -using std::string; using std::vector; // Hacks to allow the thing to link in the lyxlayout stuff @@ -48,7 +47,7 @@ void LyX::emergencyCleanup() {} void handle_comment(Parser & p) { - string s; + std::string s; while (p.good()) { Token const & t = p.get_token(); if (t.cat() == catNewline) @@ -60,36 +59,36 @@ void handle_comment(Parser & p) } -string const trim(string const & a, char const * p) +std::string const trim(std::string const & a, char const * p) { // BOOST_ASSERT(p); if (a.empty() || !*p) return a; - string::size_type r = a.find_last_not_of(p); - string::size_type l = a.find_first_not_of(p); + std::string::size_type r = a.find_last_not_of(p); + std::string::size_type l = a.find_first_not_of(p); // Is this the minimal test? (lgb) - if (r == string::npos && l == string::npos) - return string(); + if (r == std::string::npos && l == std::string::npos) + return std::string(); return a.substr(l, r - l + 1); } -void split(string const & s, vector<string> & result, char delim) +void split(std::string const & s, vector<std::string> & result, char delim) { //cerr << "split 1: '" << s << "'\n"; istringstream is(s); - string t; + std::string t; while (getline(is, t, delim)) result.push_back(t); //cerr << "split 2\n"; } -string join(vector<string> const & input, char const * delim) +std::string join(vector<std::string> const & input, char const * delim) { ostringstream os; for (size_t i = 0; i < input.size(); ++i) { @@ -101,7 +100,7 @@ string join(vector<string> const & input } -char const ** is_known(string const & str, char const ** what) +char const ** is_known(std::string const & str, char const ** what) { for ( ; *what; ++what) if (str == *what) @@ -112,12 +111,12 @@ char const ** is_known(string const & st // current stack of nested environments -vector<string> active_environments; +vector<std::string> active_environments; -string active_environment() +std::string active_environment() { - return active_environments.empty() ? string() : active_environments.back(); + return active_environments.empty() ? std::string() : active_environments.back(); } Index: src/tex2lyx/text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/text.C,v retrieving revision 1.23 diff -u -p -r1.23 text.C --- src/tex2lyx/text.C 9 Sep 2003 18:27:24 -0000 1.23 +++ src/tex2lyx/text.C 11 Sep 2003 15:22:53 -0000 @@ -31,15 +31,14 @@ using std::map; using std::ostream; using std::ostringstream; using std::istringstream; -using std::string; using std::vector; using lyx::support::rtrim; using lyx::support::suffixIs; -// thin wrapper around parse_text using a string -string parse_text(Parser & p, unsigned flags, const bool outer, +// thin wrapper around parse_text using a std::string +std::string parse_text(Parser & p, unsigned flags, const bool outer, Context & context) { ostringstream os; @@ -88,15 +87,15 @@ char const * known_coded_sizes[] = { "ti "small", "normal", "large", "larger", "largest", "huge", "giant", 0}; // splits "x=z, y=b" into a map -map<string, string> split_map(string const & s) +map<std::string, std::string> split_map(std::string const & s) { - map<string, string> res; - vector<string> v; + map<std::string, std::string> res; + vector<std::string> v; split(s, v); for (size_t i = 0; i < v.size(); ++i) { size_t const pos = v[i].find('='); - string const index = v[i].substr(0, pos); - string const value = v[i].substr(pos + 1, string::npos); + std::string const index = v[i].substr(0, pos); + std::string const value = v[i].substr(pos + 1, std::string::npos); res[trim(index)] = trim(value); } return res; @@ -104,22 +103,22 @@ map<string, string> split_map(string con // A simple function to translate a latex length to something lyx can // understand. Not perfect, but rather best-effort. -string translate_len(string const & len) +std::string translate_len(std::string const & len) { - const string::size_type i = len.find_first_not_of(" -01234567890."); + const std::string::size_type i = len.find_first_not_of(" -01234567890."); // a normal length - if (i == string::npos || len[i] != '\\') + if (i == std::string::npos || len[i] != '\\') return len; - istringstream iss(string(len, 0, i)); + istringstream iss(std::string(len, 0, i)); double val; iss >> val; val = val*100; ostringstream oss; oss << val; - string const valstring = oss.str(); - const string::size_type i2 = len.find(" ", i); - string const unit = string(len, i, i2 - i); - string const endlen = (i2 == string::npos) ? string() : string(len, i2); + std::string const valstring = oss.str(); + const std::string::size_type i2 = len.find(" ", i); + std::string const unit = std::string(len, i, i2 - i); + std::string const endlen = (i2 == std::string::npos) ? std::string() : std::string(len, i2); if (unit == "\\textwidth") return valstring + "text%" + endlen; else if (unit == "\\columnwidth") @@ -137,7 +136,7 @@ string translate_len(string const & len) } -void begin_inset(ostream & os, string const & name) +void begin_inset(ostream & os, std::string const & name) { os << "\n\\begin_inset " << name; } @@ -162,13 +161,13 @@ void skip_braces(Parser & p) } -void handle_ert(ostream & os, string const & s, Context const & context) +void handle_ert(ostream & os, std::string const & s, Context const & context) { Context newcontext(true, context.textclass); begin_inset(os, "ERT"); os << "\nstatus Collapsed\n"; newcontext.check_layout(os); - for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) { + for (std::string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) { if (*it == '\\') os << "\n\\backslash \n"; else @@ -180,17 +179,17 @@ void handle_ert(ostream & os, string con struct isLayout { - isLayout(string const name) : name_(name) {} + isLayout(std::string const name) : name_(name) {} bool operator()(LyXLayout_ptr const & ptr) { - return ptr.get() && ptr->latexname() == name_; + return ptr.get() && ptr->latexname() == STRCONV(name_); } private: - string const name_; + std::string const name_; }; LyXLayout_ptr findLayout(LyXTextClass const & textclass, - string const & name) + std::string const & name) { LyXTextClass::const_iterator it = textclass.begin(); LyXTextClass::const_iterator end = textclass.end(); @@ -209,7 +208,7 @@ void output_command_layout(ostream & os, context.check_deeper(os); context.check_layout(os); if (context.layout->optionalargs > 0) { - string s; + std::string s; if (p.next_token().character() == '[') { p.get_token(); // eat '[' begin_inset(os, "OptArg\n"); @@ -228,9 +227,9 @@ void parse_environment(Parser & p, ostre Context & parent_context) { LyXLayout_ptr newlayout; - string const name = p.getArg('{', '}'); - const bool is_starred = suffixIs(name, '*'); - string const unstarred_name = rtrim(name, "*"); + std::string const name = p.getArg('{', '}'); + bool const is_starred = suffixIs(name.c_str(), '*'); + std::string const unstarred_name = STRCONV(rtrim(name.c_str(), "*")); active_environments.push_back(name); if (is_math_env(name)) { parent_context.check_layout(os); @@ -248,7 +247,7 @@ void parse_environment(Parser & p, ostre end_inset(os); } - else if (parent_context.textclass.floats().typeExist(unstarred_name)) { + else if (parent_context.textclass.floats().typeExist(unstarred_name.c_str())) { parent_context.check_layout(os); begin_inset(os, "Float " + unstarred_name + "\n"); if (p.next_token().asInput() == "[") { @@ -263,9 +262,9 @@ void parse_environment(Parser & p, ostre else if (name == "minipage") { parent_context.check_layout(os); begin_inset(os, "Minipage\n"); - string position = "1"; - string inner_pos = "0"; - string height; + std::string position = "1"; + std::string inner_pos = "0"; + std::string height; if (p.next_token().asInput() == "[") { switch(p.getArg('[', ']')[0]) { case 't': position = "0"; break; @@ -463,7 +462,7 @@ void parse_text(Parser & p, ostream & os bool const is_size = is_known(p.next_token().cs(), known_sizes); Context newcontext(false, context.textclass); // need_end_layout = false; - string const s = parse_text(p, FLAG_BRACE_LAST, outer, newcontext); + std::string const s = parse_text(p, FLAG_BRACE_LAST, outer, newcontext); // need_end_layout = true; if (s.empty() && p.next_token().character() == '`') ; // ignore it in {}`` @@ -516,7 +515,7 @@ void parse_text(Parser & p, ostream & os else if (t.cs() == "end") { if (flags & FLAG_END) { // eat environment name - string const name = p.getArg('{', '}'); + std::string const name = p.getArg('{', '}'); if (name != active_environment()) cerr << "\\end{" + name + "} does not match \\begin{" + active_environment() + "}\n"; @@ -529,7 +528,7 @@ void parse_text(Parser & p, ostream & os else if (t.cs() == "item") { // should be done automatically by Parser::tokenize //p.skip_spaces(); - string s; + std::string s; if (p.next_token().character() == '[') { p.get_token(); // eat '[' Context newcontext(false, context.textclass); @@ -552,7 +551,7 @@ void parse_text(Parser & p, ostream & os } else if (t.cs() == "def") { - string name = p.get_token().cs(); + std::string name = p.get_token().cs(); while (p.next_token().cat() != catBegin) name += p.get_token().asString(); handle_ert(os, "\\def\\" + name + '{' + p.verbatim_item() + '}', context); @@ -581,8 +580,8 @@ void parse_text(Parser & p, ostream & os } else if (t.cs() == "includegraphics") { - map<string, string> opts = split_map(p.getArg('[', ']')); - string name = p.verbatim_item(); + map<std::string, std::string> opts = split_map(p.getArg('[', ']')); + std::string name = p.verbatim_item(); context.check_layout(os); begin_inset(os, "Graphics "); @@ -615,7 +614,7 @@ void parse_text(Parser & p, ostream & os else if (t.cs() == "ensuremath") { context.check_layout(os); Context newcontext(false, context.textclass); - string s = parse_text(p, FLAG_ITEM, false, newcontext); + std::string s = parse_text(p, FLAG_ITEM, false, newcontext); if (s == "±" || s == "³" || s == "²" || s == "µ") os << s; else @@ -654,8 +653,8 @@ void parse_text(Parser & p, ostream & os } else if (t.cs() == "listof") { - string const name = p.get_token().asString(); - if (context.textclass.floats().typeExist(name)) { + std::string const name = p.get_token().asString(); + if (context.textclass.floats().typeExist(name.c_str())) { context.check_layout(os); begin_inset(os, "FloatList "); os << name << "\n"; @@ -836,7 +835,7 @@ void parse_text(Parser & p, ostream & os else if (t.cs() == "\"") { context.check_layout(os); - string const name = p.verbatim_item(); + std::string const name = p.verbatim_item(); if (name == "a") os << 'ä'; else if (name == "o") os << 'ö'; else if (name == "u") os << 'ü'; @@ -865,7 +864,7 @@ void parse_text(Parser & p, ostream & os } else if (t.cs() == "\\") { - string const next = p.next_token().asInput(); + std::string const next = p.next_token().asInput(); if (next == "[") handle_ert(os, "\\\\" + p.getOpt(), context); else if (next == "*") { @@ -880,7 +879,7 @@ void parse_text(Parser & p, ostream & os else if (t.cs() == "input" || t.cs() == "include" || t.cs() == "verbatiminput") { - string name = '\\' + t.cs(); + std::string name = '\\' + t.cs(); if (t.cs() == "verbatiminput" && p.next_token().asInput() == "*") name += p.get_token().asInput(); @@ -903,8 +902,8 @@ void parse_text(Parser & p, ostream & os //cerr << "#: " << t << " mode: " << mode << endl; // heuristic: read up to next non-nested space /* - string s = t.asInput(); - string z = p.verbatim_item(); + std::string s = t.asInput(); + std::string z = p.verbatim_item(); while (p.good() && z != " " && z.size()) { //cerr << "read: " << z << endl; s += z;
-- Lgb