]> git.lyx.org Git - lyx.git/commitdiff
Rename strip to rtrim
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 28 Jul 2002 22:50:13 +0000 (22:50 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 28 Jul 2002 22:50:13 +0000 (22:50 +0000)
Rename frontStrip to ltrim
Add new trim function.

modify source for this change.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4801 a592a061-630c-0410-9148-cb99ea01b6c8

57 files changed:
src/ChangeLog
src/LaTeX.C
src/LyXAction.C
src/buffer.C
src/bufferparams.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlSendto.C
src/frontends/controllers/biblio.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QBibtex.C
src/frontends/qt2/QCitation.C
src/frontends/qt2/QParagraph.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormSendto.C
src/frontends/xforms/FormThesaurus.C
src/frontends/xforms/Tooltips.C
src/frontends/xforms/XWorkArea.C
src/frontends/xforms/input_validators.C
src/frontends/xforms/xformsImage.C
src/frontends/xforms/xforms_helpers.C
src/graphics/ChangeLog
src/graphics/PreviewLoader.C
src/insets/ChangeLog
src/insets/insetbib.C
src/insets/insetcite.C
src/insets/insetgraphics.C
src/insets/insetlabel.C
src/insets/insetlatexaccent.C
src/insets/insetnote.C
src/insets/insettabular.C
src/lyx_cb.C
src/lyx_main.C
src/lyx_main.h
src/lyxfont.C
src/lyxfunc.C
src/lyxlex.C
src/lyxserver.C
src/lyxtextclass.C
src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/formulabase.C
src/mathed/math_cursor.C
src/support/ChangeLog
src/support/filetools.C
src/support/forkedcall.C
src/support/lstrings.C
src/support/lstrings.h
src/tabular.C
src/toc.C
src/vc-backend.C
src/vspace.C

index 4c27a3ef7afcfca3e5c7065844eff42d08e15ef9..ddb2f7c16d95619d2ae00d85503316a5e54cafd9 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * many files: strip,frontStrip -> trim,ltrim,rtrim
+
 2002-07-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * PrinterParams.h: remove extern containsOnly, and include
index cf2f884fe9d2d0190dc2986f0a626853a2bc033c..0fb01690f471cac41943c1ce446181e741a72755 100644 (file)
@@ -430,7 +430,7 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
        regex reg4("\\\\@input\\{([^}]+)\\}");
 
        while (getline(ifs, token)) {
-               token = strip(token, "\r");
+               token = rtrim(token, "\r");
                smatch sub;
                if (regex_match(token, sub, reg1)) {
                        string data = sub[1];
@@ -679,7 +679,7 @@ void LaTeX::deplog(DepTable & head)
                string foundfile;
                string token;
                getline(ifs, token);
-               token = strip(token, "\r");
+               token = rtrim(token, "\r");
                if (token.empty()) continue;
 
                smatch sub;
index d4b3381a3bab4719b28a476c0eb2347d907901c9..9c1ac787915b5f4a15db82099573099c803f7dc4 100644 (file)
@@ -534,7 +534,7 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
 // Returns an action tag from a string.
 int LyXAction::LookupFunc(string const & func) const
 {
-       string const func2 = frontStrip(strip(func));
+       string const func2 = trim(func);
        if (func2.empty()) return LFUN_NOACTION;
 
        // split action and arg
index 2810843d66585bf49ecdcf39c01f66e0d95f0dbf..fce9ca959e58aeae4fd76181b42afa5924e3b818 100644 (file)
@@ -1060,7 +1060,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                params.footskip = lex.getString();
        } else if (token == "\\paperfontsize") {
                lex.nextToken();
-               params.fontsize = strip(lex.getString());
+               params.fontsize = rtrim(lex.getString());
        } else if (token == "\\papercolumns") {
                lex.nextToken();
                params.columns = lex.getInteger();
@@ -1073,7 +1073,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                }
        } else if (token == "\\paperpagestyle") {
                lex.nextToken();
-               params.pagestyle = strip(lex.getString());
+               params.pagestyle = rtrim(lex.getString());
        } else if (token == "\\bullet") {
                lex.nextToken();
                int const index = lex.getInteger();
@@ -1128,7 +1128,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                params.tocdepth = lex.getInteger();
        } else if (token == "\\spacing") {
                lex.next();
-               string const tmp = strip(lex.getString());
+               string const tmp = rtrim(lex.getString());
                Spacing::Space tmp_space = Spacing::Default;
                float tmp_val = 0.0;
                if (tmp == "single") {
@@ -1153,7 +1153,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                }
        } else if (token == "\\paragraph_spacing") {
                lex.next();
-               string const tmp = strip(lex.getString());
+               string const tmp = rtrim(lex.getString());
                if (tmp == "single") {
                        par->params().spacing(Spacing(Spacing::Single));
                } else if (tmp == "onehalf") {
@@ -2338,7 +2338,7 @@ void Buffer::makeLaTeXFile(ostream & os,
 
                string strOptions(options.str().c_str());
                if (!strOptions.empty()) {
-                       strOptions = strip(strOptions, ",");
+                       strOptions = rtrim(strOptions, ",");
                        os << '[' << strOptions << ']';
                }
 
@@ -3853,8 +3853,8 @@ bool Buffer::dispatch(string const & command, bool * result)
 {
        // Split command string into command and argument
        string cmd;
-       string line = frontStrip(command);
-       string const arg = strip(frontStrip(split(line, cmd, ' ')));
+       string line = ltrim(command);
+       string const arg = trim(split(line, cmd, ' '));
 
        return dispatch(lyxaction.LookupFunc(cmd), arg, result);
 }
index 504e9c9eed88a85ab3481737a061272a12eaf48c..3ccf77567bc15e051102550e737986894c662732 100644 (file)
@@ -81,7 +81,7 @@ void BufferParams::writeFile(ostream & os) const
        // then the the preamble
        if (!preamble.empty()) {
                // remove '\n' from the end of preamble
-               string const tmppreamble = strip(preamble, "\n");
+               string const tmppreamble = rtrim(preamble, "\n");
                os << "\\begin_preamble\n"
                   << tmppreamble
                   << "\n\\end_preamble\n";
index c5529e938a1baee8553e430265a9c1a1591e5e47..d2b310704dd9d7b6ad60bab835fc4308b845a174 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * several files: strip,frontStrip -> trim,ltrim,rtrim
+
 2002-07-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * biblio.C (parseBibTeX): modify because of strip changes
index 7eb8376e22b202b0089806bf6ddc7b33df5535da..8b36d6f66464debb1e44a4d5544ef85914bb0dd9 100644 (file)
@@ -98,7 +98,7 @@ void ControlSendto::setFormat(Format const * fmt)
 
 void ControlSendto::setCommand(string const & cmd)
 {
-       command_ = strip(frontStrip(cmd));
+       command_ = trim(cmd);
 }
 
 
index 629e495c480d639fc14476c40863b19b62a36c34..62d3a48d0fd5b24da2ba06508db64c88084849f6 100644 (file)
@@ -159,10 +159,10 @@ string const familyName(string const & name)
        // "F. Surname"
        string::size_type idx = fname.find(",");
        if (idx != string::npos)
-               return frontStrip(fname.substr(0,idx));
+               return ltrim(fname.substr(0, idx));
        idx = fname.rfind(".");
        if (idx != string::npos)
-               fname = frontStrip(fname.substr(idx+1));
+               fname = ltrim(fname.substr(idx + 1));
        // test if we have a LaTeX Space in front
        if (fname[0] == '\\')
                return fname.substr(2);
@@ -185,8 +185,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
                        return string();
                }
 
-               string const opt =
-                       strip(frontStrip(it->second.substr(0, pos-1)));
+               string const opt = trim(it->second.substr(0, pos - 1));
                if (opt.empty())
                        return string();
 
@@ -213,7 +212,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
 
                for (vector<string>::iterator it = authors.begin();
                     it != authors.end(); ++it) {
-                       *it = familyName(strip(*it));
+                       *it = familyName(rtrim(*it));
                }
 
                author = authors[0];
@@ -242,7 +241,7 @@ string const getYear(InfoMap const & map, string const & key)
                }
 
                string const opt =
-                       strip(frontStrip(it->second.substr(0, pos-1)));
+                       trim(it->second.substr(0, pos - 1));
                if (opt.empty())
                        return string();
 
@@ -296,7 +295,7 @@ string const getInfo(InfoMap const & map, string const & key)
        string::size_type const pos = it->second.find(separator);
        if (pos != string::npos) {
                string::size_type const pos2 = pos + separator.size();
-               string const info = strip(frontStrip(it->second.substr(pos2)));
+               string const info = trim(it->second.substr(pos2));
                return info;
        }
 
@@ -341,7 +340,7 @@ string const getInfo(InfoMap const & map, string const & key)
        if (!year.empty())
                result << ", " << year;
 
-       string const result_str = strip(result.str().c_str());
+       string const result_str = rtrim(result.str().c_str());
        if (!result_str.empty())
                return result_str;
 
@@ -363,7 +362,7 @@ searchKeys(InfoMap const & theMap,
        if (start < keys.begin() || start >= keys.end())
                return keys.end();
 
-       string search_expr = frontStrip(strip(expr));
+       string search_expr = trim(expr);
        if (search_expr.empty())
                return keys.end();
 
@@ -387,7 +386,7 @@ string const parseBibTeX(string data, string const & findkey)
        string dummy = token(data,'\n', Entries);
        while (!dummy.empty()) {
                dummy = subst(dummy, '\t', ' ');        // no tabs
-               dummy = frontStrip(dummy);              // no leading spaces
+               dummy = ltrim(dummy);           // no leading spaces
                // ignore lines with a beginning '%' or ignore all right of %
                string::size_type const idx =
                        dummy.empty() ? string::npos : dummy.find('%');
@@ -451,10 +450,10 @@ string const parseBibTeX(string data, string const & findkey)
 
        // Clean-up.
        // 1. Spaces
-       data = strip(data);
+       data = rtrim(data);
        // 2. if there is no opening '{' then a closing '{' is probably cruft.
        if (!contains(data, '{'))
-               data = strip(data, "}");
+               data = rtrim(data, "}");
        // happens, when last keyword
        string::size_type const idx =
                !data.empty() ? data.find('=') : string::npos;
@@ -462,14 +461,13 @@ string const parseBibTeX(string data, string const & findkey)
        if (idx == string::npos)
                return string();
 
-       data = data.substr(idx);
-       data = frontStrip(strip(data));
+       data = trim(data.substr(idx));
 
        if (data.length() < 2 || data[0] != '=') {      // a valid entry?
                return string();
        } else {
                // delete '=' and the following spaces
-               data = frontStrip(frontStrip(data, "="));
+               data = ltrim(data, " =");
                if (data.length() < 2) {
                        return data;    // not long enough to find delimiters
                } else {
@@ -482,7 +480,7 @@ string const parseBibTeX(string data, string const & findkey)
                        } else {
                                // no {} and no "", pure data but with a
                                // possible ',' at the end
-                               return strip(data, ",");
+                               return rtrim(data, ",");
                        }
                        string tmp = data.substr(keypos);
                        while (tmp.find('{') != string::npos &&
index 95061db07e357a75b540e948980155384e43c859..0c4336f8f583df3de93b2cba5e382d74aa8d7aea 100644 (file)
@@ -1,25 +1,29 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * several file: strip,frontStrip -> trim,ltrim,rtrim
+
 2002-07-25  John Levon  <levon@movementarian.org>
 
        * Toolbar_pimpl.C: fix tooltips
+
 2002-07-25  John Levon  <levon@movementarian.org>
 
        * QCommandEdit.C:
        * Toolbar_pimpl.C: make Tab work in the content pane
+
 2002-07-25  John Levon  <levon@movementarian.org>
 
        * Menubar_pimpl.C: split create/fill of menus into
          two functions
+
 2002-07-25  John Levon  <moz@compsoc.man.ac.uk>
 
        * Menubar_pimpl.C: make it compile again
+
 2002-07-24  John Levon  <moz@compsoc.man.ac.uk>
 
        * Menubar_pimpl.C: make it compile again
+
 2002-07-24  Angus Leeming  <leeming@lyx.org>
 
        * FileDialog_private.C (done): add a false to the arguments passed to
        * ui/QCitationDialog.ui: layout fix
        * ui/QExternalDialog.ui: idem
        * TODO: update
-       
+
 2002-07-23  John Levon  <moz@compsoc.man.ac.uk>
 
        * QCommandBuffer.C: real compile fix
+
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * QLyXKeySym.C: return 0 when text_ is empty
-         for getISOEncoded() 
+         for getISOEncoded()
 
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * QtView.C:
        * Toolbar_pimpl.h:
        * Toolbar_pimpl.C: remove dead code
+
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_gui.C: add exit() so we don't busy loop !
+
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * QCommandEdit.C: complete if right at end of line
+
        * QLyXKeySym.C: cleanup comments
+
        * QtView.C: prefer const int
+
        * qlkey.h: fix some transliteration errors...
+
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * Toolbar_pimpl.h:
        * Toolbar_pimpl.C: remove ->push()
+
 2002-07-22  Edwin Leuven  <leuven@fee.uva.nl>
 
        * QCitationDialog.C: fix loop search and info update after selecting
        * ui/QBibtexDialog.ui: style browser
        * QBibtex.C: idem
        * QBibtexDialog.C: idem
-       
+
        * ui/QRefDialog.ui: document combo
        * QRef.C: idem
-       
+
        * QInclude.C: new layout
        * ui/QIncludeDialog.ui: new layout
-       
+
        * ui/QCitationDialog.ui: new layout
-       
+
        * ui/QExternalDialog.ui: new layout
-       
+
        * QGraphics.C: Compile fix
-       
-       * TODO: 
+
+       * TODO:
 
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * Menubar_pimpl.h:
        * Menubar_pimpl.C: implement check/disable, submenus
+
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * Toolbar_pimpl.h:
        * Toolbar_pimpl.C: implement getLayoutList()
+
 2002-07-21  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * Toolbar_pimpl.C: use BufferParams::getLyXTextClass
 
        * QToc.h:
        * QToc.C: compile fixes, default to depth_(1)
+
 2002-07-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * Menubar_pimpl.C: change for removed menubar stuff
+
 2002-07-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * QtView.C: reset idle timer on message()
+
 2002-07-20  John Levon  <moz@compsoc.man.ac.uk>
 
        * QLImage.C: various fixes
-       * QWorkArea.C: set focus proxy 
+
+       * QWorkArea.C: set focus proxy
+
        * qscreen.C: don't show cursor when in command buffer
+
        * Makefile.am:
        * moc/Makefile.am:
        * QMiniBuffer.h:
-       * QMiniBuffer.C: 
+       * QMiniBuffer.C:
        * QCommandBuffer.h:
        * QCommandBuffer.C:
        * QCommandEdit.h:
 2002-07-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * QWorkArea.C: remove unnecessary include
+
 2002-07-18  John Levon  <moz@compsoc.man.ac.uk>
 
        * QtView.C:
        * Toolbar_pimpl.C:
        * lyx_gui.C: verboseDispatch() is now dispatch()
+
 2002-07-07  Edwin Leuven  <leuven@fee.uva.nl>
 
        * QParagraph.[Ch]: Add paragraph dialog
-       * QParagraphDialog.[Ch]: 
-       * ui/QParagraphDialog.[Ch]: 
+       * QParagraphDialog.[Ch]:
+       * ui/QParagraphDialog.[Ch]:
        * Makefile.am:
        * Makefile.dialogs:
        * guiapi.C:
 2002-07-17  John Levon  <moz@compsoc.man.ac.uk>
 
        * QtView.C: basic statusbar show
+
 2002-07-17  John Levon  <moz@compsoc.man.ac.uk>
 
        * QLImage.C: add using std
+
 2002-07-15  John Levon  <moz@compsoc.man.ac.uk>
 
        * QLImage.h:
        * QLImage.C: remove getPixmap() add isDrawable()
+
 2002-07-14  John Levon  <moz@compsoc.man.ac.uk>
 
        * io_callback.h:
        * lyx_gui.C: make set_read_callback() work
+
 2002-07-14  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_gui.C: add set_read_callback()
-       * Makefile.am: 
+
+       * Makefile.am:
        * xforms/*: remove
+
 2002-07-13  John Levon  <moz@compsoc.man.ac.uk>
 
        * QtView.C: add a status bar
-       * Toolbar_pimpl.C: minor fixes 
 
-       * lyx_gui.C: implement hexname() 
+       * Toolbar_pimpl.C: minor fixes
+
+       * lyx_gui.C: implement hexname()
 
 2002-07-12  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_gui.C: move init_graphics() to parse_init()
+
 2002-07-12  John Levon  <moz@compsoc.man.ac.uk>
 
        * Toolbar_pimpl.h:
        * Toolbar_pimpl.C: remove unused (de)activate()
+
 2002-07-12  John Levon  <moz@compsoc.man.ac.uk>
 
-       * lyx_gui.C: implement update_fonts(), font_available() 
+       * lyx_gui.C: implement update_fonts(), font_available()
+
 2002-07-12  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_gui.C: add un-needed update_color()
 
        * QtView.h:
        * QtView.C: remove unused methods
+
 2002-07-12  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am:
        * QLPainter.C: draw images
 
        * QWorkArea.C: implement clipboard as much as possible
+
 2002-07-11  John Levon  <moz@compsoc.man.ac.uk>
 
        * dialog files: add unused Dialogs paramater to allow compile
+
        * QtView.C:
        * QMiniBuffer.h:
        * QMiniBuffer.C:
        * Makefile.am: add QMiniBuffer (placeholder)
+
        * TODO: add
+
        * Toolbar_pimpl.h:
        * Toolbar_pimpl.C: compile fix
 
        * lyx_gui.C: add hexname() place holder
+
 2002-07-04  André Pönitz  <poenitz@lyx.org>
 
        * xforms/Makefile.am: replace XFORMSGIMAGE by XFORMSIMAGE
 2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * qfont_metrics.C: fix variable names
+
 2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * QWorkArea.C: remove dead splash code
+
 2002-06-21  John Levon  <moz@compsoc.man.ac.uk>
 
        * QContentPane.C: restore calls to workAreaResize()
 
-       * QLyXKeySym.h: tidy 
+       * QLyXKeySym.h: tidy
+
+       * QWorkArea.h: remove redraw()
 
-       * QWorkArea.h: remove redraw() 
        * QWorkArea.C: remove resize()
+
 2002-06-20  John Levon  <moz@compsoc.man.ac.uk>
 
        * guiapi.C: createIndex() changed
+
 2002-06-20  John Levon  <moz@compsoc.man.ac.uk>
 
        * QWorkArea.h: remove unused resize(...)
+
 2002-06-20  John Levon  <moz@compsoc.man.ac.uk>
 
        * QWorkArea.h: remove unused stuff
+
 2002-06-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * QContentPane.h:
        * QContentPane.C: remove focus/unfocus events
+
 2002-06-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * QWorkArea.h: remove unused methods
+
 2002-06-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * LyXKeySymFactory.C: add
        * QLyXKeySym.h:
        * QLyXKeySym.C: get keyboard partly working
 
-       * qfont_metrics.C: fix compile 
+       * qfont_metrics.C: fix compile
+
 2002-06-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am: add the new files ...
+
        * Dialogs.C:
        * guiapi.C:
        * all dialogs: implement new dialog stuff, fix compile
 
        * QContentPane.h:
        * QContentPane.C: new widget for containing a lyx document
+
        * QLPainter.h:
        * QLPainter.C: qt painter object
+
        * QWorkArea.h:
        * QWorkArea.C: Qt version of the work area
+
        * QtView.h:
        * QtView.C: Qt version of LyXView
 
        * Toolbar_pimpl.C:
        * Menubar_pimpl.h:
        * Menubar_pimpl.C: initial Qt versions
+
        * WorkAreaFactory.C: generate a QWorkArea
-       * emptytable.C: add a resize grippie 
+
+       * emptytable.C: add a resize grippie
+
        * qfont_loader.h:
        * qfont_loader.C: font loader for Qt
+
        * qfont_metrics.h:
        * qfont_metrics.C: font metrics for Qt
+
        * qlkey.h: convert Qt key symbol into a name
+
        * qscreen.h:
        * qscreen.C: Qt version of screen
+
        * moc/Makefile.am: add new files
+
        * xforms/Makefile.am: remove all xforms dialogs
+
 2002-06-10  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * Qt2BC.C: do not include ButtonController.tmpl
 2002-05-23  John Levon  <moz@compsoc.man.ac.uk>
 
        * QtLyXView.h: moved into frontends/
+
 2002-05-22  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * QDocument.h: use more specific smart_ptr header.
index efd89f45ea174cb1836390491b9751bd323a6962..75a75e8ceaacd7702acbba1e103d0670f86da00f 100644 (file)
@@ -60,7 +60,7 @@ void QBibtex::update_contents()
 
        while (!bibs.empty()) {
                bibs = split(bibs, bib, ',');
-               bib = frontStrip(strip(bib));
+               bib = trim(bib);
                if (!bib.empty())
                        dialog_->databaseLB->inSort(bib.c_str());
        }
@@ -79,7 +79,7 @@ void QBibtex::update_contents()
                        bibstyle = "";
        } else
                dialog_->bibtocCB->setChecked(false);
-       
+
 
        vector<string> const str = getVectorFromString(
                controller().getBibStyles(),"\n");
index e31deb7ffafdb24bbdf7602e2adc136a12ffcc03..ca20bdcf6ecfbe5e798652486412772df78fa5ff 100644 (file)
@@ -179,7 +179,7 @@ void QCitation::updateBrowser(QListBox* browser,
 
        for (vector<string>::const_iterator it = keys.begin();
                it < keys.end(); ++it) {
-               string const key = frontStrip(strip(*it));
+               string const key = trim(*it);
                // FIXME: why the .empty() test ?
                if (!key.empty())
                        browser->insertItem(key.c_str());
index b408d77dd0039afeb0608d8d08339025e31cf518..48a4b843266656886d458e515e02b5ebc66baf2d 100644 (file)
@@ -41,7 +41,7 @@ using std::bind2nd;
 using std::remove_if;
 
 typedef Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> > base_class;
-  
+
 QParagraph::QParagraph(ControlParagraph & c, Dialogs &)
        : base_class(c, _("Paragraph Layout"))
 {}
@@ -57,13 +57,13 @@ void QParagraph::build_dialog()
        vector<string>::iterator del = remove_if(units_.begin(), units_.end(),
                                                 bind2nd(contains_functor(), "%"));
        units_.erase(del, units_.end());
-       
+
        for (vector<string>::const_iterator it = units_.begin();
                it != units_.end(); ++it) {
                dialog_->unitAbove->insertItem(it->c_str());
                dialog_->unitBelow->insertItem(it->c_str());
        }
-       
+
        // Manage the ok, apply, restore and cancel/close buttons
        bc().setOK(dialog_->okPB);
        bc().setApply(dialog_->applyPB);
@@ -102,11 +102,11 @@ VSpace setVSpaceFromWidgets(int spacing,
                break;
        case 6:
                string s;
-               string const length = strip(frontStrip(value));
+               string const length = trim(value);
                if (isValidGlueLength(length)) {
                        s = length;
                } else if (!length.empty()){
-                       string u = strip(frontStrip(unit));
+                       string u = trim(unit);
                        u = subst(u, "%%", "%");
                        s = length + u;
                }
@@ -127,21 +127,21 @@ void QParagraph::apply()
        // If a vspace kind is "Length" but there's no text in
        // the input field, reset the kind to "None".
        if (dialog_->spacingAbove->currentItem()==5
-           && dialog_->valueAbove->text().isEmpty()) 
+           && dialog_->valueAbove->text().isEmpty())
                dialog_->spacingAbove->setCurrentItem(0);
-       
+
        VSpace const space_top =
                setVSpaceFromWidgets(dialog_->spacingAbove->currentItem(),
                                     string(dialog_->valueAbove->text()),
                                     string(dialog_->unitAbove->currentText()),
                                     dialog_->keepAbove->isChecked());
 
-       
+
        controller().params().spaceTop(space_top);
 
        /* SPACING BELOW */
        if (dialog_->spacingBelow->currentItem()==5
-           && dialog_->valueBelow->text().isEmpty()) 
+           && dialog_->valueBelow->text().isEmpty())
                dialog_->spacingBelow->setCurrentItem(0);
 
        VSpace const space_bottom =
@@ -149,7 +149,7 @@ void QParagraph::apply()
                             string(dialog_->valueBelow->text()),
                             string(dialog_->unitBelow->currentText()),
                             dialog_->keepBelow->isChecked());
-       
+
        controller().params().spaceBottom(space_bottom);
 
        /* alignment */
@@ -171,7 +171,7 @@ void QParagraph::apply()
                align = LYX_ALIGN_BLOCK;
        }
        controller().params().align(align);
-       
+
        /* get spacing */
        Spacing::Space linespacing = Spacing::Default;
        string other;
@@ -196,7 +196,7 @@ void QParagraph::apply()
 
        Spacing const spacing(linespacing, other);
        controller().params().spacing(spacing);
-       
+
        /* lines and pagebreaks */
        controller().params().lineTop(dialog_->lineAbove->isChecked());
        controller().params().lineBottom(dialog_->lineBelow->isChecked());
@@ -241,7 +241,7 @@ void setWidgetsFromVSpace(VSpace const & space,
        case VSpace::VFILL:
                item = 5;
                break;
-       case VSpace::LENGTH: 
+       case VSpace::LENGTH:
                item = 6;
                value->setEnabled(true);
                unit->setEnabled(true);
@@ -303,7 +303,7 @@ void QParagraph::update_contents()
                break;
        }
        dialog_->align->setCurrentItem(i);
-       
+
 
        //LyXAlignment alignpos = controller().alignPossible();
 
@@ -366,7 +366,3 @@ void QParagraph::update_contents()
        /* no indent */
        dialog_->noindent->setChecked(controller().params().noindent());
 }
-
-
-
-
index 8358003fd3d18494c839f16e9da0d0747732bbf9..711b28581393d0c6b6fd9cd890a804e26c87bead 100644 (file)
@@ -1,7 +1,11 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * several files: strip,frontStrip -> trim,ltrim,rtrim
+
 2002-07-25  John Levon  <levon@movementarian.org>
 
        * lyx_gui.C:
-       * XWorkArea.C: using dec 
+       * XWorkArea.C: using dec
 
 2002-07-25  Juergen Spitzmueller <j.spitzmueller@gmx.de>
 
@@ -33,7 +37,7 @@
 2002-07-25  John Levon  <levon@movementarian.org>
 
        * forms/form_float.fd: "Span columns"
+
 2002-07-25  Juergen Spitzmueller <j.spitzmueller@gmx.de>
 
        * FormFloat.C:
@@ -59,7 +63,7 @@
 2002-07-24  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * Menubar_pimpl.C (create_submenu): updates due to changes in
-       menubackend. 
+       menubackend.
 
 2002-07-22  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
 
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
-       * XFormsView.C: don't call toolbar_->set() 
+       * XFormsView.C: don't call toolbar_->set()
 
        * Toolbar_pimpl.h:
        * Toolbar_pimpl.C: rationalise code, remove half-working
          update stuff into simple add()
+
 2002-07-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_gui.C: add lyx_gui::exit()
index d4cc950828f796b190cac7f056ef1717c2a59d45..39d7bf908503b9961f35ccaad7ef597765f20854 100644 (file)
@@ -495,7 +495,7 @@ void FormCitation::updateBrowser(FL_OBJECT * browser,
 
        for (vector<string>::const_iterator it = keys.begin();
             it < keys.end(); ++it) {
-               string key = frontStrip(strip(*it));
+               string key = trim(*it);
                if (!key.empty())
                        fl_add_browser_line(browser, key.c_str());
        }
index 37b23e3422b98739d49732d3d0198b0c84878497..4df665fe18a862aeb223c0d908ed355a611770a2 100644 (file)
@@ -461,7 +461,7 @@ bool FormDocument::input(FL_OBJECT * ob, long)
                bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
                        || paperchoice == 2 || paperchoice > 5;
                int const default_unit = metric ? 8 : 9;
-               if (strip(fl_get_input(class_->input_doc_skip)).empty())
+               if (rtrim(fl_get_input(class_->input_doc_skip)).empty())
                        fl_set_choice(class_->choice_default_skip_units,
                                      default_unit);
        }
@@ -537,31 +537,31 @@ bool FormDocument::input(FL_OBJECT * ob, long)
                bool const metric = (defsize && lyxrc.default_papersize > 3)
                        || paperchoice == 2 || paperchoice > 5;
                int const default_unit = metric ? 8 : 9;
-               if (strip(fl_get_input(paper_->input_custom_width)).empty())
+               if (rtrim(fl_get_input(paper_->input_custom_width)).empty())
                        fl_set_choice(paper_->choice_custom_width_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_custom_height)).empty())
+               if (rtrim(fl_get_input(paper_->input_custom_height)).empty())
                        fl_set_choice(paper_->choice_custom_height_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_top_margin)).empty())
+               if (rtrim(fl_get_input(paper_->input_top_margin)).empty())
                        fl_set_choice(paper_->choice_top_margin_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_bottom_margin)).empty())
+               if (rtrim(fl_get_input(paper_->input_bottom_margin)).empty())
                        fl_set_choice(paper_->choice_bottom_margin_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_inner_margin)).empty())
+               if (rtrim(fl_get_input(paper_->input_inner_margin)).empty())
                        fl_set_choice(paper_->choice_inner_margin_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_outer_margin)).empty())
+               if (rtrim(fl_get_input(paper_->input_outer_margin)).empty())
                        fl_set_choice(paper_->choice_outer_margin_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_head_height)).empty())
+               if (rtrim(fl_get_input(paper_->input_head_height)).empty())
                        fl_set_choice(paper_->choice_head_height_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_head_sep)).empty())
+               if (rtrim(fl_get_input(paper_->input_head_sep)).empty())
                        fl_set_choice(paper_->choice_head_sep_units,
                                      default_unit);
-               if (strip(fl_get_input(paper_->input_foot_skip)).empty())
+               if (rtrim(fl_get_input(paper_->input_foot_skip)).empty())
                        fl_set_choice(paper_->choice_foot_skip_units,
                                      default_unit);
        }
index 3c77c919e89358d154c032aaceef311686ee7c72..aeb7528a21dad05e13f733d82eda579a6578ff5e 100644 (file)
@@ -710,7 +710,7 @@ string const FileDialog::Private::Select(string const & title,
        if (!filename.empty()) {
                for (int i = 0; i < fl_get_browser_maxline(file_dlg_form_->List); ++i) {
                        string s = fl_get_browser_line(file_dlg_form_->List, i + 1);
-                       s = strip(frontStrip(s));
+                       s = trim(s);
                        if (s == filename) {
                                sel = i + 1;
                                break;
index 82ae3453a4d12ac3245aa98a55cba319ae5b7da2..fc5edcd837bbaffd77b5ad307e9c24fc8855d113 100644 (file)
@@ -138,10 +138,10 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long)
 
        } else if (ob == dialog_->button_load) {
                string const in_name = fl_get_input(dialog_->input_filename);
-               if (!strip(in_name).empty() && controller().fileExists(in_name)) {
+               if (!rtrim(in_name).empty() && controller().fileExists(in_name)) {
 //                     ApplyButton();
                        OKButton();
-                       controller().load(strip(in_name));
+                       controller().load(rtrim(in_name));
                        action = ButtonPolicy::SMI_NOOP;
                }
 
@@ -157,7 +157,7 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long)
 
        } else if (ob == dialog_->input_filename) {
                string const in_name = fl_get_input(dialog_->input_filename);
-               if (strip(in_name).empty())
+               if (rtrim(in_name).empty())
                        action = ButtonPolicy::SMI_INVALID;
        }
 
index 52616144454afec96d87de41818ac78b60b38e77..1e8ecc082dfa5b5c822ace1331675d7982cb9efa 100644 (file)
@@ -171,7 +171,7 @@ void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
 
        // If a vspace kind is "Length" but there's no text in
        // the input field, reset the kind to "None".
-       string const input = strip(getString(input_length));
+       string const input = rtrim(getString(input_length));
        if (input.empty())
                fl_set_choice(choice_type, 1);
 }
@@ -449,7 +449,7 @@ void synchronizeSpaceWidgets(FL_OBJECT * choice_type,
 
                string const length = getString(input_length);
 
-               if (strip(length).empty()) {
+               if (rtrim(length).empty()) {
                        bool const metric = lyxrc.default_papersize > 3;
                        int const default_unit = metric ? 8 : 9;
 
index 67427f2f2bbb7884dd327b4ed76e7b4062d8e560..d9c53c587537b309d82cbd5846013ba208232528 100644 (file)
@@ -499,10 +499,10 @@ void FormPreferences::Colors::build()
 string const
 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
 {
-       if (ob == dialog_->browser_lyx_objs) 
+       if (ob == dialog_->browser_lyx_objs)
                return _("LyX objects that can be assigned a color.");
 
-       if (ob == dialog_->button_modify) 
+       if (ob == dialog_->button_modify)
                return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
 
        if (ob == dialog_->dial_hue ||
@@ -513,7 +513,7 @@ FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
                  ob == dialog_->slider_blue)
                return  _("Find a new color.");
 
-       if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv) 
+       if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv)
                return _("Toggle between RGB and HSV color spaces.");
 
        return string();
@@ -951,7 +951,7 @@ void FormPreferences::Converters::build()
 string const
 FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
 {
-       if (ob == dialog_->browser_all) 
+       if (ob == dialog_->browser_all)
                return _("All the currently defined converters known to LyX.");
 
        if (ob == dialog_->choice_from)
@@ -962,25 +962,25 @@ FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
 
        if (ob == dialog_->input_converter)
                return _("The conversion command. $$i is the input file name, "
-                        "$$b is the file name without its extension and $$o is "
-                        "the name of the output file. $$s can be used as path to "
-                        "LyX's own collection of conversion scripts.");
+                        "$$b is the file name without its extension and $$o is "
+                        "the name of the output file. $$s can be used as path to "
+                        "LyX's own collection of conversion scripts.");
 
        if (ob == dialog_->input_flags)
                return _("Extra information for the Converter class, whether and "
-                        "how to parse the result, and various other things.");
+                        "how to parse the result, and various other things.");
 
        if (ob == dialog_->button_delete)
                return _("Remove the current converter from the list of available "
-                        "converters. Note: you must then \"Apply\" the change.");
+                        "converters. Note: you must then \"Apply\" the change.");
 
        if (ob == dialog_->button_add) {
                if (string(ob->label) == _("Add"))
                        return _("Add the current converter to the list of available "
-                                "converters. Note: you must then \"Apply\" the change.");
+                                "converters. Note: you must then \"Apply\" the change.");
                else
                        return _("Modify the contents of the current converter. "
-                                "Note: you must then \"Apply\" the change.");
+                                "Note: you must then \"Apply\" the change.");
        }
 
        return string();
@@ -998,10 +998,10 @@ bool FormPreferences::Converters::input(FL_OBJECT const * const ob)
                   || ob == dialog_->input_flags)
                return Input();
 
-       if (ob == dialog_->button_add) 
+       if (ob == dialog_->button_add)
                return Add();
 
-       if (ob == dialog_->button_delete) 
+       if (ob == dialog_->button_delete)
                return erase();
 
        return true;
@@ -1120,7 +1120,7 @@ bool FormPreferences::Converters::Input()
                setEnabled(dialog_->button_delete, true);
        }
 
-       string const command = strip(fl_get_input(dialog_->input_converter));
+       string const command = rtrim(fl_get_input(dialog_->input_converter));
        bool const enable = !(command.empty() || from == to);
        setEnabled(dialog_->button_add, enable);
 
@@ -1220,7 +1220,7 @@ void FormPreferences::Formats::build()
 string const
 FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
 {
-       if (ob == dialog_->browser_all) 
+       if (ob == dialog_->browser_all)
                return  _("All the currently defined formats known to LyX.");
 
        if (ob == dialog_->input_format)
@@ -1231,7 +1231,7 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
 
        if (ob == dialog_->input_shrtcut)
                return  _("The keyboard accelerator. Use a letter in the GUI name. "
-                         "Case sensitive.");
+                         "Case sensitive.");
 
        if (ob == dialog_->input_extension)
                return  _("Used to recognize the file. E.g., ps, pdf, tex.");
@@ -1241,15 +1241,15 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
 
        if (ob == dialog_->button_delete)
                return  _("Remove the current format from the list of available "
-                         "formats. Note: you must then \"Apply\" the change.");
+                         "formats. Note: you must then \"Apply\" the change.");
 
-       if (ob == dialog_->button_add) { 
+       if (ob == dialog_->button_add) {
                if (string(ob->label) == _("Add"))
                        return  _("Add the current format to the list of available "
-                                 "formats. Note: you must then \"Apply\" the change.");
+                                 "formats. Note: you must then \"Apply\" the change.");
                else
                        return  _("Modify the contents of the current format. Note: "
-                                 "you must then \"Apply\" the change.");
+                                 "you must then \"Apply\" the change.");
        }
 
        return string();
@@ -1258,7 +1258,7 @@ FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
 
 bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
 {
-       if (ob == dialog_->browser_all) 
+       if (ob == dialog_->browser_all)
                return Browser();
 
        if (ob == dialog_->input_format
@@ -1268,10 +1268,10 @@ bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
         || ob == dialog_->input_viewer)
                return Input();
 
-       if (ob == dialog_->button_add) 
+       if (ob == dialog_->button_add)
                return Add();
 
-       if (ob == dialog_->button_delete) 
+       if (ob == dialog_->button_delete)
                return erase();
 
        return false;
@@ -1362,7 +1362,7 @@ bool FormPreferences::Formats::erase()
 
        if (local_converters.formatIsUsed(name)) {
                parent_.postWarning(_("Cannot remove a Format used by a Converter. "
-                                     "Remove the converter first."));
+                                     "Remove the converter first."));
                setEnabled(dialog_->button_delete, false);
                return false;
        }
@@ -2760,7 +2760,7 @@ void FormPreferences::SpellOptions::apply()
 {
 
        string choice = fl_get_choice_text(dialog_->choice_spell_command);
-       choice = strip(frontStrip(choice));
+       choice = trim(choice);
 
        lyxrc.isp_command = choice;
 
index e126ced8d63ae9f92cc1e076f93be92ec6b5987a..11050fbfa3da12b9f63b97579fad3cadef23e58a 100644 (file)
@@ -93,7 +93,7 @@ ButtonPolicy::SMInput FormSendto::input(FL_OBJECT *, long)
                return ButtonPolicy::SMI_INVALID;
 
        string cmd = getString(dialog_->input_command);
-       cmd = strip(frontStrip(cmd));
+       cmd = trim(cmd);
        if (cmd.empty())
                return ButtonPolicy::SMI_INVALID;
 
index 9ce8b49edad053b857e67e9f40f8ea38f26e92f4..e7f351dec7446303a457753cbbf227bf50136cbe 100644 (file)
@@ -150,7 +150,7 @@ void FormThesaurus::setReplace(string const & templ, string const & nstr)
 ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long)
 {
        if (obj == dialog_->input_entry) {
-               string s = strip(frontStrip(fl_get_input(dialog_->input_entry)));
+               string s = trim(fl_get_input(dialog_->input_entry));
 
                updateMeanings(s);
 
@@ -174,7 +174,7 @@ ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long)
        int const line = fl_get_browser(obj);
        if (line > 0) {
                setReplace(fl_get_input(dialog_->input_entry),
-                          strip(frontStrip(fl_get_browser_line(obj, line))));
+                          trim(fl_get_browser_line(obj, line)));
        }
 
        if (clickline_ == fl_get_browser(obj)) {
index cf639e598e7b91cc684391778cdd9aaf4f550536..255b40c12313d9a64cced7fa98653dfda73fec18 100644 (file)
@@ -79,7 +79,7 @@ void Tooltips::init(FL_OBJECT * ob, string const & tip)
        if (it != tooltipsMap.end())
                return;
 
-       string const str = strip(frontStrip(tip));
+       string const str = trim(tip);
        if (str.empty())
                return;
 
@@ -147,7 +147,7 @@ void Tooltips::init(FL_OBJECT * ob, string const & tip)
        if (it != tooltipsMap.end())
                return;
 
-       string const str = strip(frontStrip(tip));
+       string const str = trim(tip);
        if (str.empty())
                return;
 
index 1cd6e638976cf24031d31606345f3240ad8f8939..3270cec09f859773c99db2146fbad1d9e8bc324d 100644 (file)
@@ -270,7 +270,7 @@ void XWorkArea::redraw(int width, int height)
                                       width,
                                       height,
                                       fl_get_visual_depth());
+
        workAreaResize();
 }
 
index ae1e3ad3a8b6d09e0c2c5e7442bc46ef789e0e6a..3cb159ba213457fd7caefa6b2ba382b44d08187e 100644 (file)
@@ -116,13 +116,12 @@ void fl_print_range_filter(FL_OBJECT * ob,
           code below. */
 
        string pages = subst(fl_get_input(fd_form_print->input_pages), ';',',');
-       pages = subst(pages, '+',',');
-       pages = frontStrip(strip(pages)) ;
+       pages = trim(subst(pages, '+', ','));
+
        while (!pages.empty()) { // a page range was given
                string piece ;
                pages = split (pages, piece, ',') ;
-               piece = strip(piece) ;
-               piece = frontStrip(piece) ;
+               piece = trim(piece);
                if (!stringOnlyContains (piece, "0123456789-")) {
                        Alert::alert(_("ERROR!  Unable to print!"),
                                   _("Check 'range of pages'!"));
index 918a226ab6bfc46c89f2688c43745ef454c7c0bb..a82f0c0c80e437cc4c023f6adcfed2aa234b438a 100644 (file)
@@ -172,7 +172,7 @@ bool xformsImage::isDrawable() const
        return pixmap_;
 }
 
+
 Pixmap xformsImage::getPixmap() const
 {
        if (!pixmap_status_ == PIXMAP_SUCCESS)
@@ -366,7 +366,7 @@ int status_report(FL_IMAGE * ob, const char *s)
 {
        lyx::Assert(ob && ob->u_vdata);
 
-       string const str = s ? strip(s) : string();
+       string const str = s ? rtrim(s) : string();
        if (str.empty())
                return 0;
 
@@ -385,7 +385,7 @@ static void error_report(FL_IMAGE * ob, const char *s)
 {
        lyx::Assert(ob && ob->u_vdata);
 
-       string const str = s ? strip(s) : string();
+       string const str = s ? rtrim(s) : string();
        if (str.empty())
                return;
 
index e4f20f6234b0299b6327cfacf3cd1dae0c903db6..e57b623b92f8a4457b305c42bd3f7251bd6e1fb0 100644 (file)
@@ -50,24 +50,24 @@ void setEnabled(FL_OBJECT * ob, bool enable)
 vector<string> const getVector(FL_OBJECT * ob)
 {
        vector <string> vec;
-       
+
        switch (ob->objclass) {
        case FL_CHOICE:
                for(int i = 0; i < fl_get_choice_maxitems(ob); ++i) {
                        string const text = fl_get_choice_item_text(ob, i+1);
-                       vec.push_back(strip(frontStrip(text)));
+                       vec.push_back(trim(text));
                }
                break;
        case FL_BROWSER:
                for(int i = 0; i < fl_get_browser_maxline(ob); ++i) {
                        string const text = fl_get_browser_line(ob, i+1);
-                       vec.push_back(strip(frontStrip(text)));
+                       vec.push_back(trim(text));
                }
                break;
        default:
                lyx::Assert(0);
        }
-       
+
        return vec;
 }
 
@@ -85,33 +85,33 @@ string const getString(FL_OBJECT * ob, int line)
        case FL_BROWSER:
                if (line == -1)
                        line = fl_get_browser(ob);
-                       
+
                if (line >= 1 && line <= fl_get_browser_maxline(ob))
                        tmp = fl_get_browser_line(ob, line);
                break;
-                       
+
        case FL_CHOICE:
                if (line == -1)
                        line = fl_get_choice(ob);
-                       
+
                if (line >= 1 && line <= fl_get_choice_maxitems(ob))
                        tmp = fl_get_choice_item_text(ob, line);
                break;
-                       
+
        default:
                lyx::Assert(0);
-       }               
+       }
 
-       return (tmp) ? frontStrip(strip(tmp)) : string();
+       return (tmp) ? trim(tmp) : string();
 }
-       
+
 string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
 {
        // Paranoia check
        lyx::Assert(input  && input->objclass  == FL_INPUT &&
                    choice && choice->objclass == FL_CHOICE);
 
-       string const length = strip(frontStrip(fl_get_input(input)));
+       string const length = trim(fl_get_input(input));
        if (length.empty())
                return string();
 
@@ -119,7 +119,7 @@ string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
        if (isValidGlueLength(length))
                return length;
 
-       string unit = strip(frontStrip(fl_get_choice_text(choice)));
+       string unit = trim(fl_get_choice_text(choice));
        unit = subst(unit, "%%", "%");
 
        return length + unit;
index baccf953426ad142df69ded8cf238d545d5eb274..58127cb9aaf7ad5f7788751e383192e03c87246f 100644 (file)
@@ -1,3 +1,9 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * PreviewLoader.C (setFontScalingFactor): strip,frontStrip ->
+       trim,ltrim,rtrim
+       (setAscentFractions): ditto
+
 2002-07-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * PreviewLoader.C (setAscentFractions): modify because of strip
index cea9a7f5237d3cd392c2092b7fde5adb2646911d..f049a488acad48bef321a593279418a9063718e3 100644 (file)
@@ -681,7 +681,7 @@ double setFontScalingFactor(Buffer & buffer)
                getline(ifs, str);
                // To get the default font size, look for a line like
                // "\ExecuteOptions{letterpaper,10pt,oneside,onecolumn,final}"
-               if (!prefixIs(frontStrip(str), "\\ExecuteOptions"))
+               if (!prefixIs(ltrim(str), "\\ExecuteOptions"))
                        continue;
 
                // str contains just the options of \ExecuteOptions
@@ -737,7 +737,7 @@ void setAscentFractions(vector<double> & ascent_fractions,
 
                if (!ifs.good() ||
                    page != "%%Page" ||
-                   !isStrUnsignedInt(strip(page_id, ":"))) {
+                   !isStrUnsignedInt(rtrim(page_id, ":"))) {
                        lyxerr[Debug::GRAPHICS] << "setAscentFractions("
                                                << metrics_file << ")\n"
                                                << "Error reading file!"
index 032d120859539d63007efbf7da13f5d122b7a79e..0a4930d32273106d97ce7902e45b98e79ede0e3e 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * several files: strip,frontStrip -> trim,ltrim,rtrim
+
 2002-07-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * insetbib.C (latex): modify because of strip changes
index 738e4ecd920d586f669093aedf350a8a4bb475c2..fafa51ae8612f85cbe704d39f8c834c7a5c34395 100644 (file)
@@ -206,7 +206,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
                db_out += ',';
                db_in= split(db_in, adb,',');
        }
-       db_out = strip(db_out, ",");
+       db_out = rtrim(db_out, ",");
        os   << "\\bibliography{" << db_out << "}\n";
        return 2;
 }
@@ -253,7 +253,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
                ifstream ifs(it->c_str());
                string linebuf0;
                while (getline(ifs, linebuf0)) {
-                       string linebuf = frontStrip(strip(linebuf0));
+                       string linebuf = trim(linebuf0);
                        if (linebuf.empty()) continue;
                        if (prefixIs(linebuf, "@")) {
                                linebuf = subst(linebuf, '{', '(');
@@ -263,8 +263,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
                                if (!prefixIs(tmp, "@string")
                                    && !prefixIs(tmp, "@preamble")) {
                                        linebuf = split(linebuf, tmp, ',');
-                                       tmp = frontStrip(tmp);
-                                       tmp = frontStrip(tmp,"\t");
+                                       tmp = ltrim(tmp, " \t");
                                        if (!tmp.empty()) {
                                                keys.push_back(pair<string,string>(tmp,string()));
                                        }
index f4a5f41bb8582c72e33f1d4982cd93acb33af7a5..0cdc98d2b51f22a8d6e6bffb79be3d30ff498725 100644 (file)
@@ -172,7 +172,7 @@ string const getNatbibLabel(Buffer const * buffer,
                        label += year + sep_str;
                }
        }
-       label = strip(strip(label), sep);
+       label = rtrim(rtrim(label), sep);
 
        if (!after_str.empty()) {
                if (cite_type == "citet") {
@@ -207,10 +207,10 @@ string const getBasicLabel(string const & keyList, string const & after)
 
        if (contains(keys, ",")) {
                // Final comma allows while loop to cover all keys
-               keys = frontStrip(split(keys, label, ',')) + ",";
+               keys = ltrim(split(keys, label, ',')) + ",";
                while (contains(keys, ",")) {
                        string key;
-                       keys = frontStrip(split(keys, key, ','));
+                       keys = ltrim(split(keys, key, ','));
                        label += ", " + key;
                }
        } else
index 0d7d406164d9d1aa34c258165252dc6e482416bd..67a5bd0e536210836a6f6291e3896d5fce798908 100644 (file)
@@ -157,7 +157,7 @@ private:
 InsetGraphics::Cache::Cache(InsetGraphics & p)
        : old_ascent(0), checksum(0), parent_(p)
 {
-       loader.connect(boost::bind(&InsetGraphics::statusChanged, &parent_));
+       loader.connect(boost::bind(&InsetGraphics::statusChanged, &parent_));
 }
 
 
@@ -550,7 +550,7 @@ string const InsetGraphics::createLatexOptions() const
        // before writing it to the output stream.
        ostringstream options;
        if (!params().bb.empty())
-           options << "  bb=" << strip(params().bb) << ",\n";
+           options << "  bb=" << rtrim(params().bb) << ",\n";
        if (params().draft)
            options << "  draft,\n";
        if (params().clip)
@@ -644,7 +644,7 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
        unsigned long const new_checksum = cache_->loader.checksum();
        bool const file_has_changed = cache_->checksum != new_checksum;
        if (file_has_changed)
-               cache_->checksum = new_checksum;
+               cache_->checksum = new_checksum;
 
        // temp_file will contain the file for LaTeX to act on if, for example,
        // we move it to a temp dir or uncompress it.
index 9c0167f39fd85a4c1638d756a37c4003b1ca8962..5ce9b705c3c39041de87a96e72fb09135ddaa6b9 100644 (file)
@@ -46,7 +46,7 @@ void InsetLabel::edit(BufferView * bv, int, int, mouse_button::state)
 {
        pair<bool, string> result = Alert::askForText(_("Enter label:"), getContents());
        if (result.first) {
-               string new_contents = frontStrip(strip(result.second));
+               string new_contents = trim(result.second);
                if (!new_contents.empty() &&
                    getContents() != new_contents) {
                        bv->buffer()->markDirty();
index fdbafa4cb79d616ab29b6cb3336a25f088e3e661..2034364e549740fd255e1ee5ca9680d39606e66d 100644 (file)
@@ -55,7 +55,7 @@ void InsetLatexAccent::checkContents()
 
        // REMOVE IN 0.13
        // Dirty Hack for backward compability. remove in 0.13 (Lgb)
-       contents = frontStrip(strip(contents));
+       contents = trim(contents);
        if (!contains(contents, "{") && !contains(contents, "}")) {
                if (contents.length() == 2) {
                        string tmp;
@@ -274,7 +274,7 @@ int InsetLatexAccent::ascent(BufferView *, LyXFont const & font) const
                        max = font_metrics::ascent('a', font);
                else
                        max = font_metrics::ascent(ic, font);
-               if (plusasc) 
+               if (plusasc)
                        max += (font_metrics::maxAscent(font) + 3) / 3;
        } else
                max = font_metrics::maxAscent(font) + 4;
@@ -286,12 +286,12 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
 {
        int max;
        if (candisp) {
-               if (ic == ' ') 
+               if (ic == ' ')
                        max = font_metrics::descent('a', font);
-                else
-                       max = font_metrics::descent(ic, font);
-                if (plusdesc)
-                       max += 3;
+               else
+               max = font_metrics::descent(ic, font);
+               if (plusdesc)
+               max += 3;
        } else
                max = font_metrics::maxDescent(font) + 4;
        return max;
@@ -302,8 +302,8 @@ int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
 {
        if (candisp)
                return font_metrics::width(ic, font);
-        else
-                return font_metrics::width(contents, font) + 4;
+       else
+               return font_metrics::width(contents, font) + 4;
 }
 
 
@@ -430,7 +430,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                // now the rest - draw within (x, y, x+wid, y+hg)
                switch (modtype) {
                case ACUTE:     // acute 0xB4
-               {
+               {
                        pain.text(int(x2 - (font_metrics::rbearing(0xB4, font) - font_metrics::lbearing(0xB4, font)) / 2),
                                  baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xB4, font) - (font_metrics::ascent(0xB4, font) + font_metrics::descent(0xB4, font)) / 2,
                                  char(0xB4), font);
index b060e919019d5065bdb5adbcac19c17b1c2e5d6a..4dd2f920803a1df1cb80faf6764a416dacebe43a 100644 (file)
@@ -77,7 +77,7 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents,
                font.setLanguage(default_language);
 
        lyx::pos_type pos = 0;
-       buf->insertStringAsLines(par, pos, font, strip(contents, "\n"));
+       buf->insertStringAsLines(par, pos, font, rtrim(contents, "\n"));
 }
 
 
index 86c2c3bd917784a6a6acd3f0ed53ce5c18cbe0a5..3c43db7997116a2d2e3cbf83ad3230d3ad6900f7 100644 (file)
@@ -1803,7 +1803,7 @@ bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
                return false;
 
        string const val =
-               frontStrip(what.substr(tabularFeature[i].feature.length()));
+               ltrim(what.substr(tabularFeature[i].feature.length()));
        tabularFeatures(bv, action, val);
        return true;
 }
@@ -2325,7 +2325,7 @@ FuncStatus InsetTabular::getStatus(string const & what) const
                return status.unknown(true);
        }
 
-       string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
+       string const argument = ltrim(what.substr(tabularFeature[i].feature.length()));
 
        int sel_row_start;
        int sel_row_end;
@@ -2768,7 +2768,7 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
                        updateLocal(bv, FULL, false);
                        return true;
                }
-       } 
+       }
        return false;
 }
 
index ba68ea63236e3b4dba45d610ac8aea905921d41d..840f859582fd97aad2bb9c6ec134fee4b73bd9a4 100644 (file)
@@ -466,7 +466,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
                pair<bool, string> result =
                        Alert::askForText(_("Enter new label to insert:"), text);
                if (result.first) {
-                       label = frontStrip(strip(result.second));
+                       label = trim(result.second);
                }
        }
        if (!label.empty()) {
index b5153747686ef350d9a48c6377d4e0d976953444..47c2fdd300b76299353976664fb48b801b6db289 100644 (file)
@@ -678,7 +678,7 @@ void LyX::readUIFile(string const & name)
                        break;
 
                default:
-                       if (!strip(lex.getString()).empty())
+                       if (!rtrim(lex.getString()).empty())
                                lex.printError("LyX::ReadUIFile: "
                                               "Unknown menu tag: `$$Token'");
                        break;
index 0b9f38adb8da7375c582af25972b91a9c7512765..1445dc13cfc36c7b91ba2f20763f3ffe142e4a27 100644 (file)
@@ -26,7 +26,7 @@ class LastFiles;
 class Buffer;
 class kb_keymap;
 
+
 ///
 extern string user_lyxdir;
 ///
@@ -35,7 +35,7 @@ extern string system_lyxdir;
 extern string system_tempdir;
 ///
 extern boost::scoped_ptr<LastFiles> lastfiles;
+
 
 class LyX : boost::noncopyable {
 public:
index e684207226f8ceb97ab1222222ed14f6a3ac2c02..1d93bac55086a5816c9e9bbc768ece4fe4bcb9a8 100644 (file)
@@ -571,7 +571,7 @@ string const LyXFont::stateText(BufferParams * params) const
                ost << _("  Number ") << _(GUIMiscNames[number()]);
 
        string buf(ost.str().c_str());
-       buf = strip(buf, ", ");
+       buf = rtrim(buf, ", ");
        return buf;
 }
 
index 9856b6331ae1736ce427c817d1cb7578356cbce1..32d597631b48187317c0f43862cb0830bf9dc193 100644 (file)
@@ -1569,7 +1569,7 @@ void LyXFunc::sendDispatchMessage(string const & msg, kb_action action, string c
        }
 
        if (!comname.empty()) {
-               comname = strip(comname);
+               comname = rtrim(comname);
                dispatch_msg += "(" + comname + ')';
        }
 
index 2e8e8e32f1b510245e37236b1adfa1e5eb88d3dc..e9c8beb0c44c5cb12cfa510048e9025fd0d8afe9 100644 (file)
@@ -161,7 +161,7 @@ string const LyXLex::getLongString(string const & endtoken)
                        // blank line in the file being read
                        continue;
 
-               string const token = frontStrip(strip(getString()), " \t");
+               string const token = trim(getString(), " \t");
 
                lyxerr[Debug::PARSER] << "LongString: `"
                                      << getString() << '\'' << endl;
@@ -186,7 +186,7 @@ string const LyXLex::getLongString(string const & endtoken)
                            && prefixIs(tmpstr, prefix)) {
                                tmpstr.erase(0, prefix.length() - 1);
                        }
-                       str += frontStrip(tmpstr, "\t") + '\n';
+                       str += ltrim(tmpstr, "\t") + '\n';
                }
                else // token == endtoken
                        break;
@@ -240,9 +240,9 @@ int LyXLex::findToken(char const * str[])
                pimpl_->printError("file ended while scanning string token");
                return -1;
        }
+
        int i = 0;
-   
+
        if (compare(pimpl_->buff, "default")) {
                while (str[i][0] && compare(str[i], pimpl_->buff)) {
                        ++i;
@@ -252,6 +252,6 @@ int LyXLex::findToken(char const * str[])
                        i = -1;
                }
        }
+
        return i;
 }
index ed4948919c41247394ac240a9b01fd0a17f78949..e9692fd6f48e02ba44862c674a994fe8d40075ff 100644 (file)
@@ -270,7 +270,7 @@ void LyXComm::read_ready()
        while ((status = read(infd, charbuf, CMDBUFLEN-1))) {
                if (status > 0) {
                        charbuf[status]= '\0'; // turn it into a c string
-                       lsbuf += strip(charbuf, "\r");
+                       lsbuf += rtrim(charbuf, "\r");
                        // commit any commands read
                        while (lsbuf.find('\n') != string::npos) {
                                // split() grabs the entire string if
index 271c9dd3cce6acf1458d7862b2c04b1bf1e6e2a8..a86ef7e28dd5b58ca5dfed66838d95d36416b3bf 100644 (file)
@@ -253,7 +253,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
 
                case TC_PAGESTYLE:
                        lexrc.next();
-                       pagestyle_ = strip(lexrc.getString());
+                       pagestyle_ = rtrim(lexrc.getString());
                        break;
 
                case TC_DEFAULTFONT:
@@ -476,11 +476,11 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc)
                switch (static_cast<ClassOptionsTags>(le)) {
                case CO_FONTSIZE:
                        lexrc.next();
-                       opt_fontsize_ = strip(lexrc.getString());
+                       opt_fontsize_ = rtrim(lexrc.getString());
                        break;
                case CO_PAGESTYLE:
                        lexrc.next();
-                       opt_pagestyle_ = strip(lexrc.getString());
+                       opt_pagestyle_ = rtrim(lexrc.getString());
                        break;
                case CO_OTHER:
                        lexrc.next();
index 671a420d53612e73f1541603fa25f73cb20bccef..62e93fc72412f4ff652b66c5229e70be4ccc65e8 100644 (file)
@@ -1,3 +1,7 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * formula.C (localDispatch): strip,frontStrip -> trim,ltrim,rtrim
+
 2002-07-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * math_nestinset.C: add using std::vector
index 8f6ee33d0f50fd1661b13ff6c7d8b163138a1b24..06960cfa1e45da04724d88a2863c50a630ffd74c 100644 (file)
@@ -326,7 +326,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                                        : Alert::askForText(_("Enter label:"), old_label);
                                if (!res.first)
                                        break;
-                               new_label = frontStrip(strip(res.second));
+                               new_label = trim(res.second);
                        }
 
                        //if (new_label == old_label)
@@ -451,8 +451,8 @@ int InsetFormula::descent(BufferView *, LyXFont const &) const
        if (!preview_->usePreview())
                return 1 + par_->descent();
 
-       int const descent = preview_->pimage_->descent();
-       return display() ? descent + 12 : descent;
+       int const descent = preview_->pimage_->descent();
+       return display() ? descent + 12 : descent;
 }
 
 
index 6be371e6d36afb69a683205111100a59993254cc..49583a8153cb44233325e550803a9122ee9d1b1f 100644 (file)
@@ -348,9 +348,9 @@ void InsetFormulaBase::insetButtonPress(BufferView * bv,
                        //delete mathcursor;
                        return;
                }
-       
+
        }
-       if (button == mouse_button::button3) { 
+       if (button == mouse_button::button3) {
                if (mathcursor->dispatch("mouse-3-press")) {
                        //delete mathcursor;
                        return;
@@ -366,11 +366,11 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv,
        if (!mathcursor)
                return;
 
-       if (button == mouse_button::button1) 
+       if (button == mouse_button::button1)
                if (mathcursor->dispatch("mouse-1-motion"))
                        return;
 
-       if (button == mouse_button::button3) 
+       if (button == mouse_button::button3)
                if (mathcursor->dispatch("mouse-3-motion"))
                        return;
 
@@ -460,7 +460,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_ENDSEL:
                sel = true; // fall through
        case LFUN_END:
-               result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT; 
+               result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
                updateLocal(bv, false);
                break;
 
index b7c66d5d37cdcddd93055e418cf94332b3725438..4b3a10a8de0f32a615dc12834170be33d00ff02a 100644 (file)
@@ -80,7 +80,7 @@ MathCursor::~MathCursor()
   // ensure that 'notifyCursorLeave' is called
   while (popLeft())
     ;
-}   
+}
 
 
 void MathCursor::push(MathAtom & t)
index c499c11ed3922c8e4457ba61e1977297cafc993a..f16bdcd5e8386139c37d3c56bec84dfbe674abda 100644 (file)
@@ -1,3 +1,15 @@
+2002-07-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lstrings.[hC]: rename stip to rtrim and frontStrip to ltrim,
+       also add a trim function that is the equiv of
+       strip(frontStrip(...)), also reimplement the functions
+       (improvements still possible.)
+       
+       * filetools.C: strip,frontStrip -> trim,ltrim,rtrim
+       * forkedcall.C (generateChild): ditto
+       * lstrings.C: ditto
+
+
 2002-07-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * filetools.C (GetEnvPath): modify because of strip changes
@@ -10,7 +22,7 @@
        (isStrDbl): ditto
        (contains): removed unneeded version of contains
        (containsOnly): removed uneeded versions of containsOnly
-       (strip, frontStrip): removed unneded versions, changed argument types. 
+       (strip, frontStrip): removed unneded versions, changed argument types.
 
 2002-07-22  Dekel Tsur  <dekelts@tau.ac.il>
 
index 1a8fc1636308ba04f6523b2168b1bc25f5632b56..82e9ce635cfd69981b38d8d7617db24bbd2e2f5f 100644 (file)
@@ -364,7 +364,7 @@ string const GetEnvPath(string const & name)
 #else
        string const pathlist = os::slashify_path(GetEnv(name));
 #endif
-       return strip(pathlist, ";");
+       return rtrim(pathlist, ";");
 }
 
 
@@ -564,7 +564,7 @@ int DestroyLyXTmpDir(string const & tmpdir)
 // Creates directory. Returns true if succesfull
 bool createDirectory(string const & path, int permission)
 {
-       string temp(strip(os::slashify_path(path), "/"));
+       string temp(rtrim(os::slashify_path(path), "/"));
 
        if (temp.empty()) {
                Alert::alert(_("Internal error!"),
@@ -1352,10 +1352,10 @@ string const findtexfile(string const & fil, string const & /*format*/)
        cmd_ret const c = RunCommand(kpsecmd);
 
        lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
-                << "kpse result = `" << strip(c.second, "\n")
+                << "kpse result = `" << rtrim(c.second, "\n")
                 << "'" << endl;
        if (c.first != -1)
-               return os::internal_path(strip(strip(c.second, "\n"), "\r"));
+               return os::internal_path(rtrim(c.second, "\n\r"));
        else
                return string();
 }
@@ -1410,7 +1410,7 @@ string const readBB_from_PSFile(string const & file)
                string s;
                getline(is,s);
                if (contains(s,"%%BoundingBox:") && !contains(s,"atend")) {
-                       string const bb = frontStrip(s.substr(14));
+                       string const bb = ltrim(s.substr(14));
                        readBB_lyxerrMessage(file_, zipped, bb);
                        return bb;
                }
index 8847ce7122df7c4d74241237d2d518cb707701a9..912b13e855737e79874d39e4ca88f689f2479788 100644 (file)
@@ -230,7 +230,7 @@ pid_t Forkedcall::generateChild()
 
        int  index = 0;
        while (more) {
-               childcommand = frontStrip(childcommand);
+               childcommand = ltrim(childcommand);
                if (syscmd == 0) {
                        syscmd = new char[childcommand.length() + 1];
                        childcommand.copy(syscmd, childcommand.length());
index 71efb395598c269f599cecd5fe8be33442a2ff19..15ff13f37b386e3e75f90d68888fc0ccf0a25e9c 100644 (file)
@@ -120,7 +120,7 @@ bool isStrInt(string const & str)
        if (str.empty()) return false;
 
        // Remove leading and trailing white space chars.
-       string const tmpstr = frontStrip(strip(str));
+       string const tmpstr = trim(str);
        if (tmpstr.empty()) return false;
 
        string::const_iterator cit = tmpstr.begin();
@@ -138,7 +138,7 @@ bool isStrUnsignedInt(string const & str)
        if (str.empty()) return false;
 
        // Remove leading and trailing white space chars.
-       string const tmpstr = frontStrip(strip(str));
+       string const tmpstr = trim(str);
        if (tmpstr.empty()) return false;
 
        string::const_iterator cit = tmpstr.begin();
@@ -154,7 +154,7 @@ int strToInt(string const & str)
 {
        if (isStrInt(str)) {
                // Remove leading and trailing white space chars.
-               string const tmpstr = frontStrip(strip(str));
+               string const tmpstr = trim(str);
                // Do the conversion proper.
                return lyx::atoi(tmpstr);
        } else {
@@ -167,7 +167,7 @@ unsigned int strToUnsignedInt(string const & str)
 {
        if (isStrUnsignedInt(str)) {
                // Remove leading and trailing white space chars.
-               string const tmpstr = frontStrip(strip(str));
+               string const tmpstr = trim(str);
                // Do the conversion proper.
                return lyx::atoi(tmpstr);
        } else {
@@ -181,7 +181,7 @@ bool isStrDbl(string const & str)
        if (str.empty()) return false;
 
        // Remove leading and trailing white space chars.
-       string const tmpstr = frontStrip(strip(str));
+       string const tmpstr = trim(str);
        if (tmpstr.empty()) return false;
        //      if (1 < tmpstr.count('.')) return false;
 
@@ -210,7 +210,7 @@ double strToDbl(string const & str)
 {
        if (isStrDbl(str)) {
                // Remove leading and trailing white space chars.
-               string const tmpstr = frontStrip(strip(str));
+               string const tmpstr = trim(str);
                // Do the conversion proper.
                return ::atof(tmpstr.c_str());
        } else {
@@ -494,40 +494,54 @@ string const subst(string const & a,
 }
 
 
-string const strip(string const & a, char const * p)
+string const trim(string const & a, char const * p)
 {
        lyx::Assert(p);
 
-       if (a.empty() || !*p) return a;
-       string tmp(a);
-       string::size_type i = tmp.find_last_not_of(p);
-       if (i == a.length() - 1) return tmp; // no c's at end of a
-       if (i != string::npos)
-               tmp.erase(i + 1, string::npos);
-#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
-       // Ok This code is now suspect... (Lgb)
-       /// Needed for broken string::find_last_not_of
-       else if (tmp[0] != p[0]) {
-               if (a.length() == 1) return tmp;
-               tmp.erase(1, string::npos);
-       }
-#endif
-       else
-               tmp.erase(); // only chars from p in the whole string
-       return tmp;
+       if (a.empty() || !*p)
+               return a;
+
+       string::size_type r = a.find_last_not_of(p);
+       string::size_type l = a.find_first_not_of(p);
+
+       // Is this the minimal test? (lgb)
+       if (r == string::npos && l == string::npos)
+               return string();
+
+       return a.substr(l, r - l + 1);
 }
 
 
-string const frontStrip(string const & a, char const * p)
+string const rtrim(string const & a, char const * p)
 {
        lyx::Assert(p);
 
-       if (a.empty() || !*p) return a;
-       string tmp(a);
-       string::size_type i = tmp.find_first_not_of(p);
-       if (i > 0)
-               tmp.erase(0, i);
-       return tmp;
+       if (a.empty() || !*p)
+               return a;
+
+       string::size_type r = a.find_last_not_of(p);
+
+       // Is this test really needed? (Lgb)
+       if (r == string::npos)
+               return string();
+
+       return a.substr(0, r + 1);
+}
+
+
+string const ltrim(string const & a, char const * p)
+{
+       lyx::Assert(p);
+
+       if (a.empty() || !*p)
+               return a;
+
+       string::size_type l = a.find_first_not_of(p);
+
+       if (l == string::npos)
+               return string();
+
+       return a.substr(l, string::npos);
 }
 
 
@@ -603,14 +617,14 @@ vector<string> const getVectorFromString(string const & str,
     vector<string> vec;
     if (str.empty())
        return vec;
-    string keys(strip(str));
+    string keys(rtrim(str));
     for(;;) {
        string::size_type const idx = keys.find(delim);
        if (idx == string::npos) {
-           vec.push_back(frontStrip(keys));
+           vec.push_back(ltrim(keys));
            break;
        }
-       string const key = strip(frontStrip(keys.substr(0, idx)));
+       string const key = trim(keys.substr(0, idx));
        if (!key.empty())
            vec.push_back(key);
        string::size_type const start = idx + delim.size();
@@ -627,7 +641,7 @@ string const getStringFromVector(vector<string> const & vec,
        int i = 0;
        for (vector<string>::const_iterator it = vec.begin();
             it != vec.end(); ++it) {
-               string item = strip(frontStrip(*it));
+               string item = trim(*it);
                if (item.empty()) continue;
 
                if (i++ > 0) str += delim;
index f47d592c83ab8fb9245b88355bce27c1ed75662f..8bcee0ae2389bde9df13b68d24963ce1ce06e789 100644 (file)
@@ -192,19 +192,26 @@ string const subst(string const & a,
 string const subst(string const & a,
                   string const & oldstr, string const & newstr);
 
-/** Strips characters off the end of a string.
+/** Trims characters off the end and beginning of a string.
     \code
-    strip("abccc", "c") == "ab".
+    trim("ccabccc", "c") == "ab".
     \endcode
 */
-string const strip(string const & a, char const * p = " ");
+string const trim(string const & a, char const * p = " ");
 
-/** Strips characters off the beginning of a string.
+/** Trims characters off the end of a string.
     \code
-    frontstrip("ababcdef", "ab") = "cdef"
+    rtrim("abccc", "c") == "ab".
     \endcode
 */
-string const frontStrip(string const & a, char const * p = " ");
+string const rtrim(string const & a, char const * p = " ");
+
+/** Trims characters off the beginning of a string.
+    \code
+   ltrim("ababcdef", "ab") = "cdef"
+    \endcode
+*/
+string const ltrim(string const & a, char const * p = " ");
 
 /** Splits the string by the first delim.
     Splits the string by the first appearance of delim.
index c6652f3029b6e14774304da08e28e3b3a14953c8..c20ac65f054dd7d5091678c969dc3939fbdbfdc5 100644 (file)
@@ -472,7 +472,7 @@ bool LyXTabular::LeftLine(int cell, bool onlycolumn) const
 #ifdef SPECIAL_COLUM_HANDLING
                if (cellinfo_of_cell(cell)->align_special.empty())
                        return cellinfo_of_cell(cell)->left_line;
-               return prefixIs(frontStrip(cellinfo_of_cell(cell)->align_special), "|");
+               return prefixIs(ltrim(cellinfo_of_cell(cell)->align_special), "|");
 #else
                return cellinfo_of_cell(cell)->left_line;
 #endif
@@ -480,7 +480,7 @@ bool LyXTabular::LeftLine(int cell, bool onlycolumn) const
 #ifdef SPECIAL_COLUM_HANDLING
        if (column_info[column_of_cell(cell)].align_special.empty())
                return column_info[column_of_cell(cell)].left_line;
-       return prefixIs(frontStrip(column_info[column_of_cell(cell)].align_special), "|");
+       return prefixIs(ltrim(column_info[column_of_cell(cell)].align_special), "|");
 #else
        return column_info[column_of_cell(cell)].left_line;
 #endif
@@ -495,7 +495,7 @@ bool LyXTabular::RightLine(int cell, bool onlycolumn) const
 #ifdef SPECIAL_COLUM_HANDLING
                if (cellinfo_of_cell(cell)->align_special.empty())
                        return cellinfo_of_cell(cell)->right_line;
-               return suffixIs(strip(cellinfo_of_cell(cell)->align_special), "|");
+               return suffixIs(rtrim(cellinfo_of_cell(cell)->align_special), "|");
 #else
                return cellinfo_of_cell(cell)->right_line;
 #endif
@@ -503,7 +503,7 @@ bool LyXTabular::RightLine(int cell, bool onlycolumn) const
 #ifdef SPECIAL_COLUM_HANDLING
        if (column_info[column_of_cell(cell)].align_special.empty())
                return column_info[right_column_of_cell(cell)].right_line;
-       return suffixIs(strip(column_info[column_of_cell(cell)].align_special), "|");
+       return suffixIs(rtrim(column_info[column_of_cell(cell)].align_special), "|");
 #else
        return column_info[right_column_of_cell(cell)].right_line;
 #endif
index 7a307b0565b4d144a827cd86b1dda98e451ee771..8c8c92dbca4efc379938d20630f461478f6c63e5 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -44,7 +44,7 @@ string const TocItem::asString() const
        return string(4 * depth, ' ') + str;
 }
 
-       
+
 void TocItem::goTo(LyXView & lv_) const
 {
        string const tmp = tostr(par->id());
@@ -92,7 +92,7 @@ TocList const getTocList(Buffer const * buf)
                                           par->asString(buf, true));
                        toclist["TOC"].push_back(item);
                }
-               
+
                // For each paragraph, traverse its insets and look for
                // FLOAT_CODE
                Paragraph::inset_iterator it = par->inset_iterator_begin();
@@ -101,9 +101,9 @@ TocList const getTocList(Buffer const * buf)
                        if ((*it)->lyxCode() == Inset::FLOAT_CODE) {
                                InsetFloat * il =
                                        static_cast<InsetFloat*>(*it);
-                               il->addToToc(toclist, buf);             
+                               il->addToToc(toclist, buf);
                        }
-               } 
+               }
 
                par = par->next();
        }
@@ -142,4 +142,3 @@ void asciiTocList(string const & type, Buffer const * buffer, ostream & os)
 
 
 } // namespace toc
-
index a998ac85c4c81eeb1a6b2855511ebccbe222edfd..429014c026fcd464919ea780f5a459338b21eba7 100644 (file)
@@ -107,7 +107,7 @@ void RCS::scanMaster()
                        // get version here
                        string tmv;
                        ifs >> tmv;
-                       tmv = strip(tmv, ";");
+                       tmv = rtrim(tmv, ";");
                        version_ = tmv;
                        lyxerr[Debug::LYXVC] << "LyXVC: version found to be "
                                             << tmv << endl;
@@ -127,7 +127,7 @@ void RCS::scanMaster()
                        string s2;
                        do {
                                ifs >> tmpt;
-                               s1 = strip(tmpt, ";");
+                               s1 = rtrim(tmpt, ";");
                                // tmp is now in the format <user>:<version>
                                s1 = split(s1, s2, ':');
                                // s2 is user, and s1 is version
@@ -265,7 +265,7 @@ void CVS::scanMaster()
                        FileInfo fi(file_);
                        // FIXME: must double check file is stattable/existing
                        time_t mod = fi.getModificationTime();
-                       string mod_date = strip(asctime(gmtime(&mod)), "\n");
+                       string mod_date = rtrim(asctime(gmtime(&mod)), "\n");
                        lyxerr[Debug::LYXVC]
                                <<  "Date in Entries: `" << file_date
                                << "'\nModification date of file: `"
index 18772db249f60ddd00b40ff97ef4997cd63c1464..1444aa7de8da6f120a0044ced3f0e3a1c919e89d 100644 (file)
@@ -55,7 +55,7 @@ void lyx_advance(string & data, string::size_type n)
 inline
 bool isEndOfData(string const & data)
 {
-       return frontStrip(data).empty();
+       return ltrim(data).empty();
 }
 
 /**
@@ -72,7 +72,7 @@ bool isEndOfData(string const & data)
  */
 char nextToken(string & data)
 {
-       data = frontStrip(data);
+       data = ltrim(data);
        if (data.empty())
                return '\0';
        else if (data[0] == '+') {
@@ -202,7 +202,7 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result)
 
        if (data.empty())
                return true;
-       string buffer = frontStrip(data);
+       string buffer = ltrim(data);
 
        // To make isValidGlueLength recognize negative values as
        // the first number this little hack is needed:
@@ -346,7 +346,7 @@ VSpace::VSpace(string const & data)
        if (data.empty())
                return;
        double value;
-       string input  = strip(data);
+       string input  = rtrim(data);
 
        string::size_type const length = input.length();