]> git.lyx.org Git - features.git/commitdiff
Get rid of lyxstring, remove usage of STRCONV.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 15 Sep 2003 11:00:00 +0000 (11:00 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 15 Sep 2003 11:00:00 +0000 (11:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7751 a592a061-630c-0410-9148-cb99ea01b6c8

64 files changed:
po/POTFILES.in
src/ChangeLog
src/Chktex.C
src/LaTeX.C
src/LaTeXFeatures.C
src/ParagraphParameters.C
src/Spacing.C
src/buffer.C
src/bufferparams.C
src/bufferview_funcs.C
src/chset.C
src/counters.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlAboutlyx.C
src/frontends/controllers/ControlParagraph.C
src/frontends/controllers/biblio.C
src/frontends/controllers/tex_helpers.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/Color.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/lyx_gui.C
src/funcrequest.C
src/graphics/ChangeLog
src/graphics/GraphicsConverter.C
src/graphics/PreviewLoader.C
src/insets/ChangeLog
src/insets/insetbranch.C
src/insets/insetcommand.C
src/insets/insetexternal.C
src/insets/insetfloat.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetminipage.C
src/insets/insetnote.C
src/insets/insettabular.C
src/insets/insetwrap.C
src/lyxfont.C
src/lyxgluelength.C
src/lyxlength.C
src/mathed/ChangeLog
src/mathed/command_inset.C
src/mathed/formula.C
src/mathed/formulabase.C
src/mathed/formulamacro.C
src/mathed/math_arrayinset.C
src/mathed/math_autocorrect.C
src/mathed/math_cursor.C
src/mathed/math_extern.C
src/mathed/math_factory.C
src/mathed/math_gridinset.C
src/mathed/math_support.C
src/paragraph.C
src/paragraph_funcs.C
src/support/ChangeLog
src/support/Makefile.am
src/support/filetools.C
src/support/lstrings.C
src/support/lyxstring.C [deleted file]
src/support/lyxstring.h [deleted file]
src/support/std_string.h
src/support/tostr.C
src/text3.C
src/vc-backend.C

index db0888f6ce3ffe6d334529f6182f00bc113b144e..c877ff374b1ad360f1805d67a35d099e25425026 100644 (file)
@@ -185,6 +185,7 @@ src/mathed/ref_inset.C
 src/paragraph.C
 src/paragraph_funcs.C
 src/rowpainter.C
+src/support/path_defines.C
 src/text.C
 src/text2.C
 src/text3.C
index b2fb0bfd44833ba7157e6444d7ebb111230fa477..0ab36a5883c8057175399609ac3f128229d8e5c8 100644 (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>
 
        * rowpainter.C (paintLengthMarker, paintPageBreak, paintAppendixStart):
index 7956209a6e67c3b13701d2a7dccbbf02b931f92a..9d3b7262087fc7f99faf4b269d8f1f99c3f57f9a 100644 (file)
@@ -64,7 +64,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
        string const tmp = OnlyFilename(ChangeExtension(file, ".log"));
 
 #if USE_BOOST_FORMAT
-       boost::format msg(STRCONV(_("ChkTeX warning id # %1$d")));
+       boost::format msg(_("ChkTeX warning id # %1$d"));
 #else
        string const msg(_("ChkTeX warning id # "));
 #endif
@@ -85,7 +85,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
 
 #if USE_BOOST_FORMAT
                msg % warno;
-               terr.insertError(lineno, STRCONV(msg.str()), warning);
+               terr.insertError(lineno, msg.str(), warning);
                msg.clear();
 #else
                terr.insertError(lineno, msg + warno, warning);
index 0de75eb78641c1f99f2e7b6bff7a4f92ef8d81bc..9f82bc8400f7cfff1856618981c37e1964c0f049 100644 (file)
@@ -48,6 +48,10 @@ using lyx::support::suffixIs;
 using lyx::support::Systemcall;
 using lyx::support::unlink;
 
+using boost::regex;
+using boost::smatch;
+
+
 #ifndef CXX_GLOBAL_CSTD
 using std::sscanf;
 #endif
@@ -59,15 +63,6 @@ using std::ifstream;
 using std::set;
 using std::vector;
 
-using boost::regex;
-
-#ifndef USE_INCLUDED_STRING
-using boost::smatch;
-#else
-using boost::cmatch;
-#endif
-
-
 // TODO: in no particular order
 // - get rid of the extern BufferList and the call to
 //   BufferList::updateIncludedTeXfiles, this should either
@@ -456,13 +451,9 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
 
        while (getline(ifs, token)) {
                token = rtrim(token, "\r");
-#ifndef USE_INCLUDED_STRING
                smatch sub;
-#else
-               cmatch sub;
-#endif
-               if (regex_match(STRCONV(token), sub, reg1)) {
-                       string data = STRCONV(sub.str(1));
+               if (regex_match(token, sub, reg1)) {
+                       string data = sub.str(1);
                        while (!data.empty()) {
                                string citation;
                                data = split(data, citation, ',');
@@ -470,8 +461,8 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
                                                     << citation << endl;
                                aux_info.citations.insert(citation);
                        }
-               } else if (regex_match(STRCONV(token), sub, reg2)) {
-                       string data = sub.STRCONV(str(1));
+               } else if (regex_match(token, sub, reg2)) {
+                       string data = sub.str(1);
                        // data is now all the bib files separated by ','
                        // get them one by one and pass them to the helper
                        while (!data.empty()) {
@@ -482,16 +473,16 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
                                                     << database << '\'' << endl;
                                aux_info.databases.insert(database);
                        }
-               } else if (regex_match(STRCONV(token), sub, reg3)) {
-                       string style = STRCONV(sub.str(1));
+               } else if (regex_match(token, sub, reg3)) {
+                       string style = sub.str(1);
                        // token is now the style file
                        // pass it to the helper
                        style = ChangeExtension(style, "bst");
                        lyxerr[Debug::LATEX] << "BibTeX style: `"
                                             << style << '\'' << endl;
                        aux_info.styles.insert(style);
-               } else if (regex_match(STRCONV(token), sub, reg4)) {
-                       string const file2 = STRCONV(sub.str(1));
+               } else if (regex_match(token, sub, reg4)) {
+                       string const file2 = sub.str(1);
                        scanAuxFile(file2, aux_info);
                }
        }
@@ -711,21 +702,18 @@ void LaTeX::deplog(DepTable & head)
                token = rtrim(token, "\r");
                if (token.empty()) continue;
 
-#ifndef USE_INCLUDED_STRING
                smatch sub;
-#else
-               cmatch sub;
-#endif
-               if (regex_match(STRCONV(token), sub, reg1)) {
-                       foundfile = STRCONV(sub.str(1));
-               } else if (regex_match(STRCONV(token), sub, reg2)) {
-                       foundfile = STRCONV(sub.str(1));
-               } else if (regex_match(STRCONV(token), sub, reg3)) {
-                       foundfile = STRCONV(sub.str(1));
-               } else if (regex_match(STRCONV(token), sub, reg4)) {
-                       foundfile = STRCONV(sub.str(1));
-               } else if (regex_match(STRCONV(token), sub, reg5)) {
-                       foundfile = STRCONV(sub.str(1));
+
+               if (regex_match(token, sub, reg1)) {
+                       foundfile = sub.str(1);
+               } else if (regex_match(token, sub, reg2)) {
+                       foundfile = sub.str(1);
+               } else if (regex_match(token, sub, reg3)) {
+                       foundfile = sub.str(1);
+               } else if (regex_match(token, sub, reg4)) {
+                       foundfile = sub.str(1);
+               } else if (regex_match(token, sub, reg5)) {
+                       foundfile = sub.str(1);
                } else {
                        continue;
                }
@@ -758,7 +746,7 @@ void LaTeX::deplog(DepTable & head)
                // (2) foundfile is in the tmpdir
                //     insert it into head
                else if (FileInfo(OnlyFilename(foundfile)).exist()) {
-                       if (regex_match(STRCONV(foundfile), unwanted)) {
+                       if (regex_match(foundfile, unwanted)) {
                                lyxerr[Debug::DEPEND]
                                        << "We don't want "
                                        << OnlyFilename(foundfile)
index 4ddaee94e1b1a6e68c07b5fb20acb5c5325c262a..95a2fae59d0693e27c31ed84ae991276197f87c7 100644 (file)
@@ -159,7 +159,7 @@ string LaTeXFeatures::getLanguages() const
             ++cit)
                languages << (*cit)->babel() << ',';
 
-       return STRCONV(languages.str());
+       return languages.str();
 }
 
 
@@ -304,7 +304,7 @@ string const LaTeXFeatures::getPackages() const
                packages << "]{natbib}\n";
        }
 
-       return STRCONV(packages.str());
+       return packages.str();
 }
 
 
@@ -373,7 +373,7 @@ string const LaTeXFeatures::getMacros() const
        // floats
        getFloatDefinitions(macros);
 
-       return STRCONV(macros.str());
+       return macros.str();
 }
 
 
@@ -388,7 +388,7 @@ string const LaTeXFeatures::getBabelOptions() const
        if (!params.language->latex_options().empty())
                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();
        }
 
-       return STRCONV(tcpreamble.str());
+       return tcpreamble.str();
 }
 
 
@@ -419,7 +419,7 @@ string const LaTeXFeatures::getLyXSGMLEntities() const
                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 \"" : " \"")
                             << MakeRelPath(fi->second, basename) << "\">";
 
-       return STRCONV(sgmlpreamble.str());
+       return sgmlpreamble.str();
 }
 
 
index 0b2b1dabc5f7e9dcaf47ffe2eb932dd31278ec7b..8758cb6aed1e4975ef1a0762c5e195926b649600 100644 (file)
@@ -446,7 +446,7 @@ void ParagraphParameters::write(ostream & os) const
 
 void setParagraphParams(BufferView & bv, string const & data)
 {
-       istringstream is(STRCONV(data));
+       istringstream is(data);
        LyXLex lex(0,0);
        lex.setStream(is);
 
@@ -495,5 +495,5 @@ void params2string(Paragraph const & par, string & data)
        /// is paragraph in inset
        os << "\\ininset " << (par.inInset()?1:0) << '\n';
 
-       data = STRCONV(os.str());
+       data = os.str();
 }
index 40e10c424797f8e0c8f455f2640fecdfc13c041e..e2142caa29d92951aae6b61665ccd806ca8e1848 100644 (file)
@@ -91,7 +91,7 @@ string const Spacing::writeEnvirBegin() const
                ostringstream ost;
                ost << "\\begin{spacing}{"
                    << getValue() << '}';
-               return STRCONV(ost.str());
+               return ost.str();
        }
        }
        return string();
index ff74ea1acf7a66d4d3c50455041323fed81c79d3..d8a6b5bab12a5deee9bc90eda4cc23a79b3a0e38 100644 (file)
@@ -1053,7 +1053,7 @@ string const Buffer::asciiParagraph(Paragraph const & par,
                }
        }
        buffer << word;
-       return STRCONV(buffer.str());
+       return buffer.str();
 }
 
 
index 898412419ae7d566f46cfa754c4234eae7f2ce81..4b75e387ecab29e1914905537b7f144bf732e8ed 100644 (file)
@@ -337,7 +337,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                }
        } else if (token == "\\author") {
                lex.nextToken();
-               istringstream ss(STRCONV(lex.getString()));
+               istringstream ss(lex.getString());
                Author a;
                ss >> a;
                author_map.push_back(pimpl_->authorlist.record(a));
@@ -700,7 +700,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                clsoptions << options << ',';
        }
 
-       string strOptions(STRCONV(clsoptions.str()));
+       string strOptions(clsoptions.str());
        if (!strOptions.empty()) {
                strOptions = rtrim(strOptions, ",");
                os << '[' << strOptions << ']';
@@ -977,7 +977,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                if (!lyxrc.language_global_options
                    && tmp == "\\usepackage{babel}")
                        tmp = string("\\usepackage[") +
-                               STRCONV(language_options.str()) +
+                               language_options.str() +
                                "]{babel}";
                lyxpreamble += tmp + "\n";
                lyxpreamble += features.getBabelOptions();
index 58fd4ea7099f799222d2a7e80e9e3267f3a01f28..286968a8514826157ec5e00874626da59097a203 100644 (file)
@@ -72,7 +72,7 @@ bool font2string(LyXFont const & font, bool toggle, string & data)
           << "color " << font.color() << '\n'
           << "language " << lang << '\n'
           << "toggleall " << tostr(toggle);
-       data = STRCONV(os.str());
+       data = os.str();
        return true;
 }
 
@@ -81,7 +81,7 @@ bool font2string(LyXFont const & font, bool toggle, string & data)
 // If successful, returns true
 bool string2font(string const & data, LyXFont & font, bool & toggle)
 {
-       istringstream is(STRCONV(data));
+       istringstream is(data);
        LyXLex lex(0,0);
        lex.setStream(is);
 
@@ -370,7 +370,7 @@ string const currentState(BufferView * bv)
        state << _(", Inset: ") <<
                (text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1);
 #endif
-       return STRCONV(state.str());
+       return state.str();
 }
 
 
index 9cc115f833e65300cf5b087a18e5359750e9dcc1..bddc529d87f1e61a4ad3eacff7c9976b079d44b4 100644 (file)
@@ -25,6 +25,9 @@
 using lyx::support::atoi;
 using lyx::support::LibFileSearch;
 
+using boost::regex;
+using boost::smatch;
+
 using std::endl;
 using std::getline;
 using std::make_pair;
@@ -32,13 +35,6 @@ using std::make_pair;
 using std::ifstream;
 using std::pair;
 
-using boost::regex;
-
-#ifndef USE_INCLUDED_STRING
-using boost::smatch;
-#else
-using boost::cmatch;
-#endif
 
 
 bool CharacterSet::loadFile(string const & fname)
@@ -68,14 +64,10 @@ bool CharacterSet::loadFile(string const & fname)
        // without the use of a keyword table.
        regex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
        while (getline(ifs, line)) {
-#ifndef USE_INCLUDED_STRING
                smatch sub;
-#else
-               cmatch sub;
-#endif
-               if (regex_match(STRCONV(line), sub, reg)) {
-                       int const n = atoi(STRCONV(sub.str(1)));
-                       string const str = STRCONV(sub.str(2));
+               if (regex_match(line, sub, reg)) {
+                       int const n = atoi(sub.str(1));
+                       string const str = sub.str(2);
                        if (lyxerr.debugging(Debug::KBMAP))
                                lyxerr << "Chardef: " << n
                                       << " to [" << str << ']' << endl;
index b794679ffe6f1b5cd91cceffccb12c714a3bcab2..2e3fef17c1a41c627fbb0d4bb11e653acd847c44 100644 (file)
@@ -198,7 +198,7 @@ namespace {
 
 char loweralphaCounter(int n)
 {
-       if (n < 1 || n > 26) 
+       if (n < 1 || n > 26)
                return '?';
        return 'a' + n - 1;
 }
@@ -288,6 +288,8 @@ string Counters::counterLabel(string const & format)
 {
        string label = format;
        while (true) {
+#warning Using boost::regex would make this code a lot simpler... (Lgb)
+
                size_t const i = label.find('\\', 0);
                if (i == string::npos)
                        break;
@@ -333,5 +335,5 @@ string Counters::enumLabel(string const & ctr, string const & langtype)
                        os << alphaCounter(value("enumiv")) << '.';
        }
 
-       return STRCONV(os.str());
+       return os.str();
 }
index f2d27996a864d90ff1d4f752a45cb5384167dc44..d6a5099e8c66b59a4e9e1170e6b7583e47a3c309 100644 (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>
 
        * several files: change Assert to BOOST_ASSERT
index a7ac4e76f578367c25578cb750d0e936c3bdbc7c..978abaceab0ac048d4688bd465d76bb10379b008 100644 (file)
@@ -89,5 +89,5 @@ string const ControlAboutlyx::getVersion() const
           << _("User directory: ")
           << MakeDisplayPath(user_lyxdir());
 
-       return STRCONV(ss.str());
+       return ss.str();
 }
index f37fba3105f344672588267a8071a7638f32ee3e..7e37b32abfe6a89a6e924c645914af591371bb86 100644 (file)
@@ -30,7 +30,7 @@ ControlParagraph::ControlParagraph(Dialog & parent)
 
 bool ControlParagraph::initialiseParams(string const & data)
 {
-       istringstream is(STRCONV(data));
+       istringstream is(data);
        LyXLex lex(0,0);
        lex.setStream(is);
 
@@ -120,7 +120,7 @@ void ControlParagraph::dispatchParams()
 {
        ostringstream data;
        params().write(data);
-       FuncRequest const fr(LFUN_PARAGRAPH_APPLY, STRCONV(data.str()));
+       FuncRequest const fr(LFUN_PARAGRAPH_APPLY, data.str());
        kernel().dispatch(fr);
 }
 
index 5fb96143196bf13a50183e351b68c8903bec49e0..0fa0722c4ce50c965b96a05cda67500b5a998c97 100644 (file)
@@ -239,7 +239,7 @@ string const getInfo(InfoMap const & map, string const & key)
        if (!year.empty())
                result << ", " << year;
 
-       string const result_str = rtrim(STRCONV(result.str()));
+       string const result_str = rtrim(result.str());
        if (!result_str.empty())
                return result_str;
 
@@ -265,7 +265,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:
-       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.
        // if icase is true, then matching is insensitive to case
        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) {
                if (!validRE())
@@ -291,7 +291,7 @@ struct RegexMatch
 
                // Attempts to find a match for the current RE
                // somewhere in data.
-               return regex_.Search(STRCONV(data));
+               return regex_.Search(data);
        }
 
        bool validRE() const { return regex_.error_code() == 0; }
index 2448b6fc11a9146e2b00cd2f0d09298062b2a4ac..59adcbb587c5570572c97862e1f53a7077894cd3 100644 (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 end = list.end();
        for (; it != end; ++it) {
-               *it = STRCONV(regex.Merge(STRCONV((*it)), "/"));
+               *it = regex.Merge((*it), "/");
        }
 
        lyx::eliminate_duplicates(list);
index 02816bf0cda5e80079e5c82ae87893932cb85b30..69ff1b0d7cf12c4892836305e55f57968715085e 100644 (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>
 
        * xforms_helpers.C:
index 49d1cd0408ade0e924c107ce30df1501e0998782..7b1bd7a6062f009b7c99e537415df8404e5fea01 100644 (file)
@@ -79,7 +79,7 @@ string const X11hexname(RGBColor const & col)
             << setw(2) << col.g
             << setw(2) << col.b;
 
-       return STRCONV(ostr.str());
+       return ostr.str();
 }
 
 
index 4acbbb05112a6d0dba7649f046ddfe73c5f6b27e..3d22d965df646277813d571dc304ed6b6628ce48 100644 (file)
@@ -87,7 +87,7 @@ void FormMathsDelim::apply()
 
        ostringstream os;
        os << delim_values[left] << ' ' << delim_values[right];
-       controller().dispatchDelim(STRCONV(os.str()));
+       controller().dispatchDelim(os.str());
 }
 
 
index 2e950f1710187e797db4c1d4e1f1aa1089622350..9a12b1684acf67535fd45c76a4a170fe2c0d6d74 100644 (file)
@@ -95,7 +95,7 @@ void FormMathsMatrix::apply()
 
        ostringstream os;
        os << nx << ' ' << ny << ' ' << c << ' ' << sh;
-       controller().dispatchMatrix(STRCONV(os.str()));
+       controller().dispatchMatrix(os.str());
 }
 
 
index 9c96a63e88be7332c3fd583aa31616862e53876e..d702fbfd1b69a1ccb5bde1cc5d8cbf87018c99b1 100644 (file)
@@ -347,7 +347,7 @@ string const hexname(LColor::color col)
           << setw(2) << g
           << setw(2) << b;
 
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
index ac5c173bcac6bad029c1cba751de78361e877365..d916a4c620a35a74e5f636982b0e5c0984191190 100644 (file)
@@ -111,7 +111,7 @@ void FuncRequest::errorMessage(string const & msg) const
 
 void split(vector<string> & args, string str)
 {
-       istringstream is(STRCONV(str));
+       istringstream is(str);
        while (is) {
                char c;
                string s;
index 1c163bb2771691d1e57969339a8b28280be3d017..ee4bf572d2094c86671baf323c1ff590a081de0b 100644 (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>
 
        * PreviewLoader.C (remove): consider all InProgressProcesses when
index 23a552084def640ade60602f691c27c816185024..b75095ecd0fca4d1514d0be53f2f3638d6183334 100644 (file)
@@ -177,7 +177,7 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
 
                lyxerr[Debug::GRAPHICS] << "\tConversion script:"
                        << "\n--------------------------------------\n"
-                       << STRCONV(script.str())
+                       << script.str()
                        << "\n--------------------------------------\n";
 
                // Output the script to file.
@@ -189,7 +189,7 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
                if (!fs.good())
                        return;
 
-               fs << STRCONV(script.str());
+               fs << script.str();
                fs.close();
 
                // 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"
                << "}\n";
 
-       return STRCONV(command.str());
+       return command.str();
 }
 
 
index a3432f9b22feca175e02dc71eee984e7db4d01ea..52b0952a34e4d0313c69d8f0854ab54ad7082616 100644 (file)
@@ -255,7 +255,7 @@ struct IncrementedFileName {
        {
                ostringstream os;
                os << base_ << counter_++ << '.' << to_format_;
-               string const file = STRCONV(os.str());
+               string const file = os.str();
 
                return make_pair(snippet, file);
        }
@@ -480,7 +480,7 @@ void PreviewLoader::Impl::startLoading()
        cs << pconverter_->command << ' ' << latexfile << ' '
           << 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.
        support::Forkedcall::SignalTypePtr
index fbfce3d9c46dec6fa328ca60bcf32feff8f3881d..bd9ab90d8559223ac11d8ee28f7ed1238f29a77f 100644 (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>
 
        * 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>
 
index c01cccddb8139f7054c2ecaf88b8f22c5a8ac63e..e72e5123e2f85fd83f31e49bb1aa1e9088a41a40 100644 (file)
@@ -213,7 +213,7 @@ string const InsetBranchMailer::params2string(string const & name,
        params.write(data);
        // Add all_branches parameter to data:
        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())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
        params.read(lex);
index ac5fc69b0da31d607be14bf2c158aa54144e4b43..d22818b62a5184dcc7dd2441f2444431d7326761 100644 (file)
@@ -140,7 +140,7 @@ void InsetCommandMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -170,5 +170,5 @@ string const InsetCommandMailer::params2string(string const & name,
        data << name << ' ';
        params.write(data);
        data << "\\end_inset\n";
-       return STRCONV(data.str());
+       return data.str();
 }
index 66721facd3e4c0ee67b20ae80beb4b106685740c..377080b74e6770ee0eac8760e6f990c38b5c29da 100644 (file)
@@ -633,7 +633,7 @@ void InsetExternalMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -671,5 +671,5 @@ InsetExternalMailer::params2string(InsetExternal::Params const & params,
        data << name_ << ' ';
        inset.write(buffer, data);
        data << "\\end_inset\n";
-       return STRCONV(data.str());
+       return data.str();
 }
index e2212213eab66bc8e5fb4c05183d22cbc4329e7d..4f5745432a0a74929120f6e5c4ee522915551466 100644 (file)
@@ -432,7 +432,7 @@ void InsetFloatMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -463,5 +463,5 @@ string const InsetFloatMailer::params2string(InsetFloatParams const & params)
        ostringstream data;
        data << name_ << ' ';
        params.write(data);
-       return STRCONV(data.str());
+       return data.str();
 }
index 2e6de1081a719c77308792b29900a30b956b973f..5c303d867d37604b18ebbfc182e7a089cf6e6f78 100644 (file)
@@ -335,7 +335,7 @@ string const InsetGraphics::createLatexOptions() const
        if (!params().special.empty())
            options << params().special << ",\n";
 
-       string opts = STRCONV(options.str());
+       string opts = options.str();
        // delete last ",\n"
        return opts.substr(0, opts.size() - 2);
 }
@@ -707,7 +707,7 @@ void InsetGraphicsMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -734,5 +734,5 @@ InsetGraphicsMailer::params2string(InsetGraphicsParams const & params,
        data << name_ << ' ';
        params.Write(data, buffer.filePath());
        data << "\\end_inset\n";
-       return STRCONV(data.str());
+       return data.str();
 }
index 9d756470268cfb6a36066557a43b0bea6f33a06c..240653195126cd1f0257425e040848b6273b0304 100644 (file)
@@ -608,7 +608,7 @@ string const InsetInclude::PreviewImpl::latexString() const
        runparams.flavor = LatexRunParams::LATEX;
        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())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -688,5 +688,5 @@ InsetIncludeMailer::params2string(InsetInclude::Params const & params)
        data << name_ << ' ';
        inset.write(data);
        data << "\\end_inset\n";
-       return STRCONV(data.str());
+       return data.str();
 }
index 3dabda6bb8a80b7269d4885841032056b49e693f..85b0b22d835964a0e1b37d3350d2d056b5cb59fa 100644 (file)
@@ -315,7 +315,7 @@ void InsetMinipageMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0, 0);
        lex.setStream(data);
 
@@ -347,5 +347,5 @@ InsetMinipageMailer::params2string(InsetMinipage::Params const & params)
        ostringstream data;
        data << name_ << ' ';
        params.write(data);
-       return STRCONV(data.str());
+       return data.str();
 }
index c0059f3f1669102f227274c7a972a098086c6b0b..91eca7dc493cf095d52d7f04cf069ffecf376574 100644 (file)
@@ -275,7 +275,7 @@ string const InsetNoteMailer::params2string(string const & name,
        ostringstream data;
        data << name << ' ';
        params.write(data);
-       return STRCONV(data.str());
+       return data.str();
 }
 
 
@@ -287,7 +287,7 @@ void InsetNoteMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
        params.read(lex);
index c9a759c1125291984618f66b1992e653cf948b21..7872bd04ea4e084cdcd7f769f38801e888243c38 100644 (file)
@@ -2237,7 +2237,7 @@ bool InsetTabular::copySelection(BufferView * bv)
        ostringstream os;
        paste_tabular->ascii(*bv->buffer(), os,
                             ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
-       bv->stuffClipboard(STRCONV(os.str()));
+       bv->stuffClipboard(os.str());
        return true;
 }
 
@@ -2665,7 +2665,7 @@ string const InsetTabularMailer::inset2string(Buffer const &) const
 
 int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
 {
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -2719,5 +2719,5 @@ string const InsetTabularMailer::params2string(InsetTabular const & inset)
        data << name_ << " \\active_cell " << inset.getActCell() << '\n';
        inset.write(buffer, data);
        data << "\\end_inset\n";
-       return STRCONV(data.str());
+       return data.str();
 }
index 3b9500d1f678202a41b45f02d8862fdd9e1c89ba..2183ff9eeffbc3b253f7d4e425e5f3e9ef41ada7 100644 (file)
@@ -272,7 +272,7 @@ void InsetWrapMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -303,5 +303,5 @@ string const InsetWrapMailer::params2string(InsetWrapParams const & params)
        ostringstream data;
        data << name_ << ' ';
        params.write(data);
-       return STRCONV(data.str());
+       return data.str();
 }
index 6b49371f8c6ed893173a620e3dbf591e8aa8b36c..af8803dec55c8adffbfdba0a13893e8839f80b99 100644 (file)
@@ -544,7 +544,7 @@ string const LyXFont::stateText(BufferParams * params) const
                os << bformat(_("Language: %1$s, "), _(language()->display()));
        if (number() != OFF)
                os << bformat(_("  Number %1$s"), _(GUIMiscNames[number()]));
-       return rtrim(STRCONV(os.str()), ", ");
+       return rtrim(os.str(), ", ");
 }
 
 
index 4ca88f4ed254bd934968306210b737496776f73b..8de501294d0a4feca7ff5f818dbec85d8f7d18d5 100644 (file)
@@ -45,7 +45,7 @@ string const LyXGlueLength::asString() const
 
        if (plus_.zero() && minus_.zero()) {
                buffer << unit_name[len_.unit()];
-               return STRCONV(buffer.str());
+               return buffer.str();
        }
 
        // just len and plus
@@ -54,7 +54,7 @@ string const LyXGlueLength::asString() const
                        buffer << unit_name[len_.unit()];
                buffer << '+' << plus_.value();
                buffer << unit_name[plus_.unit()];
-               return STRCONV(buffer.str());
+               return buffer.str();
        }
 
        // just len and minus
@@ -63,7 +63,7 @@ string const LyXGlueLength::asString() const
                        buffer << unit_name[len_.unit()];
                buffer << '-' << minus_.value();
                buffer << unit_name[minus_.unit()];
-               return STRCONV(buffer.str());
+               return buffer.str();
        }
 
        // ok, len, plus AND minus
@@ -74,7 +74,7 @@ string const LyXGlueLength::asString() const
                        buffer << unit_name[len_.unit()];
                buffer << "+-" << minus_.value();
                buffer << unit_name[minus_.unit()];
-               return STRCONV(buffer.str());
+               return buffer.str();
        }
 
        // 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 << '-' << 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()];
        if (!minus_.zero())
                buffer << " minus " << minus_.value() << unit_name[minus_.unit()];
-       return STRCONV(buffer.str());
+       return buffer.str();
 }
 
 
index 3a68ee23113a565f4b07724f04d306cd4411b6c7..b9e12d91342718158bbbc6005e4aef5e37746a5d 100644 (file)
@@ -53,7 +53,7 @@ string const LyXLength::asString() const
 {
        ostringstream buffer;
        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?
            break;
        }
-       return STRCONV(buffer.str());
+       return buffer.str();
 }
 
 
index 14ee801ee06464e460172cbb4b8c4f0013184648..bc4cddabe20b3111b5018715182064255b223a6a 100644 (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>
 
-       * 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>
 
index b580579b1e0ce1005c76536efa8f314834489f21..2dd301c9d69e049de043ccf95221dc13fc7fdb9d 100644 (file)
@@ -83,5 +83,5 @@ string const CommandInset::createDialogStr(string const & name) const
        WriteStream wsdata(data);
        write(wsdata);
        wsdata << "\n\\end_inset\n\n";
-       return STRCONV(data.str());
+       return data.str();
 }
index 89cb9acfbbabc45c86f6275dc0d42041b11efaa7..6b88d34a58d5244ea8bd9f34eb58e6608c096002 100644 (file)
@@ -317,5 +317,5 @@ string const InsetFormula::PreviewImpl::latexString() const
        ostringstream ls;
        WriteStream wi(ls, false, false);
        parent().par_->write(wi);
-       return STRCONV(ls.str());
+       return ls.str();
 }
index 438539d3c16fefa801f4230891b1750d6a999ef2..ad093f36305e3c55a8659afcbde742eca05740a8 100644 (file)
@@ -571,7 +571,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                unsigned int n = 1;
                string v_align;
                string h_align;
-               istringstream is(STRCONV(argument));
+               istringstream is(argument);
                is >> m >> n >> v_align >> h_align;
                m = max(1u, m);
                n = max(1u, n);
index f21e599d47947ac01b78d7ec03d038534ea603b9..475274f40748fac0fc9cffd96bc75935ff92ab49 100644 (file)
@@ -50,7 +50,7 @@ InsetFormulaMacro::InsetFormulaMacro
 
 InsetFormulaMacro::InsetFormulaMacro(string const & s)
 {
-       std::istringstream is(STRCONV(s));
+       std::istringstream is(s);
        read(is);
 }
 
index 2f25b6a937a7b349d9764ebd84ee0dd16eb81f8c..c153ef0869c1aacf4efa12473dc954e51426e7a7 100644 (file)
@@ -48,10 +48,10 @@ MathArrayInset::MathArrayInset(string const & name, string const & str)
        : MathGridInset(1, 1), name_(name)
 {
        vector< vector<string> > dat;
-       istringstream is(STRCONV(str));
+       istringstream is(str);
        string line;
        while (getline(is, line)) {
-               istringstream ls(STRCONV(line));
+               istringstream ls(line);
                typedef istream_iterator<string> iter;
                vector<string> v = vector<string>(iter(ls), iter());
                if (v.size())
index 423e12475f5092e560e895efa6eeefa24c429f97..feb6d7b58e22e4b1c275167c32af407062666182 100644 (file)
@@ -153,7 +153,7 @@ void initAutoCorrect()
                        //lyxerr[Debug::MATHED] << "ignoring line '" << line << '\'' << endl;
                        continue;
                }
-               istringstream il(STRCONV(line));
+               istringstream il(line);
 
                //lyxerr[Debug::MATHED] << "line '" << line << '\'' << endl;
                Correction corr;
index a878c210e28c40513ff6ad1e1d8663d094bb1442..ce4c12311c52601f549788e1b773ddfebf3676f6 100644 (file)
@@ -1288,7 +1288,7 @@ string MathCursor::info() const
        if (hasPrevAtom())
                prevAtom()->infoize2(os);
        os << "                    ";
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
index 2c42c7e95bd1fccf37af5ca413e8019d77a817d8..8f26fd7c5e5e3d66da7cd2fe0b33cdf398dcfb9f 100644 (file)
@@ -938,7 +938,7 @@ namespace {
                ostringstream os;
                MaximaStream ms(os);
                ms << ar;
-               string expr = STRCONV(os.str());
+               string expr = os.str();
                string const header = "SIMPSUM:true;";
 
                string out;
@@ -1061,7 +1061,7 @@ namespace {
                ostringstream os;
                MapleStream ms(os);
                ms << ar;
-               string expr = STRCONV(os.str());
+               string expr = os.str();
                lyxerr << "ar: '" << ar << "'\n"
                       << "ms: '" << os.str() << "'" << endl;
 
@@ -1109,7 +1109,7 @@ namespace {
                ostringstream os;
                OctaveStream vs(os);
                vs << ar;
-               string expr = STRCONV(os.str());
+               string expr = os.str();
                string out;
 
                lyxerr << "pipe: ar: '" << ar << "'\n"
@@ -1193,7 +1193,7 @@ MathArray pipeThroughExtern(string const & lang, string const & extra,
        os << '[' << extra << ' ';
        ns << ar;
        os << ']';
-       string data = STRCONV(os.str());
+       string data = os.str();
 
        // search external script
        string file = LibFileSearch("mathed", "extern_" + lang);
index d9e28d85b222de7f8d178e25c78620409d761d4f..aafbd98609718e9971f71dcc40b7ad175c76c01c 100644 (file)
@@ -118,7 +118,7 @@ void initSymbols()
 
                // special case of iffont/else/endif
                if (line.size() >= 7 && line.substr(0, 6) == "iffont") {
-                       istringstream is(STRCONV(line));
+                       istringstream is(line);
                        string tmp;
                        is >> tmp;
                        is >> tmp;
@@ -135,12 +135,12 @@ void initSymbols()
                // special case of pre-defined macros
                if (line.size() > 8 && line.substr(0, 5) == "\\def\\") {
                        //lyxerr << "defining: '" << line << '\'' << endl;
-                       istringstream is(STRCONV(line));
+                       istringstream is(line);
                        MathMacroTable::create(MathAtom(new MathMacroTemplate(is)));
                        continue;
                }
 
-               istringstream is(STRCONV(line));
+               istringstream is(line);
                latexkeys tmp;
                is >> tmp.name >> tmp.inset;
                if (isFontName(tmp.inset))
index 5fd22678751d389944895484158d8a4b9907192a..1b4fb07eba5b625efc1da3124bdee0d4559ee357 100644 (file)
@@ -50,7 +50,7 @@ public:
                data << name() << " active_cell " << 0 << '\n';
                WriteStream ws(data);
                inset_.write(ws);
-               return STRCONV(data.str());
+               return data.str();
        }
 
 protected:
@@ -1098,7 +1098,7 @@ dispatch_result MathGridInset::dispatch
 
                case LFUN_TABULAR_FEATURE: {
                        //lyxerr << "handling tabular-feature " << cmd.argument << endl;
-                       istringstream is(STRCONV(cmd.argument));
+                       istringstream is(cmd.argument);
                        string s;
                        is >> s;
                        if (s == "valign-top")
index e55c9286f4ea59f58d7527ce0a6b736e6b405a5a..802afbcc8502ad3a018429b7a319ab42be7bc791 100644 (file)
@@ -697,7 +697,7 @@ string asString(MathArray const & ar)
        std::ostringstream os;
        WriteStream ws(os);
        ws << ar;
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
index 21584b6b238b973dd2ed79bbb0373e4fb9d38701..730b7d0159785ab38a5dd73d88407faae3e7740b 100644 (file)
@@ -1160,7 +1160,7 @@ string const Paragraph::asString(Buffer const & buffer,
                        getInset(i)->ascii(buffer, os);
        }
 
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
index 973743df7454dbd4ced6a1498028721d43f31327..d045a69223e1d71f93bef2767888c2a4f6c63165 100644 (file)
@@ -968,14 +968,14 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
                change = Change(Change::UNCHANGED);
        } else if (token == "\\change_inserted") {
                lex.nextToken();
-               istringstream is(STRCONV(lex.getString()));
+               istringstream is(lex.getString());
                int aid;
                lyx::time_type ct;
                is >> aid >> ct;
                change = Change(Change::INSERTED, bp.author_map[aid], ct);
        } else if (token == "\\change_deleted") {
                lex.nextToken();
-               istringstream is(STRCONV(lex.getString()));
+               istringstream is(lex.getString());
                int aid;
                lyx::time_type ct;
                is >> aid >> ct;
index 6294400b42dd8e1275a8e5ced646a480729a9aa4..6e26a7cd33647060da93197efd50d8dcfd24a5f4 100644 (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>
 
        * translator.h: add #include <boost/assert.hpp>, so that the template is
@@ -5,7 +20,7 @@
 
 2003-09-11  Angus Leeming  <leeming@lyx.org>
 
-       * cow_ptr.h: 
+       * cow_ptr.h:
        * copied_ptr.h: added to the repository. Maybe temporarily.
 
 2003-09-09  Lars Gullik Bjønnes  <larsbj@lyx.org>
index 6813f2c129e67254c0d12817f9a85d76f3af0822..43e72c2f4ff2114e35af1b74a54bb3252d87c16e 100644 (file)
@@ -6,12 +6,7 @@ CLEANFILES = path_defines.C
 
 INCLUDES = -I$(srcdir)/../ $(BOOST_INCLUDES)
 
-EXTRA_DIST = path_defines.C.in lyxstring.C lyxstring.h \
-            os_unix.C os_win32.C os_os2.C
-
-if USE_LYXSTRING
-LYXSTRING = lyxstring.C lyxstring.h
-endif
+EXTRA_DIST = path_defines.C.in os_unix.C os_win32.C os_os2.C
 
 if USE_COMPRESSION
 COMPRESSION = gzstream.C gzstream.h
@@ -55,7 +50,7 @@ libsupport_la_SOURCES = \
        lyxmanip.h \
        lyxtime.C \
        lyxtime.h \
-       $(LYXSTRING) lyxsum.C \
+       lyxsum.C \
        mkdir.C \
        nt_defines.h \
        os.C \
index de34abb607b0994c45a92112868ab71a237215af..26199c185fa5b847e2490218aec42426bc259999 100644 (file)
@@ -693,7 +693,7 @@ string const NormalizePath(string const & path)
 
        // Normalise paths like /foo//bar ==> /foo/bar
        boost::RegEx regex("/{2,}");
-       RTemp = STRCONV(regex.Merge(STRCONV(RTemp), "/"));
+       RTemp = regex.Merge(RTemp, "/");
 
        while (!RTemp.empty()) {
                // Split by next /
@@ -729,7 +729,7 @@ string const GetFileContents(string const & fname)
                if (ifs && ofs) {
                        ofs << ifs.rdbuf();
                        ifs.close();
-                       return STRCONV(ofs.str());
+                       return ofs.str();
                }
        }
        lyxerr << "LyX was not able to read file '" << fname << '\'' << endl;
index f865c2cab7f0457e7d7f82d7c1f3a411bebca3a8..9a234bdc5a8cc0ee04ba77fc9f068d6e843c09d6 100644 (file)
@@ -399,8 +399,8 @@ bool regexMatch(string const & a, string const & pattern)
        string regex(pattern);
        regex = subst(regex, ".", "\\.");
        regex = subst(regex, "*", ".*");
-       boost::regex reg(STRCONV(regex));
-       return boost::regex_match(STRCONV(a), reg);
+       boost::regex reg(regex);
+       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)
 {
-       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)
 {
-       return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1)
-               % STRCONV(arg2)).str());
+       return (boost::format(fmt) % arg1 % arg2).str();
 }
 
 
 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 const & arg3)
 {
-       return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1)
-               % STRCONV(arg2) % STRCONV(arg3)).str());
+       return (boost::format(fmt) % arg1 % arg2 % arg3).str();
 }
 
 
 string bformat(string const & fmt, string const & arg1, string const & arg2,
        string const & arg3, string const & arg4)
 {
-       return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1)
-               % STRCONV(arg2) % STRCONV(arg3) % STRCONV(arg4)).str());
+       return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4).str();
 }
 
 
 string bformat(string const & fmt, string const & arg1, string const & arg2,
        string const & arg3, string const & arg4, string const & arg5)
 {
-       return STRCONV((boost::format(STRCONV(fmt)) % STRCONV(arg1)
-               % STRCONV(arg2) % STRCONV(arg3) % STRCONV(arg4)
-               % STRCONV(arg5)).str());
+       return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4 % arg5).str();
 }
 
 #else
diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C
deleted file mode 100644 (file)
index 444a813..0000000
+++ /dev/null
@@ -1,1800 +0,0 @@
-/**
- * \file lyxstring.C
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "lyxstring.h"
-
-#include "debug.h"
-
-#include <iostream>
-#include <cstdlib>
-#include <cctype>
-#include <algorithm>
-
-using std::min;
-using std::istream;
-using std::ostream;
-
-// 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.
-
-// Asserts with a STD! are required by the standard.
-// Asserts with a OURS! are added by me.
-// Some asserts could still be missing and some of the existing
-// ones might be wrong or not needed.
-
-// Reference count has been checked, empty_rep removed and
-// introduced again in a similar guise. Where is empty_rep _really_
-// needed?
-
-// We are missing a couple of imporant things from the standard:
-// reverse iterators and methods taking InputIterators as paramters.
-// Also the methods returning iterators is returning the wrong value.
-
-// All the different find functions need a good look over.
-// I have so far not tested them extensively and would be
-// happy if others took the time to have a peek.
-
-// Space allocation of string.
-// I have tried to do this very simple without using any special tricks.
-// Earlier we used a fixed value to enlarge the string with this would
-// cause a lot of reallocations with large strings (especially if
-// push_back was used) and wasting space for very small strings.
-// I have now changed the allocation to use a doubling of reserved
-// space until it is large enough. So far tests show a small speed
-// increase and a noticable memory saving.
-
-// Lgb.
-
-namespace lyx {
-
-using support::BOOST_ASSERT;
-
-///////////////////////////////////////
-// The internal string representation
-///////////////////////////////////////
-
-struct string::Srep {
-       /// size
-       size_t sz;
-       /// Reference count
-       size_t ref;
-       /// The total amount of data reserved for this representaion
-       size_t res;
-       /// Data. At least 1 char for trailing null.
-       string::value_type * s;
-
-       ///
-       Srep(string::size_type nsz, const string::value_type * p);
-       ///
-       Srep(string::size_type nsz, string::value_type ch);
-       ///
-       ~Srep() { delete[] s; }
-       ///
-       Srep * get_own_copy() {
-               if (ref == 1) return this;
-               --ref;
-               return new Srep(sz, s);
-       }
-
-       ///
-       void assign(string::size_type nsz, const string::value_type * p);
-       ///
-       void assign(string::size_type nsz, string::value_type ch);
-       ///
-       void append(string::size_type asz, const string::value_type * p);
-       ///
-       void push_back(string::value_type c);
-       ///
-       void insert(string::size_type pos,
-                   const string::value_type * p,
-                   string::size_type n);
-       ///
-       void resize(string::size_type n, string::value_type c);
-       ///
-       void reserve(string::size_type res_arg);
-       ///
-       void replace(string::size_type i, string::size_type n,
-                    string::value_type const * p, string::size_type n2);
-private:
-       Srep(const Srep &);
-       Srep & operator=(const Srep &);
-};
-
-
-string::Srep::Srep(string::size_type nsz, const value_type * p)
-{
-       // can be called with p == 0 by
-       // string::assign(const value_type *, size_type)
-
-       sz = nsz;
-       ref = 1;
-       res = sz ? sz : 1;
-       s = new value_type[res + 1]; // add space for terminator
-       if (p && sz) {
-               // if sz = 0 nothing gets copied and we have an error
-               memcpy(s, p, sz);
-       } else {
-               // possibly allows for large but empty string
-               sz = 0;  // this line should be redundant
-               s[0] = '\0';
-       }
-}
-
-
-string::Srep::Srep(string::size_type nsz, value_type ch)
-{
-       sz = nsz;
-       ref = 1;
-       res = sz ? sz : 1;
-       s = new value_type[res + 1]; // add space for terminator
-       memset(s, ch, sz);
-       if (!ch) {
-               // if ch == '\0' strlen(string.c_str()) == 0 so sz = 0
-               // allows for large but empty string
-               sz = 0;
-       }
-}
-
-
-void string::Srep::assign(string::size_type nsz, const value_type * p)
-{
-       // can be called with p == 0
-       // by string::assign(const value_type *, size_type)
-
-       if (res < nsz) {
-               delete[] s;
-               sz = nsz;
-               res = sz ? sz : 1;
-               s = new value_type[res + 1]; // add space for terminator
-       } else {
-               sz = nsz;
-       }
-       if (p && sz) {
-               // if sz = 0 nothing gets copied and we have an error
-               memcpy(s, p, sz);
-       } else {
-               // stops segfaults
-               sz = 0;  // this line should be redundant
-               s[0] = '\0';
-       }
-}
-
-
-void string::Srep::assign(string::size_type nsz, value_type ch)
-{
-       sz = nsz;
-       if (res < nsz) {
-               delete[] s;
-               res = sz ? sz : 1;
-               s = new value_type[res + 1]; // add space for terminator
-       }
-       memset(s, ch, sz);
-       if (!ch) {
-               // if ch == '\0' strlen(string.c_str()) == 0 so sz = 0
-               // allows for a large empty string
-               sz = 0;
-       }
-}
-
-
-void string::Srep::append(string::size_type asz, const value_type * p)
-{
-       register unsigned int const len = sz + asz;
-       if (res < len) {
-               do {
-                       res *= 2;
-               } while (res < len);
-               value_type * tmp = new value_type[res + 1];
-               memcpy(tmp, s, sz);
-               memcpy(tmp + sz, p, asz);
-               sz += asz;
-               delete[] s;
-               s = tmp;
-       } else {
-               memcpy(s + sz, p, asz);
-               sz += asz;
-       }
-}
-
-
-void string::Srep::push_back(value_type c)
-{
-       s[sz] = c; // it is always room to put a value_type at the end
-       ++sz;
-       if (res < sz) {
-               do {
-                       res *= 2;
-               } while (res < sz);
-               value_type * tmp = new value_type[res + 1];
-               memcpy(tmp, s, sz);
-               delete[] s;
-               s = tmp;
-       }
-}
-
-
-void string::Srep::insert(string::size_type pos, const value_type * p,
-                            string::size_type n)
-{
-       if (res < n + sz) {
-               do {
-                       res *= 2;
-               } while (res < n + sz);
-               value_type * tmp = new value_type[res + 1];
-               memcpy(tmp, s, pos);
-               memcpy(tmp + pos, p, n);
-               memcpy(tmp + pos + n, &s[pos], sz - pos);
-               sz += n;
-               delete[] s;
-               s = tmp;
-       } else {
-               memmove(s + pos + n, &s[pos], sz - pos);
-               memcpy(s + pos, p, n);
-               sz += n;
-       }
-}
-
-
-void string::Srep::resize(size_type n, value_type c)
-{
-       // This resets sz to res_arg
-       res = min(n, npos - 2); // We keep no xtra when we resize
-       value_type * tmp = new value_type[res + 1];
-       memcpy(tmp, s, min(sz, res));
-       if (res > sz)
-               memset(tmp + sz, c, res - sz);
-       delete[] s;
-       sz = res;
-       s = tmp;
-}
-
-
-void string::Srep::reserve(string::size_type res_arg)
-{
-       // This keeps the old sz, but
-       // increases res with res_arg
-       res += res_arg;
-       value_type * tmp = new value_type[res + 1];
-       memcpy(tmp, s, sz);
-       delete[] s;
-       s = tmp;
-}
-
-
-void string::Srep::replace(string::size_type i, string::size_type n,
-                             value_type const * p, size_type n2)
-{
-// can be called with p= 0 and n2= 0
-       n = min(sz - i, n);
-       sz -= n;
-       if (res >= n2 + sz) {
-               memmove(s + i + n2, &s[i + n], sz - i);
-               memcpy(s + i, p, n2);
-               sz += n2;
-       } else {
-               do {
-                       res *= 2;
-               } while (res < n2 + sz);
-               value_type * tmp = new value_type[res + 1];
-               memcpy(tmp, s, i);
-               memcpy(tmp + i, p, n2);
-               memcpy(tmp + i + n2, &s[i + n], sz - i);
-               delete[] s;
-               s = tmp;
-               sz += n2;
-       }
-}
-
-
-///////////////////////////////////////
-// The string Invariant tester
-///////////////////////////////////////
-
-// There are no know bugs in string now, and it have been
-// tested for a long time. so we disable the invariant checker. (Lgb)
-#undef ENABLE_ASSERTIONS
-#ifdef ENABLE_ASSERTIONS
-
-/** Testing of the string invariant
- * By creating an object that tests the string invariant during its
- * construction *and* its deconstruction we greatly simplify our code.
- * Calling TeststringInvariant() upon entry to an string method
- * will test the invariant upon entry to the code.  If the Asserts fail
- * then we know from the stack trace that the corruption occurred *before*
- * entry to this method.  We can also be sure it didn't happen in any of
- * the tested string methods.  It is therefore likely to be due to some
- * other external force.
- * Several string methods have multiple exit points which would otherwise
- * require us to insert a separate test before each return.  But since we
- * created an object its destructor will be called upon exit (any exit!).
- * We thus get testing at both start and end of a method with one line of
- * code at the head of a method.  More importantly,  we get good testing
- * everytime we run the code.
- * NOTE:  just because we test the invariant doesn't mean we can forget
- * about testing pre and post conditions specific to any given method.
- * This test simply proves that the string/Srep is in a valid state it
- * does *not* prove that the method did what it was supposed to.
- */
-class stringInvariant {
-public:
-       stringInvariant(string const *);
-       ~stringInvariant();
-private:
-       void helper() const;
-       string const * object;
-};
-
-
-// To test if this scheme works "as advertised" uncomment the printf's in
-// the constructor and destructor below and then uncomment the printf and the
-// call to TestlyxstringInvariant() in string::operator=(char const *).
-// The correct output when LyX has been recompiled and run is:
-//     lyxstringInvariant constructor
-//     string::operator=(char const *)
-//     lyxstringInvariant constructor
-//     lyxstringInvariant destructor completed
-//     lyxstringInvariant destructor completed
-// NOTE: The easiest way to catch this snippet of the output is to wait for
-//       the splash screen to disappear and then open and close Help->Credits
-//
-stringInvariant::stringInvariant(string const * ls) : object(ls)
-{
-       // printf("stringInvariant constructor\n");
-       helper();
-}
-
-
-stringInvariant::~stringInvariant()
-{
-       helper();
-       // printf("stringInvariant destructor completed\n");
-}
-
-
-void stringInvariant::helper() const
-{
-       // Some of these tests might look pointless but they are
-       // all part of the invariant and if we want to make sure
-       // we have a bullet proof implementation then we need to
-       // test every last little thing we *know* should be true.
-       // I may have missed a test or two, so feel free to fill
-       // in the gaps.  ARRae.
-       BOOST_ASSERT(object);
-       BOOST_ASSERT(object->rep);
-       BOOST_ASSERT(object->rep->s);    // s is never 0
-       BOOST_ASSERT(object->rep->res);  // res cannot be 0
-       BOOST_ASSERT(object->rep->sz <= object->rep->res);
-       BOOST_ASSERT(object->rep->ref >= 1);  // its in use so it must be referenced
-       BOOST_ASSERT(object->rep->ref < 1UL << (8UL * sizeof(object->rep->ref) - 1));
-       // if it does ever == then we should be generating a new copy
-       // and starting again.  (Is char always 8-bits?)
-}
-#define TeststringInvariant(s) stringInvariant string_invariant(s);
-#else
-#define TeststringInvariant(s)
-#endif /* ENABLE_ASSERTIONS */
-
-
-///////////////////////////////////////
-// Constructors and Deconstructors.
-///////////////////////////////////////
-
-string::size_type const string::npos =
-static_cast<string::size_type>(-1);
-
-
-string::string()
-{
-       static Srep empty_rep(0, "");
-       ++empty_rep.ref;
-       rep = &empty_rep;
-}
-
-
-string::string(string const & x, size_type pos, size_type n)
-{
-       BOOST_ASSERT(pos <= x.rep->sz); // STD!
-       if (pos == 0 && n >= x.length()) { // this is the default
-               x.rep->ref++;
-               rep = x.rep;
-       } else {
-               rep = new Srep(min(n, x.rep->sz - pos), &(x.rep->s[pos]));
-       }
-}
-
-
-string::string(value_type const * s, size_type n)
-{
-       BOOST_ASSERT(s && n < npos); // STD!
-       static Srep empty_rep(0, "");
-       if (n) { // n > 0
-               rep = new Srep(n, s);
-       } else {
-               ++empty_rep.ref;
-               rep = &empty_rep;
-       }
-}
-
-
-string::string(value_type const * s)
-{
-       BOOST_ASSERT(s); // STD!
-       static Srep empty_rep(0, "");
-       if (*s) { // s is not empty string
-               rep = new Srep(strlen(s), s);
-       } else {
-               ++empty_rep.ref;
-               rep = &empty_rep;
-       }
-}
-
-
-string::string(size_type n, value_type c)
-{
-       BOOST_ASSERT(n < npos); // STD!
-       rep = new Srep(n, c);
-}
-
-
-#warning string user, have a look here. (Lgb)
-#if 0
-// Commented out to avoid warnings from doxygen. (Lgb)
-string::string(const_iterator first, const_iterator last)
-{
-       rep = new Srep(last - first, first);
-}
-#endif
-
-
-string::~string()
-{
-       if (--rep->ref == 0) delete rep;
-}
-
-///////////////////////
-// Iterators
-///////////////////////
-
-string::iterator string::begin()
-{
-       rep = rep->get_own_copy();
-       return rep->s;
-}
-
-
-string::const_iterator string::begin() const
-{
-       return rep->s;
-}
-
-
-string::iterator string::end()
-{
-       rep = rep->get_own_copy();
-       return rep->s + rep->sz;
-}
-
-
-string::const_iterator string::end() const
-{
-       return rep->s + rep->sz;
-}
-
-#if 0
-reverse_iterator string::rbegin()
-{
-       return reverse_iterator( end() );
-}
-
-
-const_reverse_iterator string::rbegin() const
-{
-       return const_reverse_iterator( end() );
-}
-
-
-reverse_iterator string::rend()
-{
-       return reverse_iterator( begin() );
-}
-
-
-const_reverse_iterator string::rend() const
-{
-       return const_reverse_iterator( begin() );
-}
-#endif
-
-
-///////////////////////
-// Size and Capacity
-///////////////////////
-
-string::size_type string::size() const
-{
-       return rep->sz;
-}
-
-
-void string::resize(size_type n, value_type c)
-{
-       BOOST_ASSERT(n <= npos); // STD!
-       TeststringInvariant(this);
-
-       // This resets sz to res_arg
-       rep = rep->get_own_copy();
-       rep->resize(n, c);
-}
-
-
-string::size_type string::capacity() const
-{
-       return rep->res;
-}
-
-
-void string::reserve(size_type res_arg)
-{
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->reserve(res_arg);
-}
-
-
-////////////////
-// Assignment
-////////////////
-
-string & string::operator=(string const & x)
-{
-       TeststringInvariant(this);
-
-       return assign(x);
-}
-
-
-string & string::operator=(value_type const * s)
-{
-       BOOST_ASSERT(s); // OURS!
-       TeststringInvariant(this);
-//     printf("string::operator= (value_type const *)\n");
-
-       return assign(s);
-}
-
-
-string & string::operator=(value_type c)
-{
-       TeststringInvariant(this);
-
-       value_type s[1];
-       s[0] = c;
-       if (rep->ref == 1) // recycle rep
-               rep->assign(1, s);
-       else {
-               rep->ref--;
-               rep = new Srep(1, s);
-       }
-       return *this;
-}
-
-
-string & string::assign(string const & x)
-{
-       TeststringInvariant(this);
-
-       x.rep->ref++; // protect against ``st = st''
-       if (--rep->ref == 0) delete rep;
-       rep = x.rep; // share representation
-       return *this;
-}
-
-
-string & string::assign(string const & x, size_type pos, size_type n)
-{
-       BOOST_ASSERT(pos <= x.rep->sz); // STD!
-       TeststringInvariant(this);
-
-       return assign(x.substr(pos, n));
-}
-
-
-string & string::assign(value_type const * s, size_type n)
-{
-       BOOST_ASSERT(s && n < npos); // STD!
-       TeststringInvariant(this);
-
-       if (rep->ref == 1) // recycle rep
-               rep->assign(n, s);
-       else {
-               --rep->ref;
-               rep = new Srep(n, s);
-       }
-       return *this;
-}
-
-
-string & string::assign(value_type const * s)
-{
-       BOOST_ASSERT(s); // OURS!
-       TeststringInvariant(this);
-
-       return assign(s, strlen(s));
-}
-
-
-string & string::assign(size_type n, value_type ch)
-{
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->assign(n, ch);
-       return *this;
-}
-
-
-string & string::assign(const_iterator first, const_iterator last)
-{
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->assign(last - first, first);
-       return *this;
-}
-
-
-////////////////////
-// Element Access
-////////////////////
-
-string::const_reference string::operator[](size_type pos) const
-{
-#if 0
-       // This is actually what the standard requires,
-       BOOST_ASSERT(pos <= rep->sz); // OURS!
-       static char const helper = '\0';
-       return pos == rep->sz ? helper : rep->s[pos];
-#else
-       // but we use this one since it is stricter
-       // and more according to the real intent of std::string.
-       BOOST_ASSERT(pos < rep->sz); // OURS!
-       return rep->s[pos];
-#endif
-}
-
-
-string::reference string::operator[](size_type pos)
-{
-       BOOST_ASSERT(pos < rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       return rep->s[pos];
-}
-
-
-string::const_reference string::at(size_type n) const
-{
-       BOOST_ASSERT(n < rep->sz); // STD!
-       return rep->s[n];
-}
-
-
-string::reference string::at(size_type n)
-{
-       BOOST_ASSERT(n < rep->sz); // STD!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       return rep->s[n];
-}
-
-
-/////////////
-// Insert
-/////////////
-
-string & string::operator+=(string const & x)
-{
-       TeststringInvariant(this);
-
-       return append(x);
-}
-
-
-string & string::operator+=(value_type const * x)
-{
-       BOOST_ASSERT(x); // OURS!
-       TeststringInvariant(this);
-
-       return append(x);
-}
-
-
-string & string::operator+=(value_type c)
-{
-       TeststringInvariant(this);
-
-       push_back(c);
-       return *this;
-}
-
-
-void string::push_back(value_type c)
-{
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->push_back(c);
-}
-
-
-string & string::append(string const & x)
-{
-       TeststringInvariant(this);
-
-       if (x.empty()) return *this;
-       rep = rep->get_own_copy();
-       rep->append(x.length(), x.rep->s);
-       return *this;
-}
-
-
-string & string::append(string const & x, size_type pos, size_type n)
-{
-       BOOST_ASSERT(pos <= x.rep->sz); // STD!
-       TeststringInvariant(this);
-
-       return append(x.substr(pos, n));
-}
-
-
-string & string::append(value_type const * p, size_type n)
-{
-       BOOST_ASSERT(p); // OURS!
-       TeststringInvariant(this);
-
-       if (!*p || !n) return *this;
-       rep = rep->get_own_copy();
-       rep->append(n, p);
-       return *this;
-}
-
-
-string & string::append(value_type const * p)
-{
-       BOOST_ASSERT(p); // OURS!
-       return append(p, strlen(p));
-}
-
-
-string & string::append(size_type n, value_type c)
-{
-       TeststringInvariant(this);
-
-       value_type * tmp = new value_type[n];
-       memset(tmp, c, n);
-       rep = rep->get_own_copy();
-       rep->append(n, tmp);
-       delete[] tmp;
-       return *this;
-}
-
-
-string & string::append(iterator first, iterator last)
-{
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->append(last - first, first);
-       return *this;
-}
-
-// insert characters before (*this)[pos]
-
-string & string::insert(size_type pos, string const & x)
-{
-       TeststringInvariant(this);
-
-       return insert(pos, x, 0, x.rep->sz);
-}
-
-
-string & string::insert(size_type pos, string const & x,
-                             size_type pos2, size_type n)
-{
-       BOOST_ASSERT(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->insert(pos, &(x.rep->s[pos2]), min(n, x.rep->sz));
-       return *this;
-}
-
-
-string & string::insert(size_type pos, value_type const * p, size_type n)
-{
-       BOOST_ASSERT(p); // OURS!
-       TeststringInvariant(this);
-
-       if (*p && n) {
-               // insert nothing and you change nothing
-               rep = rep->get_own_copy();
-               rep->insert(pos, p, n);
-       }
-       return *this;
-}
-
-
-string & string::insert(size_type pos, value_type const * p)
-{
-       BOOST_ASSERT(p); // OURS!
-       return insert(pos, p, strlen(p));
-}
-
-
-string & string::insert(size_type pos, size_type n, value_type c)
-{
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       value_type * tmp = new value_type[n];
-       memset(tmp, c, n);
-       rep->insert(pos, tmp, n);
-       delete[] tmp;
-       return *this;
-}
-
-
-string::iterator string::insert(iterator p, value_type c)
-{
-       TeststringInvariant(this);
-
-       // what iterator is this supposed to return??
-       size_type tmp = p - begin();
-       insert(p - begin(), 1, c);
-       return begin() + tmp + 1; // ??
-}
-
-
-void string::insert(iterator p, size_type n , value_type c)
-{
-       TeststringInvariant(this);
-
-       insert(p - begin(), n , c);
-}
-
-
-void string::insert(iterator p, iterator first, iterator last)
-{
-       TeststringInvariant(this);
-
-       insert(p - begin(), first, last - first);
-}
-
-
-////////////////
-// Find
-////////////////
-
-        // All the below find functions should be verified,
-        // it is very likely that I have mixed up or interpreted
-        // some of the parameters wrong, also some of the funcs can surely
-        // be written more effectively.
-
-string::size_type string::find(string const & a, size_type i) const
-{
-       if (!rep->sz || i >= rep->sz) return npos;
-
-       TeststringInvariant(this);
-
-       size_type n = a.length();
-       if (!n) return npos;
-       for (size_type t = i; rep->sz - t >= n; ++t) {
-               // search until (*this)[i] == a[0]
-               if (rep->s[t] == a[0]) {
-                       // check if the rest of the value_types match
-                       bool equal = true;
-                       for (size_type j = 1; j < n; ++j) {
-                               if (rep->s[t + j] != a[j]) {
-                                       equal = false;
-                                       break;
-                               }
-                       }
-                       if (equal) return t;
-               }
-       }
-       return npos;
-}
-
-
-string::size_type string::find(value_type const * ptr, size_type i,
-                                    size_type n) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-       if (!rep->sz || !*ptr || i >= rep->sz) return npos;
-
-       TeststringInvariant(this);
-
-       // What is "n" here? is it the number of value_types to use in ptr
-       // or does "i" and "n" togeter form a substring to search
-       // for ptr in? For now I will assume that "n" tells the length
-       // of ptr. (Lgb)
-       n = min(n, strlen(ptr));
-       if (!n) return npos;
-       for (size_type t = i; rep->sz - t >= n; ++t) {
-               // search until (*this)[i] == a[0]
-               if (rep->s[t] == ptr[0]) {
-                       // check if the rest of the value_types match
-                       bool equal = true;
-                       for (size_type j = 1; j < n; ++j) {
-                               if (rep->s[t + j] != ptr[j]) {
-                                       equal = false;
-                                       break;
-                               }
-                       }
-                       if (equal) return t;
-               }
-       }
-       return npos;
-}
-
-
-string::size_type string::find(value_type const * s, size_type i) const
-{
-       BOOST_ASSERT(s); // OURS!
-       if (!rep->sz || i >= rep->sz) return npos;
-
-       TeststringInvariant(this);
-
-       if (!s || !*s) return npos;
-       return find(s, i, strlen(s));
-}
-
-
-string::size_type string::find(value_type c, size_type i) const
-{
-       if (!rep->sz || i >= rep->sz) return npos;
-
-       TeststringInvariant(this);
-
-       for (size_type t = 0; t + i < rep->sz; ++t) {
-               if (rep->s[t + i] == c) return t + i;
-       }
-       return npos;
-}
-
-
-string::size_type string::rfind(string const & a, size_type i) const
-{
-       TeststringInvariant(this);
-
-       size_type n = a.length();
-       if (!n || rep->sz < n)
-               return npos;
-
-       size_type t = min(rep->sz - n, i);
-       do {
-               if (rep->s[t] == a[0]) {
-                       // check if the rest of the value_types match
-                       bool equal = true;
-                       for (size_type j = 1; j < n; ++j) {
-                               if (rep->s[t + j] != a[j]) {
-                                       equal = false;
-                                       break;
-                               }
-                       }
-                       if (equal) return t;
-               }
-       } while (t-- > 0);
-       return npos;
-}
-
-
-string::size_type string::rfind(value_type const * ptr, size_type i,
-                                     size_type n) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-       TeststringInvariant(this);
-
-       n = min(n, strlen(ptr));
-       if (!n || rep->sz < n)
-               return npos;
-
-       size_type t = min(rep->sz - n, i);
-       do {
-               if (rep->s[t] == ptr[0]) {
-                       // check if the rest of the value_types match
-                       bool equal = true;
-                       for (size_type j = 1; j < n; ++j) {
-                               if (rep->s[t + j] != ptr[j]) {
-                                       equal = false;
-                                       break;
-                               }
-                       }
-                       if (equal) return t;
-               }
-       } while (t-- > 0);
-       return npos;
-}
-
-
-string::size_type string::rfind(value_type const * ptr,
-                                     size_type i) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-
-       if (!ptr || !*ptr) return npos;
-       return rfind(ptr, i, strlen(ptr));
-}
-
-
-string::size_type string::rfind(value_type c, size_type i) const
-{
-       TeststringInvariant(this);
-
-       size_type const sz = rep->sz;
-       if (sz < 1) return npos;
-       size_type ii = min(sz - 1, i);
-       do {
-               if (rep->s[ii] == c) return ii;
-       } while (ii-- > 0);
-       return npos;
-}
-
-
-string::size_type string::find_first_of(string const & a,
-                                             size_type i) const
-{
-       BOOST_ASSERT(i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (a.find(rep->s[t]) != npos) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_of(value_type const * ptr,
-                                             size_type i,
-                                             size_type n) const
-{
-       BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-       if (!n) return npos;
-
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (memchr(ptr, rep->s[t], n) != 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_of(value_type const * ptr,
-                                             size_type i) const
-{
-       BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (strchr(ptr, rep->s[t]) != 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_of(value_type c, size_type i) const
-{
-       BOOST_ASSERT(i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (rep->s[t] == c) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_of(string const & a,
-                                            size_type i) const
-{
-       TeststringInvariant(this);
-
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (a.find(rep->s[t]) != npos) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_of(value_type const * ptr,
-                                            size_type i,
-                                            size_type n) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-       TeststringInvariant(this);
-       if (!n) return npos;
-
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (memchr(ptr, rep->s[t], n) != 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_of(value_type const * ptr,
-                                            size_type i) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-       TeststringInvariant(this);
-
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (strchr(ptr, rep->s[t]) != 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_of(value_type c, size_type i) const
-{
-       TeststringInvariant(this);
-
-       if (!rep->sz) return npos;
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (rep->s[t] == c) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_not_of(string const & a,
-                                                 size_type i) const
-{
-       TeststringInvariant(this);
-
-       if (!rep->sz) return npos;
-       BOOST_ASSERT(i <= rep->sz);
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (a.find(rep->s[t]) == npos) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_not_of(value_type const * ptr,
-                                                 size_type i,
-                                                 size_type n) const
-{
-       BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       if (!n) return (i < rep->sz) ? i : npos;
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (memchr(ptr, rep->s[t], n) == 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_not_of(value_type const * ptr,
-                                                 size_type i) const
-{
-       BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (strchr(ptr, rep->s[t]) == 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_first_not_of(value_type c,
-                                                 size_type i) const
-{
-       if (!rep->sz) return npos;
-       BOOST_ASSERT(i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       for (size_type t = i; t < rep->sz; ++t) {
-               if (rep->s[t] != c) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_not_of(string const & a,
-                                                size_type i) const
-{
-       TeststringInvariant(this);
-
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (a.find(rep->s[t]) == npos) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_not_of(value_type const * ptr,
-                                                size_type i,
-                                                size_type n) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-       TeststringInvariant(this);
-
-       if (!n) return npos;
-       size_type ii = min(rep->sz - 1, i);
-
-       for (int t = ii; t >= 0; --t) {
-               if (memchr(ptr, rep->s[t], n) == 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_not_of(value_type const * ptr,
-                                                size_type i) const
-{
-       BOOST_ASSERT(ptr); // OURS!
-       TeststringInvariant(this);
-
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (strchr(ptr, rep->s[t]) == 0) return t;
-       }
-       return npos;
-}
-
-
-string::size_type string::find_last_not_of(value_type c,
-                                                size_type i) const
-{
-       TeststringInvariant(this);
-
-       size_type ii = min(rep->sz - 1, i);
-       for (int t = ii; t >= 0; --t) {
-               if (rep->s[t] != c) return t;
-       }
-       return npos;
-}
-
-
-/////////////////
-// Replace
-/////////////////
-
-string & string::replace(size_type i, size_type n, string const & x)
-{
-       BOOST_ASSERT(i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       return replace(i, n, x, 0, x.rep->sz);
-}
-
-
-string & string::replace(size_type i, size_type n, string const & x,
-                              size_type i2, size_type n2)
-{
-       BOOST_ASSERT(i <= rep->sz && i2 <= x.rep->sz); // STD!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->replace(i, min(n, rep->sz), &(x.rep->s[i2]), min(n2, x.rep->sz));
-       return *this;
-}
-
-
-string & string::replace(size_type i, size_type n,
-                              value_type const * p, size_type n2)
-{
-       BOOST_ASSERT(p && i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       rep->replace(i, min(n, rep->sz), p, min(n2, strlen(p)));
-       return *this;
-}
-
-
-string & string::replace(size_type i, size_type n, value_type const * p)
-{
-       BOOST_ASSERT(p && i <= rep->sz); // OURS!
-       TeststringInvariant(this);
-
-       return replace(i, min(n, rep->sz), p, (!p) ? 0 : strlen(p));
-}
-
-
-string & string::replace(size_type i, size_type n,
-                              size_type n2, value_type c)
-{
-       BOOST_ASSERT(i <= rep->sz);  // OURS!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       value_type * tmp = new value_type[n2];
-       memset(tmp, c, n2);
-       rep->replace(i, min(n, rep->sz), tmp, n2);
-       delete[] tmp;
-       return *this;
-}
-
-
-/// FY! FY! FY! go away !
-string & string::replace(size_type i, size_type n, value_type c)
-{
-       return replace(i, n, 1, c);
-}
-
-
-string & string::replace(iterator i, iterator i2, const string & str)
-{
-       TeststringInvariant(this);
-
-       return replace(i - begin(), i2 - i, str);
-}
-
-
-string & string::replace(iterator i, iterator i2,
-                              value_type const * p, size_type n)
-{
-       BOOST_ASSERT(p); // OURS!
-       TeststringInvariant(this);
-
-       return replace(i - begin(), i2 - i, p, n);
-}
-
-
-string & string::replace(iterator i, iterator i2, value_type const * p)
-{
-       BOOST_ASSERT(p); // OURS!
-       TeststringInvariant(this);
-
-       return replace(i - begin(), i2 - i, p);
-}
-
-
-string & string::replace(iterator i, iterator i2,
-                              size_type n , value_type c)
-{
-       TeststringInvariant(this);
-
-       return replace(i - begin(), i2 - i, n, c);
-}
-
-
-string & string::replace(iterator i, iterator i2,
-                              iterator j, iterator j2)
-{
-       TeststringInvariant(this);
-
-       return replace(i - begin(), i2 - i, j, j2 - j);
-}
-
-
-void string::swap(string & str)
-{
-       if (rep == str.rep) return;
-       Srep * tmp = str.rep;
-       str.rep = rep;
-       rep = tmp;
-}
-
-
-string & string::erase(size_type i, size_type n)
-{
-       BOOST_ASSERT(i <= rep->sz); // STD!
-       TeststringInvariant(this);
-
-       rep = rep->get_own_copy();
-       if (i == 0 && n >= rep->sz) {
-               rep->sz = 0;
-       } else {
-               n = min(n, rep->sz - i);
-               memmove(&(rep->s[i]), &(rep->s[i + n]), rep->sz - i - n);
-               rep->sz -= n;
-       }
-       return *this;
-}
-
-
-string::iterator string::erase(iterator i)
-{
-       TeststringInvariant(this);
-
-       // what iterator is this supposed to return?
-       // the iterator after the one erased
-       erase(i - begin(), 1);
-       return begin(); // BUG
-}
-
-
-string::iterator string::erase(iterator first, iterator last)
-{
-       TeststringInvariant(this);
-
-       erase(first - begin(), last - first);
-       return begin(); // BUG
-}
-
-
-/////////////////////////////////////
-// Conversion to C-style Strings
-/////////////////////////////////////
-
-string::value_type const * string::c_str() const
-{
-       rep->s[length()] = '\0';
-       return rep->s;
-}
-
-
-string::value_type const * string::data() const
-{
-       return rep->s;
-}
-
-
-string::size_type string::copy(value_type * buf, size_type len,
-                                    size_type pos) const
-{
-       BOOST_ASSERT(buf); // OURS!
-       BOOST_ASSERT(pos <= rep->sz); // STD!
-       TeststringInvariant(this);
-
-       register int nn = min(len, length() - pos);
-       memcpy(buf, &(rep->s[pos]), nn);
-       return nn;
-}
-
-
-////////////////////
-// Comparisons
-////////////////////
-
-// Compare funcs should be verified.
-
-int string::internal_compare(size_type pos, size_type n,
-                               value_type const * s,
-                               size_type slen, size_type n2) const
-{
-       if ((rep->sz == 0 || n == 0) && (!*s || n2 == 0)) return 0;
-       if (!*s) return 1;
-       // since n > n2, min(n, n2) == 0, c == 0 (stops segfault also)
-
-       // remember that n can very well be a lot larger than rep->sz
-       // so we have to ensure that n is no larger than rep->sz
-       n = min(n, rep->sz);
-       n2 = min(n2, slen);
-       if (n == n2)
-               return memcmp(&(rep->s[pos]), s, n);
-       int c = memcmp(&(rep->s[pos]), s, min(n, n2));
-       if (c)
-               return c;
-       if (n < n2)
-               return -1;
-       return 1;
-}
-
-
-int string::compare(string const & str) const
-{
-       TeststringInvariant(this);
-       return internal_compare(0, rep->sz, str.rep->s,
-                               str.rep->sz, str.rep->sz);
-}
-
-
-int string::compare(value_type const * s) const
-{
-       BOOST_ASSERT(s); //OURS!
-       TeststringInvariant(this);
-       int n = (!s) ? 0 : strlen(s);
-       return internal_compare(0, rep->sz, s, n, n);
-}
-
-
-int string::compare(size_type pos, size_type n,
-                      string const & str) const
-{
-       BOOST_ASSERT(pos <= rep->sz); // OURS!
-       TeststringInvariant(this);
-       return internal_compare(pos, n, str.rep->s, str.rep->sz, str.rep->sz);
-}
-
-
-int string::compare(size_type pos, size_type n, string const & str,
-                      size_type pos2, size_type n2) const
-{
-       BOOST_ASSERT(pos <= rep->sz); // OURS!
-       BOOST_ASSERT(pos2 <= str.rep->sz); // OURS!
-       TeststringInvariant(this);
-       return internal_compare(pos, n,
-                               str.rep->s + pos2,
-                               str.rep->sz - pos2, n2);
-}
-
-
-int string::compare(size_type pos, size_type n, value_type const * s,
-                      size_type n2) const
-{
-       BOOST_ASSERT(s && pos <= rep->sz); // OURS!
-       TeststringInvariant(this);
-       return internal_compare(pos, n, s, (!s) ? 0 : strlen(s), n2);
-}
-
-
-/////////////////
-// Substrings
-/////////////////
-
-// i = index, n = length
-string string::substr(size_type i, size_type n) const
-{
-       BOOST_ASSERT(i <= rep->sz); // STD!
-       TeststringInvariant(this);
-
-       return string(*this, i, n);
-}
-
-
-/////////////////////////////////////////////
-// String operators, non member functions
-/////////////////////////////////////////////
-
-bool operator==(string const & a, string const & b)
-{
-       return a.compare(b) == 0;
-}
-
-
-bool operator==(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       return b.compare(a) == 0;
-}
-
-
-bool operator==(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       return a.compare(b) == 0;
-}
-
-
-bool operator!=(string const & a, string const & b)
-{
-       return a.compare(b) != 0;
-}
-
-
-bool operator!=(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       return b.compare(a) != 0;
-}
-
-
-bool operator!=(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       return a.compare(b) != 0;
-}
-
-
-bool operator>(string const & a, string const & b)
-{
-       return a.compare(b) > 0;
-}
-
-
-bool operator>(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       return b.compare(a) < 0; // since we reverse the parameters
-}
-
-
-bool operator>(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       return a.compare(b) > 0;
-}
-
-
-bool operator<(string const & a, string const & b)
-{
-       return a.compare(b) < 0;
-}
-
-
-bool operator<(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       return b.compare(a) > 0; // since we reverse the parameters
-}
-
-
-bool operator<(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       return a.compare(b) < 0;
-}
-
-
-bool operator>=(string const & a, string const & b)
-{
-       return a.compare(b) >= 0;
-}
-
-
-bool operator>=(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       return b.compare(a) <= 0; // since we reverse the parameters
-}
-
-
-bool operator>=(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       return a.compare(b) >= 0;
-}
-
-
-bool operator<=(string const & a, string const & b)
-{
-       return a.compare(b) <= 0;
-}
-
-
-bool operator<=(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       return b.compare(a) >= 0; // since we reverse the parameters
-}
-
-
-bool operator<=(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       return a.compare(b) <= 0;
-}
-
-
-string operator+(string const & a, string const & b)
-{
-       string tmp(a);
-       tmp += b;
-       return tmp;
-}
-
-
-string operator+(string::value_type const * a, string const & b)
-{
-       BOOST_ASSERT(a); // OURS!
-       string tmp(a);
-       tmp += b;
-       return tmp;
-}
-
-
-string operator+(string::value_type a, string const & b)
-{
-       string tmp;
-       tmp += a;
-       tmp += b;
-       return tmp;
-}
-
-
-string operator+(string const & a, string::value_type const * b)
-{
-       BOOST_ASSERT(b); // OURS!
-       string tmp(a);
-       tmp += b;
-       return tmp;
-}
-
-
-string operator+(string const & a, string::value_type b)
-{
-       string tmp(a);
-       tmp += b;
-       return tmp;
-}
-
-
-void swap(string & str1, string & str2)
-{
-       str1.swap(str2);
-}
-
-
-istream & operator>>(istream & is, string & s)
-{
-#if 0
-       // very bad solution
-       char * nome = new char[1024];
-       is >> nome;
-       string tmp(nome);
-       delete [] nome;
-       if (!tmp.empty()) s = tmp;
-#else
-       // better solution
-       int w = is.width(0);
-       s.clear();
-       char c = 0;
-       bool skipspace = true;
-       while (is.get(c)) {
-               if (isspace(c)) {
-                       if (!skipspace) {
-                               is.putback(c);
-                               break;
-                       }
-               } else {
-                       s += c;
-                       skipspace = false;
-               }
-               if (--w == 1) break;
-       }
-       if (s.empty()) is.setstate(std::ios::failbit);
-#endif
-       return is;
-}
-
-
-ostream & operator<<(ostream & o, string const & s)
-{
-       return o.write(s.data(), s.length());
-}
-
-
-istream & getline(istream & is, string & s,
-                 string::value_type delim)
-{
-       // very bad solution
-       char tmp = 0;
-       s.erase();
-       while (is) {
-               is.get(tmp);
-               if (tmp != delim) {
-                       s += tmp;
-               } else {
-                       break;
-               }
-       }
-       return is;
-}
-
-} // namespace lyx
-
-#ifdef TEST_MAIN
-int main() {
-       lyx::string a = "abcac";
-       cout << a.rfind("ab") << endl;
-       cout << a.rfind("c") << endl;
-       cout << a.rfind("d") << endl;
-}
-#endif
diff --git a/src/support/lyxstring.h b/src/support/lyxstring.h
deleted file mode 100644 (file)
index f9f8fd5..0000000
+++ /dev/null
@@ -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
index 84ccebad3d17bd39486fc41e0f6de17244aeb0f9..1f1b7e30594a954701d1a24348fbc1cabf31db10 100644 (file)
 #ifndef 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>
+
+#ifdef USE_INCLUDED_STRING
+
 using std::string;
-#define STRCONV(STR) STR
-#else
 
-#ifdef __STRING__
-#error The <string> header has been included before std_string.h
 #else
-#define __STRING__
-#endif
-#include "support/lyxstring.h"
+
+namespace lyx {
+
+using std::string;
+
+}
+
 using lyx::string;
-#define STRCONV(STR) STR.c_str()
+
 #endif
 
 #endif // NOT STD_STRING_H
index 5eda714f90659bf41b73ad0b723bdad729b94561..765ff434c1fed2e33ba67f201630f34fc76e6a9a 100644 (file)
@@ -26,7 +26,7 @@ string const tostr(unsigned int i)
 {
        ostringstream os;
        os << i;
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
@@ -34,7 +34,7 @@ string const tostr(long int i)
 {
        ostringstream os;
        os << i;
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
@@ -42,7 +42,7 @@ string const tostr(double d)
 {
        ostringstream os;
        os << d;
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
@@ -50,7 +50,7 @@ string const tostr(int i)
 {
        ostringstream os;
        os << i;
-       return STRCONV(os.str());
+       return os.str();
 }
 
 
@@ -58,4 +58,3 @@ string const tostr(string const & s)
 {
        return s;
 }
-
index b826227bdcf8aeea97a458deaf36bc9dca7a1328..a19a5e17d9cc6bb234ed09abae93d1deddb74b9a 100644 (file)
@@ -846,7 +846,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                if (cur_spacing == Spacing::Other)
                        cur_value = pit->params().spacing().getValue();
 
-               istringstream is(STRCONV(cmd.argument));
+               istringstream is(cmd.argument);
                string tmp;
                is >> tmp;
                Spacing::Space new_spacing = cur_spacing;
@@ -1018,7 +1018,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_SETXY: {
                int x = 0;
                int y = 0;
-               istringstream is(STRCONV(cmd.argument));
+               istringstream is(cmd.argument);
                is >> x >> y;
                if (!is)
                        lyxerr << "SETXY: Could not parse coordinates in '"
index 786826d22c1511b7c6898bedb06cfb1384879d1f..46b8b6d55764461cce54c02d31e7c70948e1408e 100644 (file)
@@ -35,6 +35,10 @@ using lyx::support::rtrim;
 using lyx::support::split;
 using lyx::support::Systemcall;
 
+using boost::regex;
+using boost::regex_match;
+using boost::smatch;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::asctime;
 using std::gmtime;
@@ -45,15 +49,6 @@ using std::getline;
 
 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)
 {
@@ -274,17 +269,14 @@ void CVS::scanMaster()
                lyxerr[Debug::LYXVC] << "\t  line: " << line << endl;
                if (contains(line, tmpf)) {
                        // Ok extract the fields.
-#ifndef USE_INCLUDED_STRING
                        smatch sm;
-#else
-                       cmatch sm;
-#endif
-                       regex_match(STRCONV(line), sm, reg);
+
+                       regex_match(line, sm, reg);
 
                        //sm[0]; // whole matched string
                        //sm[1]; // filename
-                       version_ = STRCONV(sm.str(2));
-                       string const file_date = STRCONV(sm.str(3));
+                       version_ = sm.str(2);
+                       string const file_date = sm.str(3);
 
                        //sm[4]; // options
                        //sm[5]; // tag or tagdate