]> git.lyx.org Git - lyx.git/commitdiff
Add string << operators for the other streams as well, and removes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 5 Dec 2001 08:04:20 +0000 (08:04 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 5 Dec 2001 08:04:20 +0000 (08:04 +0000)
c_str() all places where it is not needed anymore.
(I also add config.h to several files that was missing it)
+ added s string constructor to math_symbolinset

I also change some "while(" to "while ("

mmm ... yes ... I add a "zero()" function to LyXLength... an "empty()"
function did not seem appropriate. changed a couple of places that
checked on length.value() != 0.0.

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

60 files changed:
Makefile.am
src/BufferView_pimpl.C
src/ChangeLog
src/CutAndPaste.C
src/DepTable.C
src/buffer.C
src/chset.C
src/frontends/gnome/ChangeLog
src/frontends/gnome/FormCitation.C
src/frontends/gnome/GUIRunTime.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/qttableview.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/xforms_helpers.C
src/insets/ChangeLog
src/insets/insetbib.C
src/insets/insettabular.C
src/insets/insettext.C
src/lastfiles.C
src/lyxgluelength.C
src/lyxlength.C
src/lyxlength.h
src/lyxlex.C
src/lyxlex_pimpl.C
src/lyxserver.C
src/mathed/ChangeLog
src/mathed/math_arrayinset.C
src/mathed/math_boxinset.C
src/mathed/math_decorationinset.C
src/mathed/math_deliminset.C
src/mathed/math_dotsinset.C
src/mathed/math_exfuncinset.C
src/mathed/math_exintinset.C
src/mathed/math_funcinset.C
src/mathed/math_funcliminset.C
src/mathed/math_gridinset.C
src/mathed/math_hullinset.C
src/mathed/math_kerninset.C
src/mathed/math_limitopinset.C
src/mathed/math_mathmlstream.C
src/mathed/math_sizeinset.C
src/mathed/math_streamstr.C
src/mathed/math_streamstr.h
src/mathed/math_stringinset.C
src/mathed/math_symbolinset.C
src/mathed/math_symbolinset.h
src/mathed/math_unknowninset.C
src/screen.C
src/support/ChangeLog
src/support/filetools.C
src/support/lstrings.C
src/support/lyxstring.C
src/tabular-old.C
src/tabular.C
src/text.C
src/trans_mgr.C
src/vc-backend.C
src/vspace.C

index 5f849c4c3f90c441073dc4afd3872362698d7ff3..c4fe33eb761a090a80a35272e4501e5bc075ec10 100644 (file)
@@ -59,7 +59,7 @@ doxydoc: sourcedoc/Doxyfile
 
 sourcedoc/Doxyfile: sourcedoc/Doxyfile.in config.status
        cd $(top_builddir) \
-         && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+       && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 lgbtags:
        etags --totals=yes --recurse=yes -o TAGS $(top_srcdir)/*
index f69d95cdb37aaaba4a9787c145891ef5167894fb..8593ebaa5ee5e2c0deb9c6e62a9b65c98b834f3e 100644 (file)
@@ -974,7 +974,7 @@ void BufferView::Pimpl::update()
                LyXText::text_status st = bv_->text->status();
                screen_->update(bv_->text, bv_);
                bool fitc = false;
-               while(bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
+               while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
                        if (bv_->text->fullRebreak(bv_)) {
                                st = LyXText::NEED_MORE_REFRESH;
                                bv_->text->setCursor(bv_, bv_->text->cursor.par(),
index a527ce79cfce709154672f5fb326cd81574c3a27..0d957c21868fd0d3bffc35e88fa4a4e88da7fec2 100644 (file)
@@ -1,3 +1,25 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * BufferView_pimpl:
+       * CutAndPaste.C: 
+       * DepTable.C:
+       * buffer.C:
+       * chset.C:
+       * lastfiles.C:
+       * lyxlex.C:
+       * lyxlex_pimpl.C:
+       * lyxserver.C:
+       * screen.C:
+       * tabular-old.C:
+       * tabular.C:
+       * text.C:
+       * trans_mgr.C:
+       * vc-backend.C: change "while(" to "while ("
+       
+       * lyxlength.[Ch]: add zero function to check if length is zero or
+       not
+       * lyxgluelength.C: use it
+       
 2001-12-05  Allan Rae  <rae@lyx.org>
 
        * lyxlength.C: Attempted a fix for the abs(int) header selection.
index ffae84eb459862a8d4df6649f28eb1b784b9fd09..f7117cb8e02827ed8f471a4ab1ef182ae24d7174 100644 (file)
@@ -141,7 +141,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
                }
                // this paragraph's are of noone's owner!
                Paragraph * p = buf;
-               while(p) {
+               while (p) {
                        p->setInsetOwner(0);
                        p = p->next();
                }
@@ -198,7 +198,7 @@ bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar,
                }
                // this paragraph's are of noone's owner!
                tmppar = buf;
-               while(tmppar) {
+               while (tmppar) {
                        tmppar->setInsetOwner(0);
                        tmppar = tmppar->next();
                }
@@ -329,7 +329,7 @@ int CutAndPaste::nrOfParagraphs()
        
        int n = 1;
        Paragraph * tmppar = buf;
-       while(tmppar->next()) {
+       while (tmppar->next()) {
                ++n;
                tmppar = tmppar->next();
        }
index e04b2cde5dc86c26d95f791976930934e446fdf8..b8abc816dce3ff46c38993b92153708cd42369e7 100644 (file)
@@ -189,7 +189,7 @@ void DepTable::read(string const & f)
        unsigned long two = 0;
        unsigned long mtime = 0;
        
-       while(ifs >> nome >> one >> two >> mtime) {
+       while (ifs >> nome >> one >> two >> mtime) {
                if (lyxerr.debugging(Debug::DEPEND)) {
                        lyxerr << "Read dep: "
                               << nome << " "
index fd042864410e98aed704a8533afbdcdf68b8f41e..4adf6db1a17259cfe6bd824992e0320bfe990130 100644 (file)
@@ -2890,7 +2890,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
                }
 
                list < PAR_TAG > temp;
-               while(!tag_state.empty() && tag_close ) {
+               while (!tag_state.empty() && tag_close ) {
                        PAR_TAG k =  tag_state.top();
                        tag_state.pop();
                        os << "</" << tag_name(k) << ">";
index a2a716191581d08b0d7ac35a9507985e274690be..277f7db184d66fe78ccf6f34e66f84c8f9b17e37 100644 (file)
@@ -44,7 +44,7 @@ bool CharacterSet::loadFile(string const & fname)
        // was a bit neat. Anyway it is wrong to use the lyxlex parse
        // without the use of a keyword table.     
        LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
-       while(getline(ifs, line)) {
+       while (getline(ifs, line)) {
                if (reg.exact_match(line)) {
                        LRegex::SubMatches const & sub = reg.exec(line);
                        int const n = lyx::atoi(line.substr(sub[1].first,
index dd1e5058f0158ec83329d446a28a0f54938f7df8..e77d578aabd271974bd466bb172c645ce834248b 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * FormCitation.C:
+       * GUIRunTime.C: change "while(" to "while ("
+
 2001-09-27  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * Dialogs.C: remove splash dialog code.
index 62f2d2682780b52b2ad5c4b47d0be3f65a0344b4..cdfba62e53b877e74468678a65882408c7823cd3 100644 (file)
@@ -307,7 +307,7 @@ void FormCitation::initWidgets()
       vector<string> r;
       string tmp, keys( params.getContents() );
       keys = frontStrip( split(keys, tmp, ',') );
-      while( !tmp.empty() )
+      while ( !tmp.empty() )
        {
          r.clear();
          r.push_back(tmp);
index 1703caca1810ad8a80a92eef55815fb1e2e5213c..454f0c0a3af702796d9f2889ca5cb81ede4b6777 100644 (file)
@@ -83,7 +83,7 @@ int GUIRunTime::initApplication(int &, char * argv[])
 
 void GUIRunTime::processEvents() 
 {
-       while(Gnome::Main::instance()->events_pending())
+       while (Gnome::Main::instance()->events_pending())
                Gnome::Main::instance()->iteration(FALSE);
 }
 
index 882d92a465d03819df9a3483e1a98620bd08a84d..b1ffba3e38f61a4581928c847d660b24e573e855 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * qttableview.C: change "while(" to "while (" 
+
 2001-12-05  Allan Rae  <rae@lyx.org>
 
        * QParagraph.C (apply): 
index c26bd5181dfe0584c6348e05d05e60d10a74f2f3..6251f4b1b94da9095b85a26863d2e754c3263e0c 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
-** $Id: qttableview.C,v 1.1 2001/12/01 02:24:27 levon Exp $
+** $Id: qttableview.C,v 1.2 2001/12/05 08:04:18 larsbj Exp $
 **
 ** Implementation of QtTableView class
 **
@@ -1306,7 +1306,8 @@ void QtTableView::paintEvent( QPaintEvent *e )
 
     int firstRow = findRow( updateR.y() );
     int firstCol = findCol( updateR.x() );
-    int         xStart, yStart;
+    int        xStart;
+    int yStart;
     if ( !colXPos( firstCol, &xStart ) || !rowYPos( firstRow, &yStart ) ) {
        paint.eraseRect( updateR ); // erase area outside cells but in view
        return;
@@ -1316,7 +1317,7 @@ void QtTableView::paintEvent( QPaintEvent *e )
     int          row   = firstRow;
     int          col;
     int          yPos  = yStart;
-    int          xPos = maxX+1; // in case the while() is empty
+    int          xPos = maxX + 1; // in case the while() is empty
     int          nextX;
     int          nextY;
     QRect winR = viewRect();
@@ -2102,7 +2103,7 @@ int QtTableView::maxXOffset()
                int pos = tw;
                int nextCol = nCols - 1;
                int nextCellWidth = cellWidth( nextCol );
-               while( nextCol > 0 && pos > goal + nextCellWidth ) {
+               while ( nextCol > 0 && pos > goal + nextCellWidth ) {
                    pos -= nextCellWidth;
                    nextCellWidth = cellWidth( --nextCol );
                }
@@ -2148,7 +2149,7 @@ int QtTableView::maxYOffset()
                int pos = th;
                int nextRow = nRows - 1;
                int nextCellHeight = cellHeight( nextRow );
-               while( nextRow > 0 && pos > goal + nextCellHeight ) {
+               while ( nextRow > 0 && pos > goal + nextCellHeight ) {
                    pos -= nextCellHeight;
                    nextCellHeight = cellHeight( --nextRow );
                }
index 3d66ddf16c413614262d0f0fc7c544151029a124..2a3078a0d34fc619b1c33f770b942ca7198aac28 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * FormFiledialog.C:
+       * xforms_helpers.C: change "while(" to "while ("
+
 2001-12-05  Allan Rae  <rae@lyx.org>
 
        * FormParagraph.C (apply): One other LyXText fix.
index 70a3094fcf127e56b2d6fc622ff58a268db6e99a..dac125c7094bf9f86eafdf32828c21e288e15568 100644 (file)
@@ -510,7 +510,7 @@ bool FileDialog::Private::RunDialog()
        force_ok = false;
        
         // event loop
-        while(true) {
+        while (true) {
                 FL_OBJECT * pObject = fl_do_forms();
 
                 if (pObject == pFileDlgForm->Ready) {
index 4c051dfedbd07b5d121c1afce35bca56db99a923..bcda679ca78a23ec50f37a7fb4aa45cf22d54afc 100644 (file)
@@ -75,9 +75,9 @@ void FormMinipage::apply()
 
 void FormMinipage::update()
 {
-    LyXLength len(controller().params().width.c_str());
-    fl_set_input(dialog_->input_width,tostr(len.value()).c_str());
-    fl_set_choice(dialog_->choice_width_units, len.unit()+1);
+    LyXLength len(controller().params().width);
+    fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
+    fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
 
     switch (controller().params().pos) {
     case InsetMinipage::top:
index 03f34eeae5f480d3ffac02418e1d8702c5e718ea..9e1373e08ca72fdf0cd68da3258d7158fa1a22d1 100644 (file)
@@ -29,7 +29,7 @@ char const * flyx_shortcut_extract(char const * sc)
 {
        // Find '|' in the sc and return the string after that.
        register char const * sd = sc;
-       while(sd[0]!= 0 && sd[0] != '|') ++sd;
+       while (sd[0]!= 0 && sd[0] != '|') ++sd;
 
        if (sd[0] == '|') {
                ++sd;
@@ -44,7 +44,7 @@ char const * flyx_shortcut_extract(char const * sc)
 char const * flyx_ident_extract(char const * sc)
 {
        register char const * se = sc;
-       while(se[0]!= 0 && se[0] != '|') ++se;
+       while (se[0]!= 0 && se[0] != '|') ++se;
 
        if (se[0] == 0) return sc;
        
index 9d6bd983fa38386bab40eb90c0d654ef0df8aa21..a6ee9e403829cbbbaaed3ce22a3edd3dfb11fa0d 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetbib.C:
+       * insettabular.C:
+       * insettext.C: change "while(" to "while ("
+
 2001-12-04  Juergen Vigna  <jug@sad.it>
 
        * insetert.C (edit): handle Inlined status.
index 34cb2b53f941d3af4cddda0792a40dea923e3cfb..d2a101014089c63218b2eebf9df96dd4681f4809 100644 (file)
@@ -193,7 +193,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
        // If we generate in a temp dir, we might need to give an
        // absolute path there. This is a bit complicated since we can
        // have a comma-separated list of bibliographies
-       while(!adb.empty()) {
+       while (!adb.empty()) {
                if (!buffer->niceFile &&
                    IsFileReadable(MakeAbsPath(adb, buffer->filepath)+".bib")) 
                          adb = os::external_path(MakeAbsPath(adb, buffer->filepath));
@@ -217,7 +217,7 @@ vector<string> const InsetBibtex::getFiles(Buffer const &) const
        string tmp;
        string bibfiles = getContents();
        bibfiles = split(bibfiles, tmp, ',');
-       while(!tmp.empty()) {
+       while (!tmp.empty()) {
                string file = findtexfile(ChangeExtension(tmp, "bib"), "bib");
                lyxerr[Debug::LATEX] << "Bibfile: " << file << endl;
 
index f5d9da98786319c8238bbe003e8d2d8a613b1efe..e84bdda0e93766c1b9f21574b861597aa843e517 100644 (file)
@@ -1056,7 +1056,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                        string::size_type len = clip.length();
                        string::size_type p = 0;
 
-                       while(p < len &&
+                       while (p < len &&
                              ((p = clip.find_first_of("\t\n", p)) != string::npos)) {
                                switch(clip[p]) {
                                case '\t':
@@ -1078,7 +1078,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                        int cell = 0;
                        int cells = paste_tabular->GetNumberOfCells();
                        p = cols = 0;
-                       while((cell < cells) && (p < len) &&
+                       while ((cell < cells) && (p < len) &&
                              (p = clip.find_first_of("\t\n", p)) != string::npos) {
                                if (p >= len)
                                        break;
@@ -1090,7 +1090,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                                        break;
                                case '\n':
                                        paste_tabular->GetCellInset(cell)->setText(clip.substr(op, p-op));
-                                       while(cols++ < maxCols)
+                                       while (cols++ < maxCols)
                                                ++cell;
                                        cols = 0;
                                        break;
@@ -1331,7 +1331,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
        int ly = tabular->GetDescentOfRow(actrow);
 
        // first search the right row
-       while((ly < y) && ((actrow+1) < tabular->rows())) {
+       while ((ly < y) && ((actrow+1) < tabular->rows())) {
                cursor_.y(cursor_.y() + tabular->GetDescentOfRow(actrow) +
                                 tabular->GetAscentOfRow(actrow + 1) +
                                 tabular->GetAdditionalHeight(actrow + 1));
@@ -2369,7 +2369,7 @@ bool InsetTabular::copySelection(BufferView * bv)
        paste_tabular = new LyXTabular(this, *tabular); // rows, columns);
        for (int i = 0; i < sel_row_start; ++i)
                paste_tabular->DeleteRow(0);
-       while(paste_tabular->rows() > rows)
+       while (paste_tabular->rows() > rows)
                paste_tabular->DeleteRow(rows);
        paste_tabular->SetTopLine(0, true, true);
        paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows-1),
index 0a120b4b51e0bae36d88209ab86cdc5205bd1341..e10eea1b90a7cd30432da48bab626864e15ef364 100644 (file)
@@ -76,7 +76,7 @@ void InsetText::saveLyXTextState(LyXText * t) const
 {
        // check if my paragraphs are still valid
        Paragraph * p = par;
-       while(p) {
+       while (p) {
                if (p == t->cursor.par())
                        break;
                p = p->next();
@@ -169,7 +169,7 @@ void InsetText::init(InsetText const * ins, bool same_id)
                        id_ = ins->id_;
        } else {
                Paragraph * p = par;
-               while(p) {
+               while (p) {
                        p->setInsetOwner(this);
                        p = p->next();
                }
@@ -278,7 +278,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
        if (!return_par)
                return_par = par;
        par = return_par;
-       while(return_par) {
+       while (return_par) {
                return_par->setInsetOwner(this);
                return_par = return_par->next();
        }
@@ -720,7 +720,7 @@ void InsetText::edit(BufferView * bv, bool front)
                lt->setCursor(bv, par, 0);
        else {
                Paragraph * p = par;
-               while(p->next())
+               while (p->next())
                        p = p->next();
 //             int const pos = (p->size() ? p->size()-1 : p->size());
                lt->setCursor(bv, p, p->size());
@@ -2402,7 +2402,7 @@ Inset * InsetText::getInsetFromID(int id_arg) const
 
        Paragraph * lp = par;
 
-       while(lp) {
+       while (lp) {
                for (Paragraph::inset_iterator it = lp->inset_iterator_begin(),
                         en = lp->inset_iterator_end();
                         it != en; ++it)
index 5076e40a7f78259442de1dada48bad9be011a995..088a1d73e03e44929d857463307ff94a1d34321d 100644 (file)
@@ -55,7 +55,7 @@ void LastFiles::readFile(string const & filename)
        string tmp;
        FileInfo fileInfo;
 
-       while(getline(ifs, tmp) && files.size() < num_files) {
+       while (getline(ifs, tmp) && files.size() < num_files) {
                if (dostat) {
                        if (!(fileInfo.newFile(tmp).exist() &&
                              fileInfo.isRegular()))
index d876e7d3477dd61281963236a97d0802873f33d0..1342bbf7dbf8acbaae124b3505c3de8e3805f3e3 100644 (file)
 #endif
 
 #include "lyxgluelength.h"
+#include "lengthcommon.h"
 
 #include "Lsstream.h"
 
+#if 0
 namespace {
 // this is now here and in lyxlenght.h
 
@@ -30,7 +32,7 @@ char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
                                      "%",  "c%", "p%", "l%" };
 
 }
-
+#endif
 
 LyXGlueLength::LyXGlueLength(LyXLength const & len)
        : len_(len)
@@ -53,8 +55,8 @@ string const LyXGlueLength::asString() const
 {
        ostringstream buffer;
 
-       if (plus_.value() != 0.0)
-               if (minus_.value() != 0.0)
+       if (!plus_.zero())
+               if (!minus_.zero())
                        if (len_.unit() == plus_.unit() && len_.unit() == minus_.unit())
                                if (plus_.value() == minus_.value())
                                        buffer << len_.value() << "+-"
@@ -87,7 +89,7 @@ string const LyXGlueLength::asString() const
                                       << unit_name[plus_.unit()];
        
        else
-               if (minus_.value() != 0.0)
+               if (!minus_.zero())
                        if (len_.unit() == minus_.unit())
                                buffer << len_.value() << '-' << minus_.value()
                                       << unit_name[len_.unit()];
@@ -107,8 +109,8 @@ string const LyXGlueLength::asLatexString() const
 {
        ostringstream buffer;
 
-       if (plus_.value() != 0.0)
-               if (minus_.value() != 0.0)
+       if (!plus_.zero())
+               if (!minus_.zero())
                        buffer << len_.value() << unit_name[len_.unit()]
                               << " plus "
                               << plus_.value() << unit_name[plus_.unit()]
@@ -119,7 +121,7 @@ string const LyXGlueLength::asLatexString() const
                               << " plus "
                               << plus_.value() << unit_name[plus_.unit()];
        else
-               if (minus_.value() != 0.0)
+               if (!minus_.zero())
                        buffer << len_.value() << unit_name[len_.unit()]
                               << " minus "
                               << minus_.value() << unit_name[minus_.unit()];
index 7f26c6369b0e7e0bb76b7d4ade027cf4bacb79b1..de47765b932238ab903ad595036697c58ba19eac 100644 (file)
 #endif
 
 #include "lyxlength.h"
+#include "lengthcommon.h"
 
 #include "Lsstream.h"
 
-#if defined(__GNUG__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 95
 #include <cstdlib>
-#else
-#include <cmath>
-#endif
 
+#if 0
 namespace {
 // this is now here and in lyxgluelength.C
 
@@ -45,6 +43,7 @@ LyXLength::UNIT unitFromString(string const & data)
 }
 
 }
+#endif
 
 
 LyXLength::LyXLength()
@@ -126,6 +125,12 @@ void LyXLength::unit(LyXLength::UNIT u)
 }
 
 
+bool LyXLength::zero() const 
+{
+       return val_ == 0.0;
+}
+
+
 bool operator==(LyXLength const & l1, LyXLength const & l2)
 {
        return l1.value() == l2.value() && l1.unit() == l2.unit();
index df31f9534900c41a1fe8565f3c016d02ce8b9189..cabb28d225d0d73885da2deb195b0d0dd8b5395a 100644 (file)
@@ -68,7 +68,7 @@ public:
 
        /// "data" must be a decimal number, followed by a unit
        explicit LyXLength(string const & data);
-       
+
        ///
        double value() const;
        ///
@@ -77,10 +77,8 @@ public:
        void value(double);
        ///
        void unit(LyXLength::UNIT unit);
-
-       /// real length in SP
-       //void lenght();
-
+       ///
+       bool zero() const;
        /// conversion
        string const asString() const;
        ///
index 958c7a14e680b33cbbc6b05140ae4026a77c1e63..03f8236ff218da23c01d5b019f8f14de43ec2941 100644 (file)
@@ -172,7 +172,7 @@ string const LyXLex::getLongString(string const & endtoken)
                        string tmpstr = getString();
                        if (firstline) {
                                unsigned int i = 0;
-                               while(i < tmpstr.length()
+                               while (i < tmpstr.length()
                                      && tmpstr[i] == ' ') {
                                        ++i;
                                        prefix += ' ';
index cb574e9e7dd45542fc38d73aff4b0a3aeacd53b7..1dc807724e00ff4470132b768b7386a1ee3fdb63 100644 (file)
@@ -401,7 +401,7 @@ bool LyXLex::Pimpl::eatLine()
        int i = 0;
        unsigned char c = '\0';
        char cc = 0;
-       while(is && c != '\n' && i != (LEX_MAX_BUFF - 1)) {
+       while (is && c != '\n' && i != (LEX_MAX_BUFF - 1)) {
                is.get(cc);
                c = cc;
                //lyxerr[Debug::LYXLEX] << "LyXLex::EatLine read char: `"
index 368e6df9ad1c2f13a19524044a3b0c0fcc553ee3..d0454ebb61f6aa5579440bc32ed143440c2c5879 100644 (file)
@@ -288,14 +288,14 @@ void LyXComm::callback(int fd, void *v)
        errno = 0;
        int status;
        // the single = is intended here.
-       while((status = read(fd, charbuf, CMDBUFLEN-1)))
+       while ((status = read(fd, charbuf, CMDBUFLEN-1)))
        {// break and return in loop
                if (status > 0) // got something
                {
                        charbuf[status]= '\0'; // turn it into a c string
                        lsbuf += strip(charbuf, '\r');
                        // commit any commands read
-                       while(lsbuf.find('\n') != string::npos) // while still
+                       while (lsbuf.find('\n') != string::npos) // while still
                                                        // commands
                                                        // left 
                        {
@@ -406,7 +406,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
        //  Format: LYXCMD:<client>:<func>:<argstring>\n
        //
        bool server_only = false;
-       while(*p) {
+       while (*p) {
                // --- 1. check 'header' ---
 
                if (compare(p, "LYXSRV:", 7) == 0) {
@@ -419,20 +419,20 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
                
                // --- 2. for the moment ignore the client name ---
                string client;
-               while(*p && *p != ':')
+               while (*p && *p != ':')
                        client += char(*p++);
                if (*p == ':') ++p;
                if (!*p) return;
                
                // --- 3. get function name ---
                string cmd;
-               while(*p && *p != ':')
+               while (*p && *p != ':')
                        cmd += char(*p++);
                
                // --- 4. parse the argument ---
                string arg;
                if (!server_only && *p == ':' && *(++p)) {
-                       while(*p && *p != '\n')
+                       while (*p && *p != '\n')
                                arg += char(*p++);
                        if (*p) ++p;
                }
index 78e5f350fe0ce9e09b50d46ea946db632b6e03d7..6521dd950ce298303a43dc280e92d6aed4f8df8c 100644 (file)
@@ -1,3 +1,32 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * math_arrayinset.C:
+       * math_boxinset.C:
+       * math_decorationinset.C:
+       * math_deliminset.C:
+       * math_dotsinset.C:
+       * math_exfuncinset.C:
+       * math_exintinset.C:
+       * math_funcinset.C:
+       * math_funcliminset.C:
+       * math_hullinset.C:
+       * math_kerninset.C:
+       * math_limopinset.C:
+       * math_sizeinset.C:
+       * math_stringinset.C:
+       * math_symbolinset.C:
+       * math_unknowninset.C: include math_streamstr.h and remove
+       unneeded c_str()
+       
+       * math_symbolinset.[Ch]: add constructor taking string
+       
+       * math_mathmlstream.C: move includes around
+
+       * math_streamstr.[Ch]: add operator<<(Stream, string) for
+       NormalStream, MapleStream, MathMLStream and OctaveStream
+       
+       * math_gridinset.C: user LyXLength::zero
+       
 2001-11-19  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * formula.C:
index 2c6da9506ce21b6a24191c3aec86183167b81208..ab216d492f5a113f4040dac4befeba6cb15635ed 100644 (file)
@@ -1,14 +1,17 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <iterator>
-
 #include "math_arrayinset.h"
 #include "math_parser.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "Lsstream.h"
 
+#include <iterator>
+
 using std::vector;
 using std::istringstream;
 using std::getline;
@@ -77,7 +80,7 @@ void MathArrayInset::write(WriteStream & os) const
 
        if (v_align_ == 't' || v_align_ == 'b') 
                os << '[' << char(v_align_) << ']';
-       os << '{' << halign().c_str() << "}\n";
+       os << '{' << halign() << "}\n";
 
        MathGridInset::write(os);
 
index ba4ab6b2b30e3cb2629c880a7619b6a79224788a..1a546c78264f8ae9a2bed53d2576f17236a25462 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -10,7 +12,7 @@
 #include "math_cursor.h"
 #include "insets/insettext.h"
 #include "math_mathmlstream.h"
-
+#include "math_streamstr.h"
 
 MathBoxInset::MathBoxInset(string const & name)
        : MathDimInset(), name_(name), text_(new InsetText), buffer_(0)
@@ -47,7 +49,7 @@ UpdatableInset * MathBoxInset::asHyperActiveInset() const
 
 void MathBoxInset::write(WriteStream & os) const
 {
-       os << "\\" << name_.c_str() << "{" << cell(0) << "}";
+       os << "\\" << name_ << "{" << cell(0) << "}";
 }
 
 
index 977308b8fa9170963983cc914df95410b874ac52..b447e594b701227d4f0e7ccc8375ed23f2a93241 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -6,6 +8,7 @@
 #include "math_support.h"
 #include "math_parser.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 
 
 MathDecorationInset::MathDecorationInset(string const & name)
@@ -95,11 +98,11 @@ void MathDecorationInset::write(WriteStream & os) const
 {
        if (os.fragile() && protect())
                os << "\\protect";
-       os << '\\' << name_.c_str() << '{' << cell(0) << '}';
+       os << '\\' << name_ << '{' << cell(0) << '}';
 }
 
 
 void MathDecorationInset::normalize(NormalStream & os) const
 {
-       os << "[deco " << name_.c_str() << ' ' <<  cell(0) << ']';
+       os << "[deco " << name_ << ' ' <<  cell(0) << ']';
 }
index 57ba6a220ff4cdd9accf04f55b4e926dd922006e..882f8cb16576602ac0dbe6fb9d9c2fc704e52c31 100644 (file)
@@ -8,6 +8,7 @@
 #include "math_parser.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_extern.h"
 
 
@@ -44,15 +45,15 @@ string MathDelimInset::latexName(string const & name)
 
 void MathDelimInset::write(WriteStream & os) const
 {
-       os << "\\left" << latexName(left_).c_str() << cell(0)
-          << "\\right" << latexName(right_).c_str();
+       os << "\\left" << latexName(left_) << cell(0)
+          << "\\right" << latexName(right_);
 }
 
 
 void MathDelimInset::normalize(NormalStream & os) const
 {
-       os << "[delim " << latexName(left_).c_str() << ' '
-               << latexName(right_).c_str() << ' ' << cell(0) << ']';
+       os << "[delim " << latexName(left_) << ' '
+          << latexName(right_) << ' ' << cell(0) << ']';
 }
 
 
@@ -121,14 +122,14 @@ void MathDelimInset::maplize(MapleStream & os) const
                        os << "abs(" << cell(0) << ")";
        }
        else
-               os << left_.c_str() << cell(0) << right_.c_str();
+               os << left_ << cell(0) << right_;
 }
 
 
 void MathDelimInset::mathmlize(MathMLStream & os) const
 {
-       os << "<fenced open=\"" << left_.c_str() << "\" close=\""
-               << right_.c_str() << "\">" << cell(0) << "</fenced>";
+       os << "<fenced open=\"" << left_ << "\" close=\""
+               << right_ << "\">" << cell(0) << "</fenced>";
 }
 
 
@@ -137,5 +138,5 @@ void MathDelimInset::octavize(OctaveStream & os) const
        if (isAbs())
                os << "det(" << cell(0) << ")";
        else
-               os << left_.c_str() << cell(0) << right_.c_str();
+               os << left_ << cell(0) << right_;
 }
index 70e8de37b84461572fb2635c48aec8adb9236952..2615aed1df585f187a82160e35373763ad2c5006 100644 (file)
@@ -1,9 +1,12 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "math_dotsinset.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 
 
@@ -44,11 +47,11 @@ void MathDotsInset::metrics(MathMetricsInfo const & mi) const
 
 void MathDotsInset::write(WriteStream & os) const
 {
-       os << '\\' << name_.c_str() << ' ';
+       os << '\\' << name_ << ' ';
 }
 
 
 void MathDotsInset::normalize(NormalStream & os) const
 {
-       os << "[" << name_.c_str() << "] ";
+       os << "[" << name_ << "] ";
 }
index 1cf2588e09af4d3bd7b78c9df927a2f5bd354270..c258e2b0b3f5df2f531fbe90ac2fdfdfb60b71aa 100644 (file)
@@ -1,7 +1,9 @@
+#include <config.h>
+
 #include "math_exfuncinset.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
-
+#include "math_streamstr.h"
 
 using std::ostream;
 
@@ -32,13 +34,13 @@ void MathExFuncInset::draw(Painter & pain, int x, int y) const
 
 void MathExFuncInset::normalize(NormalStream & os) const
 {
-       os << '[' << name_.c_str() << ' ' << cell(0) << ']';
+       os << '[' << name_ << ' ' << cell(0) << ']';
 }
 
 
 void MathExFuncInset::maplize(MapleStream & os) const
 {
-       os << name_.c_str() << '(' << cell(0) << ')';
+       os << name_ << '(' << cell(0) << ')';
 }
 
 
@@ -50,13 +52,13 @@ void MathExFuncInset::mathmlize(MathMLStream & os) const
 
 void MathExFuncInset::octavize(OctaveStream & os) const
 {
-       os << name_.c_str() << '(' << cell(0) << ')';
+       os << name_ << '(' << cell(0) << ')';
 }
 
 
 void MathExFuncInset::write(WriteStream & os) const
 {
-       os << '\\' << name_.c_str() << '{' << cell(0) << '}';
+       os << '\\' << name_ << '{' << cell(0) << '}';
 }
 
 
index 0a8c4979e55c52d60b31ebbb5e951d7d83a845cb..ba21ff6dca3667e069c4476981ad6eaa0783ebda 100644 (file)
@@ -1,9 +1,14 @@
+#include <config.h>
+
 #include "math_exintinset.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_symbolinset.h"
 #include "debug.h"
 
+using std::endl;
+
 
 MathExIntInset::MathExIntInset(string const & name)
        : MathNestInset(4), symbol_(name)
@@ -37,26 +42,26 @@ bool MathExIntInset::hasScripts() const
 
 void MathExIntInset::normalize(NormalStream & os) const
 {
-       os << '[' << symbol_.c_str() << ' ' << cell(0) << ' ' << cell(1) << ' ' 
+       os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' ' 
           << cell(2) << ' ' << cell(3) << ']';
 }
 
 
 void MathExIntInset::metrics(MathMetricsInfo const &) const
 {
-       lyxerr << "should not happen\n";
+       lyxerr << "should not happen" << endl;
 }
 
 
 void MathExIntInset::draw(Painter &, int, int) const
 {  
-       lyxerr << "should not happen\n";
+       lyxerr << "should not happen" << endl;
 }
 
 
 void MathExIntInset::maplize(MapleStream & os) const
 {
-       os << symbol_.c_str() << '(';
+       os << symbol_ << '(';
        if (cell(0).size())
                os << cell(0);
        else 
@@ -70,7 +75,7 @@ void MathExIntInset::maplize(MapleStream & os) const
 
 void MathExIntInset::mathmlize(MathMLStream & os) const
 {
-       MathSymbolInset * sym = new MathSymbolInset(symbol_.c_str());
+       MathSymbolInset * sym = new MathSymbolInset(symbol_);
        //if (hasScripts())
        //      mathmlize(sym, os);
        //else 
@@ -84,6 +89,6 @@ void MathExIntInset::mathmlize(MathMLStream & os) const
 
 void MathExIntInset::write(WriteStream &) const
 {
-       lyxerr << "should not happen\n";
+       lyxerr << "should not happen" << endl;
 }
 
index 002775730bf673ea12154a29f01e359721caa742..b7dedc3cc3c41521e5b7944daf9053f8e978b499 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -7,7 +9,7 @@
 #include "Painter.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
-
+#include "math_streamstr.h"
 
 
 extern LyXFont WhichFont(short type, int size);
@@ -58,29 +60,29 @@ bool MathFuncInset::match(MathInset * p) const
 
 void MathFuncInset::maplize(MapleStream & os) const
 {
-       os << ' ' << name_.c_str();
+       os << ' ' << name_;
 }
 
 
 void MathFuncInset::mathmlize(MathMLStream & os) const
 {
-       os << MTag("mi") << name_.c_str() << ETag("mi");
+       os << MTag("mi") << name_ << ETag("mi");
 }
 
 
 void MathFuncInset::octavize(OctaveStream & os) const
 {
-       os << ' ' << name_.c_str();
+       os << ' ' << name_;
 }
 
 
 void MathFuncInset::normalize(NormalStream & os) const
 {
-       os << "[func " << name_.c_str() << ']';
+       os << "[func " << name_ << ']';
 }
 
 
 void MathFuncInset::write(WriteStream & os) const
 {
-       os << "\\" << name_.c_str() << ' ';
+       os << "\\" << name_ << ' ';
 }
index 79760d029ea09f7b9446c7e31586a5377a528094..5221bbab36827438ece0a342fea8d84d2705d8ab 100644 (file)
@@ -1,5 +1,8 @@
+#include <config.h>
+
 #include "math_funcliminset.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 
 
@@ -22,13 +25,13 @@ bool MathFuncLimInset::isScriptable() const
 
 void MathFuncLimInset::write(WriteStream & os) const
 {
-       os << '\\' << name_.c_str() << ' ';
+       os << '\\' << name_ << ' ';
 }
 
 
 void MathFuncLimInset::normalize(NormalStream & os) const
 {
-       os << "[funclim " << name_.c_str() << ']';
+       os << "[funclim " << name_ << ']';
 }
 
 
index 7c7bafd22e8c6f283e3938ec52c5f8e4a1174501..56bfaeae558e2195b722fa62e2e78a2c180d78a1 100644 (file)
@@ -380,7 +380,7 @@ string MathGridInset::eolString(row_type row) const
 {
        string eol;
 
-       if (rowinfo_[row].crskip_.value() != 0)
+       if (!rowinfo_[row].crskip_.zero())
                eol += "[" + rowinfo_[row].crskip_.asLatexString() + "]";
 
        // make sure an upcoming '[' does not break anything
index 535a7c44c3a6947303cae594c268d58fd93d0805..939f64db0ccd37359cde6359b19002805bc0c5a0 100644 (file)
@@ -1,16 +1,20 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "math_hullinset.h"
 #include "math_support.h"
 #include "debug.h"
 #include "Painter.h"
 #include "LaTeXFeatures.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
+
+#include <vector>
 
+using std::endl;
 
 namespace {
 
@@ -608,7 +612,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
 
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
                        break;
@@ -620,7 +625,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
                                        break;
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
 
@@ -631,42 +637,45 @@ void MathHullInset::mutate(MathInsetTypes newtype)
                                        break;
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
 
                default:
                        lyxerr << "mutation from '" << getType()
-                               << "' to '" << newtype << "' not implemented\n";
+                              << "' to '" << newtype << "' not implemented"
+                              << endl;
+                       break;
        }
 }
 
 
 void MathHullInset::write(WriteStream & os) const
 {
-  header_write(os);
-
+       header_write(os);
+       
        bool n = numberedType();
-
+       
        for (row_type row = 0; row < nrows(); ++row) {
                for (col_type col = 0; col < ncols(); ++col) 
-                       os << cell(index(row, col)) << eocString(col).c_str();
+                       os << cell(index(row, col)) << eocString(col);
                if (n) {
                        if (!label_[row].empty())
-                               os << "\\label{" << label_[row].c_str() << "}";
+                               os << "\\label{" << label_[row] << "}";
                        if (nonum_[row])
                                os << "\\nonumber ";
                }
-               os << eolString(row).c_str();
+               os << eolString(row);
        }
-
-  footer_write(os);
+       
+       footer_write(os);
 }
 
 
 void MathHullInset::normalize(NormalStream & os) const
 {
-       os << "[formula " << normalName(getType()).c_str() << " ";
+       os << "[formula " << normalName(getType()) << " ";
        MathGridInset::normalize(os);
        os << "] ";
 }
index cedf71ca34d455d219a9ba1a36b66e2857450325..e14cfe786a86d2b1fd137f5f1d6e67d86defdfe9 100644 (file)
@@ -1,9 +1,12 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "math_kerninset.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 
 
@@ -46,12 +49,12 @@ void MathKernInset::metrics(MathMetricsInfo const &) const
 
 void MathKernInset::write(WriteStream & os) const
 {
-       os << "\\kern" << wid_.asLatexString().c_str() << " ";
+       os << "\\kern" << wid_.asLatexString() << " ";
 }
 
 
 void MathKernInset::normalize(NormalStream & os) const
 {
-       os << "[kern " << wid_.asLatexString().c_str() << "]";
+       os << "[kern " << wid_.asLatexString() << "]";
 }
 
index f43fbb971fa2965e55ae8b4d5345119b2dc6e25a..7f3dfce4e08f23832cdd91fc0287e1c97750d24e 100644 (file)
@@ -45,10 +45,10 @@ void MathLimitOpInset::draw(Painter &, int, int) const
 
 void MathLimitOpInset::maplize(MapleStream &) const
 {
-       //os << name_.c_str() << '(' << cell(0) << ')';
+       //os << name_ << '(' << cell(0) << ')';
 }
 
 void MathLimitOpInset::mathmlize(MathMLStream &) const
 {
-       //os << name_.c_str() << '(' << cell(0) << ')';
+       //os << name_ << '(' << cell(0) << ')';
 }
index 03bc1b2ccb702ef7dbc80472f8eca1c42c42021f..bf12913e0b94719703472d8e8b887c05ded80b29 100644 (file)
@@ -1,11 +1,12 @@
 #include <config.h>
-#include <algorithm>
 
 #include "math_mathmlstream.h"
 #include "math_inset.h"
 #include "math_extern.h"
 #include "debug.h"
 
+#include <algorithm>
+
 
 MathMLStream::MathMLStream(std::ostream & os)
        : os_(os), tab_(0), line_(0), lastchar_(0)
index 86edc28163e9fb01c0da549a52950121aa5bfefc..02f45c00afb7e25009b49ed99206325ec6d58904 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -5,6 +7,7 @@
 #include "math_sizeinset.h"
 #include "math_parser.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 
 
 MathSizeInset::MathSizeInset(latexkeys const * l)
@@ -37,11 +40,11 @@ void MathSizeInset::metrics(MathMetricsInfo const & mi) const
 
 void MathSizeInset::write(WriteStream & os) const
 {
-       os << "{\\" << key_->name.c_str() << ' ' << cell(0) << '}';
+       os << "{\\" << key_->name << ' ' << cell(0) << '}';
 }
 
 
 void MathSizeInset::normalize(NormalStream & os) const
 {
-       os << "[" << key_->name.c_str() << ' ' << cell(0) << ']';
+       os << "[" << key_->name << ' ' << cell(0) << ']';
 }
index 5886fb6d1b0efc65ea130ff7adf1834d2bfec688..039931351361f988a934a2345e282cd9ff61186c 100644 (file)
@@ -1,8 +1,9 @@
 #include <config.h>
-#include <algorithm>
 
-#include "math_mathmlstream.h"
 #include "math_streamstr.h"
+#include "math_mathmlstream.h"
+
+#include <algorithm>
 
 
 WriteStream & operator<<(WriteStream & ws, string const & s)
@@ -11,3 +12,31 @@ WriteStream & operator<<(WriteStream & ws, string const & s)
        ws.line() += std::count(s.begin(), s.end(), '\n');
        return ws;
 }
+
+
+NormalStream & operator<<(NormalStream & ns, string const & s)
+{
+       ns.os() << s;
+       return ns;
+}
+
+
+MapleStream & operator<<(MapleStream & ms, string const & s)
+{
+       ms.os() << s;
+       return ms;
+}
+
+
+MathMLStream & operator<<(MathMLStream & ms, string const & s)
+{
+       ms.os() << s;
+       return ms;
+}
+
+
+OctaveStream & operator<<(OctaveStream & os, string const & s)
+{
+       os.os() << s;
+       return os;
+}
index 2d54ecbe975c9d87b93314b80ad78305b2fb4f66..3238106e0497e61e433399b5e0b3a3b3fc13232c 100644 (file)
@@ -1,14 +1,22 @@
+// -*- C++ -*-
 #ifndef MATH_STREAMSTR_H
 #define MATH_STREAMSTR_H
 
 #include "LString.h"
 
 class WriteStream;
+class NormalStream;
+class MapleStream;
+class MathMLStream;
+class OctaveStream;
 
 //
 // writing strings directly
 //
 
 WriteStream & operator<<(WriteStream & ws, string const & s);
-
+NormalStream & operator<<(NormalStream & ns, string const & s);
+MapleStream & operator<<(MapleStream & ms, string const & s);
+MathMLStream & operator<<(MathMLStream & ms, string const & s);
+OctaveStream & operator<<(OctaveStream & os, string const & s);
 #endif
index 901a5135841a6ff95d49e55341f5b1fea045a5b4..e9b803f0802c6dd18227295b07e70c4454a1ddc3 100644 (file)
@@ -1,17 +1,20 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <cctype>
-
 #include "math_stringinset.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "LColor.h"
 #include "Painter.h"
 #include "math_support.h"
 #include "math_parser.h"
 #include "debug.h"
 
+#include <cctype>
+
 
 MathStringInset::MathStringInset()
        : str_(), code_(LM_TC_MIN)
@@ -61,14 +64,14 @@ void MathStringInset::draw(Painter & pain, int x, int y) const
 
 void MathStringInset::normalize(NormalStream & os) const
 {
-       os << "[string " << str_.c_str() << ' ' << "mathalpha" << "]";
+       os << "[string " << str_ << ' ' << "mathalpha" << "]";
 }
 
 
 void MathStringInset::maplize(MapleStream & os) const
 {
        if (code_ != LM_TC_VAR || str_.size() <= 1) {
-               os << ' ' << str_.c_str() << ' ';
+               os << ' ' << str_ << ' ';
                return;
        }       
 
@@ -82,7 +85,7 @@ void MathStringInset::maplize(MapleStream & os) const
 void MathStringInset::octavize(OctaveStream & os) const
 {
        if (code_ != LM_TC_VAR || str_.size() <= 1) {
-               os << ' ' << str_.c_str() << ' ';
+               os << ' ' << str_ << ' ';
                return;
        }       
 
@@ -96,20 +99,20 @@ void MathStringInset::octavize(OctaveStream & os) const
 void MathStringInset::mathmlize(MathMLStream & os) const
 {
        if (code_ == LM_TC_VAR)
-               os << "<mi> " << str_.c_str() << " </mi>";
+               os << "<mi> " << str_ << " </mi>";
        else if (code_ == LM_TC_CONST)
-               os << "<mn> " << str_.c_str() << " </mn>";
+               os << "<mn> " << str_ << " </mn>";
        else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
-               os << "<mtext> " << str_.c_str() <<  " </mtext>";
+               os << "<mtext> " << str_ <<  " </mtext>";
        else
-               os << str_.c_str();
+               os << str_;
 }
 
 
 void MathStringInset::write(WriteStream & os) const
 {
        if (math_font_name(code_)) 
-               os << '\\' << math_font_name(code_) << '{' << str_.c_str() << '}';
+               os << '\\' << math_font_name(code_) << '{' << str_ << '}';
        else 
-               os << str_.c_str();
+               os << str_;
 }
index 9b0a9e41dea40168fa79f345d711c3975bda0396..c861d5c94289f70744f7543a7af01f1b61eee024 100644 (file)
@@ -1,5 +1,8 @@
+#include <config.h>
+
 #include "math_symbolinset.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 #include "math_parser.h"
 #include "debug.h"
@@ -15,6 +18,11 @@ MathSymbolInset::MathSymbolInset(const char * name)
 {}
 
 
+MathSymbolInset::MathSymbolInset(string const & name)
+       : sym_(in_word_set(name.c_str())), h_(0)
+{}
+
+
 
 MathInset * MathSymbolInset::clone() const
 {
@@ -114,7 +122,7 @@ bool MathSymbolInset::takesLimits() const
 
 void MathSymbolInset::normalize(NormalStream & os) const
 {
-       os << "[symbol " << name().c_str() << "]";
+       os << "[symbol " << name() << "]";
 }
 
 
@@ -123,7 +131,7 @@ void MathSymbolInset::maplize(MapleStream & os) const
        if (name() == "cdot")
                os << '*';
        else
-               os << name().c_str();
+               os << name();
 }
 
 
@@ -147,9 +155,9 @@ void MathSymbolInset::mathmlize(MathMLStream & os) const
        char const * type = MathMLtype(sym_->type);
        os << '<' << type << "> ";
        if (sym_->xmlname == "x") // unknown so far
-               os << name().c_str();
+               os << name();
        else
-               os << sym_->xmlname.c_str();
+               os << sym_->xmlname;
        os << " </" << type << '>';
 }
 
@@ -159,13 +167,13 @@ void MathSymbolInset::octavize(OctaveStream & os) const
        if (name() == "cdot")
                os << '*';
        else
-               os << name().c_str();
+               os << name();
 }
 
 
 void MathSymbolInset::write(WriteStream & os) const
 {
-       os << '\\' << name().c_str() << ' ';
+       os << '\\' << name() << ' ';
 }
 
 
index f92a5c09b1becaa60ebcbaac13248673fc229d30..0de6781ed307709d5d4c8a8af5e1312ae32b2aae 100644 (file)
@@ -16,6 +16,8 @@ public:
        ///
        explicit MathSymbolInset(char const *);
        ///
+       explicit MathSymbolInset(string const &);
+       ///
        MathInset * clone() const;
        ///
        void metrics(MathMetricsInfo const & st) const;
index 20e83eb96f55981c178cac46cb5187085fceee91..275b30ec329bd884d27fd11b0e0b2964d59aac6c 100644 (file)
@@ -1,3 +1,5 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -7,7 +9,7 @@
 #include "Painter.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
-
+#include "math_streamstr.h"
 
 
 extern LyXFont WhichFont(short type, int size);
@@ -38,13 +40,13 @@ void MathUnknownInset::setName(string const & n)
 
 void MathUnknownInset::write(WriteStream & os) const
 {
-       os << "\\" << name_.c_str() << ' ';
+       os << "\\" << name_ << ' ';
 }
 
 
 void MathUnknownInset::normalize(NormalStream & os) const
 {
-       os << "[func " << name_.c_str() << ']';
+       os << "[func " << name_ << ']';
 }
 
 
@@ -63,17 +65,17 @@ void MathUnknownInset::draw(Painter & pain, int x, int y) const
 
 void MathUnknownInset::maplize(MapleStream & os) const
 {
-       os << name_.c_str();
+       os << name_;
 }
 
 
 void MathUnknownInset::mathmlize(MathMLStream & os) const
 {
-       os << MTag("mi") << name_.c_str() << ETag("mi");
+       os << MTag("mi") << name_ << ETag("mi");
 }
 
 
 void MathUnknownInset::octavize(OctaveStream & os) const
 {
-       os << name_.c_str();
+       os << name_;
 }
index e6a014af8f66d574fba9c7da0cbf197e58079a8f..561ac127b6d5f271028e3deb0794ce5fbee833f8 100644 (file)
@@ -129,7 +129,7 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
                text->getVisibleRow(bv, y + y_offset,
                                    x_offset, row, y + text->first);
                internal = internal && (st != LyXText::CHANGED_IN_DRAW);
-               while(internal && text->status() == LyXText::CHANGED_IN_DRAW) {
+               while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
                        if (text->fullRebreak(bv)) {
                                st = LyXText::NEED_MORE_REFRESH;
                                text->setCursor(bv, text->cursor.par(), text->cursor.pos());
index 68b289334e1cd7bcfa83710bbb2a68602ec038c6..44e3faeb98296d7ac911939441df81eafd8c72ed 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * filetools.C:
+       * lstrings.C:
+       * lyxstring.C: change "while(" to "while ("
+
 2001-12-03  Ben Stanley <bds02@uow.edu.au>
 
        * lyxsum.C: Added mmap version of CRC and made it selected 
index 64a1cc77d83270ed8d61e2a2f227863ce2df48f1..07c577b4e02c8670998460b74358958a41a4a0aa 100644 (file)
@@ -184,7 +184,7 @@ string const FileOpenSearch (string const & path, string const & name,
                if (real_file.empty()) {
                        do {
                                tmppath = split(tmppath, path_element, ';');
-                       } while(!tmppath.empty() && path_element.empty());
+                       } while (!tmppath.empty() && path_element.empty());
                } else {
                        notfound = false;
                }
@@ -593,7 +593,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
                TempBase = AddPath(lyx::getcwd(), BasePath);
        
        // Handle /./ at the end of the path
-       while(suffixIs(TempBase, "/./"))
+       while (suffixIs(TempBase, "/./"))
                TempBase.erase(TempBase.length() - 2);
 
        // processes relative path
index f0e6fe2b952cec85e39e06e1a00524394831223c..5a53a47f4142e0eeed5ba2a4665245fc78b8e86a 100644 (file)
@@ -511,7 +511,7 @@ string const subst(string const & a,
        string lstr(a);
        string::size_type i = 0;
        string::size_type olen = strlen(oldstr);
-       while((i = lstr.find(oldstr, i)) != string::npos) {
+       while ((i = lstr.find(oldstr, i)) != string::npos) {
                lstr.replace(i, olen, newstr);
                i += newstr.length(); // We need to be sure that we dont
                // use the same i over and over again.
@@ -526,7 +526,7 @@ string const subst(string const & a,
        string lstr(a);
        string::size_type i = 0;
        string::size_type const olen = oldstr.length();
-       while((i = lstr.find(oldstr, i)) != string::npos) {
+       while ((i = lstr.find(oldstr, i)) != string::npos) {
                lstr.replace(i, olen, newstr);
                i += newstr.length(); // We need to be sure that we dont
                // use the same i over and over again.
index 35db7f9d28749d63296c42ad0a218a6eca1130c6..4088c033c0c90bbff84d9725f0432f134d40e5c8 100644 (file)
@@ -996,7 +996,7 @@ lyxstring::size_type lyxstring::rfind(lyxstring const & a, size_type i) const
                        }
                        if (equal) return t;
                }
-       } while(t-- > 0);
+       } while (t-- > 0);
        return npos;
 }
 
@@ -1766,7 +1766,7 @@ istream & getline(istream & is, lyxstring & s,
        // very bad solution
        char tmp = 0;
        s.erase();
-       while(is) {
+       while (is) {
                is.get(tmp);
                if (tmp != delim) {
                        s += tmp;
index 5dbccf0e5642b35e62cf00ec61707f52cae6a307..4a014d35015780a0bc86c5412743c518ef6642fe 100644 (file)
@@ -41,7 +41,7 @@ bool getTokenValue(string const & str, char const * token, string & ret)
        ret += ch;
        ch = ' ';
     }
-    while((pos < str.length() - 1) && (str[++pos] != ch))
+    while ((pos < str.length() - 1) && (str[++pos] != ch))
        ret += str[pos];
 
     return true;
@@ -64,7 +64,7 @@ bool getTokenValue(string const & str, char const * token, int & num)
        ret += ch;
     }
     ++pos;
-    while((pos < str.length() - 1) && isdigit(str[pos]))
+    while ((pos < str.length() - 1) && isdigit(str[pos]))
        ret += str[pos++];
 
     num = strToInt(ret);
@@ -117,7 +117,7 @@ bool getTokenValue(string const & str, char const * token, bool & flag)
        ret += ch;
     }
     ++pos;
-    while((pos < str.length() - 1) && isdigit(str[pos]))
+    while ((pos < str.length() - 1) && isdigit(str[pos]))
        ret += str[pos++];
 
     flag = strToInt(ret);
@@ -132,7 +132,7 @@ void l_getline(istream & is, string & str)
 //#warning old l_getline
 #endif
     getline(is, str);
-    while(str.empty())
+    while (str.empty())
        getline(is, str);
 }
 
index 60ee577dbe875c2b0224c4c3f49b6ac5f124286d..3d3529753f9751fac8b612a9a1da51d5c134cc93 100644 (file)
@@ -1243,7 +1243,7 @@ bool getTokenValue(string const & str, const char * token, string & ret)
                ret += ch;
                ch = ' ';
        }
-       while((pos < str.length() - 1) && (str[++pos] != ch))
+       while ((pos < str.length() - 1) && (str[++pos] != ch))
                ret += str[pos];
 
        return true;
@@ -1623,7 +1623,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
                        if (cont_row_info[row]) {
                                DeleteRow(row);
                                cont_row_info.erase(cont_row_info.begin() + row); //&cont_row_info[row]);
-                               while(!IsFirstCellInRow(--cell));
+                               while (!IsFirstCellInRow(--cell));
                        } else {
                                inset = GetCellInset(cell);
                                continue;
@@ -2456,7 +2456,7 @@ int LyXTabular::AsciiTopHLine(ostream & os, int row,
                }
                int column = column_of_cell(i);
                int len = clen[column];
-               while(IsPartOfMultiColumn(row, ++column))
+               while (IsPartOfMultiColumn(row, ++column))
                        len += clen[column] + 4;
                print_n_chars(os, ch, len);
                if (TopLine(i)) {
@@ -2503,7 +2503,7 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row,
                }
                int column = column_of_cell(i);
                int len = clen[column];
-               while(IsPartOfMultiColumn(row, ++column))
+               while (IsPartOfMultiColumn(row, ++column))
                        len += clen[column] + 4;
                print_n_chars(os, ch, len);
                if (BottomLine(i)) {
@@ -2521,8 +2521,8 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row,
 
 
 int LyXTabular::AsciiPrintCell(Buffer const * buf, ostream & os,
-                                                          int cell, int row, int column,
-                                                          vector<unsigned int> const & clen) const
+                              int cell, int row, int column,
+                              vector<unsigned int> const & clen) const
 {
        ostringstream sstr;
        int ret = GetCellInset(cell)->ascii(buf, sstr, 0);
@@ -2534,7 +2534,7 @@ int LyXTabular::AsciiPrintCell(Buffer const * buf, ostream & os,
 
        unsigned int len1 = sstr.str().length();
        unsigned int len2 = clen[column];
-       while(IsPartOfMultiColumn(row, ++column))
+       while (IsPartOfMultiColumn(row, ++column))
                len2 += clen[column] + 4;
        len2 -= len1;
 
index d009dbcc858c01773fa2bc388e67b7c41779c909..022a209ee7ae9a56fd0525ae5fa9bd149604415b 100644 (file)
@@ -100,10 +100,10 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const
                int dummy_y;
                Row * row = getRow(par, pos, dummy_y);
                Row * frow = row;
-               while(frow->previous() && frow->par() == frow->previous()->par())
+               while (frow->previous() && frow->par() == frow->previous()->par())
                        frow = frow->previous();
                unsigned int maxw = 0;
-               while(frow->next() && frow->par() == frow->next()->par()) {
+               while (frow->next() && frow->par() == frow->next()->par()) {
                        if ((frow != row) && (maxw < frow->width()))
                                maxw = frow->width();
                        frow = frow->next();
@@ -1127,7 +1127,7 @@ int LyXText::numberOfHfills(Buffer const * buf, Row const * row) const
        pos_type first = row->pos();
        if (first) { /* hfill *DO* count at the beginning 
                      * of paragraphs! */
-               while(first <= last && row->par()->isHfill(first))
+               while (first <= last && row->par()->isHfill(first))
                        ++first;
        }
 
@@ -1150,7 +1150,7 @@ int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const
        pos_type first = row->pos();
        if (first) { /* hfill *DO* count at the beginning 
                      * of paragraphs! */
-               while(first < last && row->par()->isHfill(first))
+               while (first < last && row->par()->isHfill(first))
                        ++first;
        }
 
@@ -1526,7 +1526,7 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
        if (inset_owner) {
                Row * r = firstrow;
                width = max(0,workWidth(bview));
-               while(r) {
+               while (r) {
                        if (r->width() > width)
                                width = r->width();
                        r = r->next();
index 547452a0780a8afbbc2fd7ee971754cd5e275b45..c6f5bd7ab6158f531710ab96d043d447f50736a4 100644 (file)
@@ -88,7 +88,7 @@ string const TransDeadkeyState::normalkey(char c, string const & trans)
        
        // Check if it is an exception
        KmodException l = deadkey_info_.exception_list;
-       while(l != 0) {
+       while (l != 0) {
                if (l->c == c) {
                        res = l->data;
                        break;
@@ -118,7 +118,7 @@ string const TransDeadkeyState::normalkey(char c)
        
        // Check if it is an exception
        KmodException l = deadkey_info_.exception_list;
-       while(l != 0) {
+       while (l != 0) {
                if (l->c == c) {
                        res = l->data;
                        break;
@@ -359,7 +359,7 @@ void  TransManager::TranslateAndInsert(char c, LyXText * text)
        // Process with tokens
        string temp;
        
-       while(res.length() > 0) {
+       while (res.length() > 0) {
                res = split(res, temp, TransState::TOKEN_SEP);
                insert(temp, text);
        }
index c745b38fb2c2ac2a80e9748c5fade3c1e6411ff3..2a9d69c559cb8e02884820fd5e83accbbed55cda 100644 (file)
@@ -239,7 +239,7 @@ void CVS::scanMaster()
        lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << "'" << endl;
        string line;
        LRegex reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
-       while(getline(ifs, line)) {
+       while (getline(ifs, line)) {
                lyxerr[Debug::LYXVC] << "\t  line: " << line << endl;
                if (contains(line, tmpf)) {
                        // Ok extract the fields.
index ed2a81600e588b24d549d453d90807589cc58a62..ec023d85776312692686a1e4350040271641ece7 100644 (file)
 
 namespace {
 
-#if 0
-/*  length units
- */
-
-int const num_units = LyXLength::UNIT_NONE;
-
-// I am not sure if "mu" should be possible to select (Lgb)
-char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
-                                     "mm", "pc", "cc", "cm",
-                                     "in", "ex", "em", "mu",
-                                     "%",  "c%", "p%", "l%" };
-
-
-/*  The following static items form a simple scanner for
- *  length strings, used by isValid[Glue]Length.  See comments there.
- */
-double           number[4] = { 0, 0, 0, 0 };
-LyXLength::UNIT unit[4]   = { LyXLength::UNIT_NONE,
-                             LyXLength::UNIT_NONE,
-                             LyXLength::UNIT_NONE,
-                             LyXLength::UNIT_NONE };
-int number_index;
-int unit_index;
-
-LyXLength::UNIT unitFromString(string const & data)
-{
-       int i = 0;
-       while (i < num_units && data != unit_name[i])
-               ++i;
-       return static_cast<LyXLength::UNIT>(i);
-}
-
-#endif
 double           number[4] = { 0, 0, 0, 0 };
 LyXLength::UNIT unit[4]   = { LyXLength::UNIT_NONE,
                              LyXLength::UNIT_NONE,