From ca176cc4347a352f3b26f48a457ee7ba94463f37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 28 Jan 2004 16:21:29 +0000 Subject: [PATCH] std:: changes, stupid stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8375 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 9 ++++---- src/ChangeLog | 13 +++++++++++ src/cursor.C | 8 +++---- src/frontends/controllers/ChangeLog | 7 ++++++ src/frontends/controllers/ControlExternal.C | 3 ++- .../controllers/ControlSpellchecker.C | 10 ++++---- src/frontends/qt2/ChangeLog | 23 +++++++++++++------ src/frontends/qt2/QDocument.C | 3 ++- src/frontends/qt2/QLPopupMenu.C | 3 ++- src/frontends/qt2/QPrefs.C | 8 ++++--- src/frontends/xforms/ChangeLog | 8 ++++++- src/frontends/xforms/XFormsMenubar.C | 3 ++- src/frontends/xforms/XFormsToolbar.C | 3 ++- src/insets/ChangeLog | 5 ++++ src/insets/insettabular.C | 15 ++++++------ src/lyxfind.C | 3 ++- src/mathed/ChangeLog | 22 +++++++++++++++--- src/mathed/math_atom.C | 3 ++- src/mathed/math_atom.h | 1 + src/mathed/math_cursor.C | 6 ++--- src/mathed/math_extern.C | 6 +++-- src/mathed/math_gridinset.C | 6 ++--- src/mathed/math_hullinset.C | 12 ++++++---- src/paragraph.C | 23 ++++++++++--------- src/support/ChangeLog | 9 ++++++-- src/support/globbing.C | 7 +++--- src/text.C | 10 ++++---- 27 files changed, 156 insertions(+), 73 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 58d1360762..3de1d1b603 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -48,8 +48,10 @@ using lyx::support::bformat; using lyx::support::MakeAbsPath; +using std::distance; using std::find; using std::string; +using std::swap; using std::vector; @@ -314,7 +316,7 @@ void BufferView::gotoLabel(string const & label) if (find(labels.begin(),labels.end(),label) != labels.end()) { cursor().clearSelection(); text()->setCursor( - std::distance(text()->paragraphs().begin(), it.getPar()), + distance(text()->paragraphs().begin(), it.getPar()), it.getPos()); cursor().resetAnchor(); update(); @@ -462,7 +464,7 @@ void BufferView::putSelectionAt(PosIterator const & cur, int length, bool backwards) { ParIterator par(cur); - + cursor().clearSelection(); LyXText * text = par.text(*buffer()); @@ -478,7 +480,7 @@ void BufferView::putSelectionAt(PosIterator const & cur, text->setSelectionRange(length); cursor().setSelection(); if (backwards) - std::swap(cursor().cursor_, cursor().anchor_); + swap(cursor().cursor_, cursor().anchor_); } fitCursor(); @@ -496,4 +498,3 @@ LCursor const & BufferView::cursor() const { return pimpl_->cursor_; } - diff --git a/src/ChangeLog b/src/ChangeLog index 90e892a4df..eb669090a6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2004-01-28 Lars Gullik Bjonnes + + * text.C: add using statements for std::advance and std::distance + + * paragraph.C: add using statement for std::distance + + * lyxfind.C: add using statement for std::advance + + * cursor.C (region): remove std:: from swap + (openable): use nucleus in stead of operator-> + + * BufferView.C: add using statements for std::distance and std::swap + 2004-01-27 Lars Gullik Bjonnes * iterators.C: Remove the pimple, move the needed structures to diff --git a/src/cursor.C b/src/cursor.C index 5eb17f6bf4..7f96e6e329 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -560,11 +560,11 @@ void region(CursorSlice const & i1, CursorSlice const & i2, c1 = p->col(i1.idx_); c2 = p->col(i2.idx_); if (c1 > c2) - std::swap(c1, c2); + swap(c1, c2); r1 = p->row(i1.idx_); r2 = p->row(i2.idx_); if (r1 > r2) - std::swap(r1, r2); + swap(r1, r2); } } @@ -835,7 +835,7 @@ bool LCursor::openable(MathAtom const & t) // we can't move into anything new during selection if (depth() == anchor_.size()) return false; - if (t.operator->() != anchor_[depth()].inset()) + if (t.nucleus() != anchor_[depth()].inset()) return false; return true; @@ -1212,7 +1212,7 @@ MathHullInset * LCursor::formula() const void LCursor::adjust(pos_type from, int diff) -{ +{ if (pos() > from) pos() += diff; if (anchor().pos_ > from) diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index be5691b826..9f29b6f72c 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,10 @@ +2004-01-28 Lars Gullik Bjonnes + + * ControlSpellchecker.C: add using statements for std::advance and + std::distance + + * ControlExternal.C: add using statement for std::advance + 2004-01-26 Lars Gullik Bjonnes * ControlSpellchecker.C (check): use std::distance and diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index ac15b57ea9..8e0797deea 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -37,6 +37,7 @@ using lyx::support::FileFilterList; using lyx::support::MakeAbsPath; using lyx::support::readBB_from_PSFile; +using std::advance; using std::vector; using std::string; @@ -131,7 +132,7 @@ external::Template ControlExternal::getTemplate(int i) const external::TemplateManager::Templates::const_iterator i1 = external::TemplateManager::get().getTemplates().begin(); - std::advance(i1, i); + advance(i1, i); return i1->second; } diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index 835aa4c1e9..f5f6c82045 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -41,6 +41,8 @@ using lyx::support::bformat; +using std::advance; +using std::distance; using std::endl; using std::string; @@ -195,8 +197,8 @@ void ControlSpellchecker::check() PosIterator const beg = buffer()->pos_iterator_begin(); PosIterator const end = buffer()->pos_iterator_end(); - int start = std::distance(beg, cur); - int const total = start + std::distance(cur, end); + int start = distance(beg, cur); + int const total = start + distance(cur, end); if (cur != buffer()->pos_iterator_begin()) for (; cur != end && isLetter(cur); ++cur, ++start); @@ -235,9 +237,9 @@ void ControlSpellchecker::check() if (!word_.word().empty()) { int const size = word_.word().size(); - std::advance(cur, -size); + advance(cur, -size); bufferview()->putSelectionAt(cur, size, false); - std::advance(cur, size); + advance(cur, size); } else { showSummary(); endSession(); diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 0f53c54bad..b7ba44559c 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,12 @@ +2004-01-28 Lars Gullik Bjonnes + + * QPrefs.C: add using statement for std::distance + (findPos): add a typedef for the const_iterator. + + * QLPopupMenu.C: add using statement for std::distance + + * QDocument.C: add using statement for std::distance + 2004-01-25 Angus Leeming * Dialog.C (build): add the "findreplace" dialog. @@ -22,19 +31,19 @@ * QExternalDialog.C (browseClicked): * QGraphicsDialog.C (browse_clicked): - * QInclude.C (browse): + * QInclude.C (browse): changes doe to the name change controller().Browse() to controller().browse(). 2003-12-15 Ronald Florence * qfont_loader.C: fixed headers to compile w/o X11 - - * QWorkArea.C (checkAppleEventForMissingParams) + + * QWorkArea.C (checkAppleEventForMissingParams) (handleOpenDocuments): add support for OpenDocuments apple event * lyx_gui.C (macEventFilter): handle apple events - + 2004-01-05 Angus Leeming * FileDialog_private.C (c-tor): invoke convert_brace_glob to convert @@ -55,7 +64,7 @@ 2003-12-14 Jürgen Spitzmüller * QMinipage.[Ch]: - * QMinipageDialog.[Ch]: + * QMinipageDialog.[Ch]: * ui/QMinipageDialogBase.ui: remove from repository. * Dialogs.C: * Makefile.am: @@ -214,7 +223,7 @@ 2003-11-24 Alfredo Braunstein - * QContentpane.[Ch] (trackScrollbar): add + * QContentpane.[Ch] (trackScrollbar): add * QWorkarea.C (setScrollbarParams): do not track scrollbar signals when manually setting the scrollbar position @@ -239,7 +248,7 @@ * lyx_gui.C: {set,remove}_{server,data}socket_callback(): replace dummy functions with working ones - * socket_callback.[Ch] (): + * socket_callback.[Ch] (): new files with a class to connect sockets. * Makefile.am: add the above diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index 89c2de1fd4..5091903304 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -40,6 +40,7 @@ using lyx::support::bformat; using lyx::support::getVectorFromString; +using std::distance; using std::vector; using std::string; @@ -404,7 +405,7 @@ findPos(std::vector const & vec, A const & val) std::find(vec.begin(), vec.end(), val); if (it == vec.end()) return 0; - return std::distance(vec.begin(), it); + return distance(vec.begin(), it); } } // namespace anom diff --git a/src/frontends/qt2/QLPopupMenu.C b/src/frontends/qt2/QLPopupMenu.C index b40a386236..ea7c8cd327 100644 --- a/src/frontends/qt2/QLPopupMenu.C +++ b/src/frontends/qt2/QLPopupMenu.C @@ -22,6 +22,7 @@ using lyx::support::subst; +using std::distance; using std::make_pair; using std::string; using std::pair; @@ -100,7 +101,7 @@ void QLPopupMenu::populate(Menu * menu) Funcs::iterator fit = funcs_.insert(funcs_.end(), m->func()); - int const index = std::distance(funcs_.begin(), fit); + int const index = distance(funcs_.begin(), fit); insertItem(toqstr(getLabel(*m)), index); setItemEnabled(index, !status.disabled()); diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index 0c0ad9e51c..19d53f58b3 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -55,6 +55,7 @@ using lyx::support::compare_no_case; using lyx::support::strToDbl; +using std::distance; using std::endl; using std::setfill; using std::setw; @@ -323,11 +324,12 @@ template typename std::vector::size_type findPos(std::vector const & vec, A const & val) { - typename std::vector::const_iterator it = - std::find(vec.begin(), vec.end(), val); + typedef typename std::vector::const_iterator Cit; + + Cit it = std::find(vec.begin(), vec.end(), val); if (it == vec.end()) return 0; - return std::distance(vec.begin(), it); + return distance(vec.begin(), it); } void setComboxFont(QComboBox * cb, string const & family, string const & foundry) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 0b5707089e..a274c1051c 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2004-01-28 Lars Gullik Bjonnes + + * XFormsToolbar.C: add using statement for std::distance + + * XFormsMenubar.C: add using statement for std::distance + 2004-01-25 Angus Leeming * Dialog.C (build): add the "findreplace" dialog. @@ -14,7 +20,7 @@ * QExternalDialog.C (browseClicked): * QGraphicsDialog.C (browse_clicked): - * QInclude.C (browse): + * QInclude.C (browse): changes doe to the name change controller().Browse() to controller().browse(). diff --git a/src/frontends/xforms/XFormsMenubar.C b/src/frontends/xforms/XFormsMenubar.C index d737f499fb..fec33840e8 100644 --- a/src/frontends/xforms/XFormsMenubar.C +++ b/src/frontends/xforms/XFormsMenubar.C @@ -28,6 +28,7 @@ using lyx::support::lowercase; using lyx::support::subst; +using std::distance; using std::endl; using std::for_each; using std::string; @@ -296,7 +297,7 @@ int XFormsMenubar::create_submenu(Window win, XFormsView * view, Funcs::iterator fit = funcs.insert(funcs.end(), item.func()); int const action_count = - std::distance(funcs.begin(), fit); + distance(funcs.begin(), fit); label += "%x" + tostr(action_count + action_offset); lyxerr[Debug::GUI] << "Action: \"" diff --git a/src/frontends/xforms/XFormsToolbar.C b/src/frontends/xforms/XFormsToolbar.C index 7b6bda4e57..2025257c26 100644 --- a/src/frontends/xforms/XFormsToolbar.C +++ b/src/frontends/xforms/XFormsToolbar.C @@ -30,6 +30,7 @@ #include "lyx_forms.h" #include "combox.h" +using std::distance; using std::endl; using std::string; @@ -330,7 +331,7 @@ void XFormsToolbar::add(FuncRequest const & func, string const & tooltip) NorthWestGravity); Funcs::iterator fit = funcs.insert(funcs.end(), func); - int const index = std::distance(funcs.begin(), fit); + int const index = distance(funcs.begin(), fit); fl_set_object_callback(obj, C_Toolbar_ToolbarCB, index); // Remove the blue feedback rectangle fl_set_pixmapbutton_focus_outline(obj, 0); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 0636925b45..c8b39dfca5 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2004-01-28 Lars Gullik Bjonnes + + * insettabular.C: add using statement for std::vector, remove + std:: where using was already used. + 2004-01-19 Georg Baum * insetgraphics.C, insetinclude.C: use runparams.nice instead of diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index b676d8d66d..83b8483d49 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -47,14 +47,15 @@ using lyx::support::ltrim; using lyx::support::strToInt; using lyx::support::strToDbl; +using std::auto_ptr; using std::endl; using std::max; -using std::swap; using std::string; -using std::auto_ptr; using std::istringstream; using std::ostream; using std::ostringstream; +using std::swap; +using std::vector; namespace { @@ -506,7 +507,7 @@ InsetTabular::priv_dispatch(LCursor & cur, FuncRequest const & cmd) } if (!tablemode) { - + int cell = cur.idx(); lyxerr << "# InsetTabular::dispatch: A " << cur << endl; result = tabular.getCellInset(cell).dispatch(cur, cmd); @@ -692,7 +693,7 @@ tabular.column_of_cell(cur.idx())) clearSelection(); int column = tabular.column_of_cell(cur.idx()); if (yo_ < 0) { - cur.bv().scrollDocView( + cur.bv().scrollDocView( cur.bv().top_y() - cur.bv().painter().paperHeight()); if (yo_ > 0) cur.idx() = column; @@ -1222,7 +1223,7 @@ bool InsetTabular::movePrevCell(LCursor & cur) } -bool InsetTabular::tabularFeatures(LCursor & cur, std::string const & what) +bool InsetTabular::tabularFeatures(LCursor & cur, string const & what) { LyXTabular::Feature action = LyXTabular::LAST_ACTION; @@ -1645,7 +1646,7 @@ FuncStatus InsetTabular::getStatus(string const & what, int actcell) const string const tmp = tabularFeature[i].feature; if (tmp == what.substr(0, tmp.length())) { //if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(), - // tabularFeatures[i].feature.length())) + // tabularFeatures[i].feature.length())) action = tabularFeature[i].action; break; } @@ -1814,7 +1815,7 @@ FuncStatus InsetTabular::getStatus(string const & what, int actcell) const void InsetTabular::getLabelList(Buffer const & buffer, - std::vector & list) const + vector & list) const { tabular.getLabelList(buffer, list); } diff --git a/src/lyxfind.C b/src/lyxfind.C index 043a45d753..528ca0b3cc 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -39,6 +39,7 @@ using lyx::support::lowercase; using lyx::support::uppercase; using lyx::support::split; +using std::advance; using std::ostringstream; using std::string; @@ -345,7 +346,7 @@ int replaceAll(BufferView * bv, = cur.pit()->getFontSettings(buf.params(), pos); int striked = ssize - cur.pit()->erase(pos, pos + ssize); cur.pit()->insert(pos, replacestr, font); - std::advance(cur, rsize + striked); + advance(cur, rsize + striked); ++num; } diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index cdd54a88cc..4ef566a1be 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,19 @@ +2004-01-28 Lars Gullik Bjonnes + + * math_hullinset.C: add using statements for std::ostream, + std::swap and std::vector + + * math_gridinset.C (idxDelete): remove std:: from swap. + (priv_dispatch): ditto + + * math_extern.C: add using statement for std::swap and std::vector + + * math_cursor.C: remove std:: from string + (openable): use nucleus instead of operator-> + + * math_atom.h: add a const variant of nucleus + + * math_atom.C: add using statement for std::swap 2004-01-15 André Pönitz @@ -6,7 +22,7 @@ 2004-01-15 André Pönitz - * *.[Ch]: change signature of priv_dispatch to prepare + * *.[Ch]: change signature of priv_dispatch to prepare inset unification 2003-12-15 Ronald Florence @@ -17,7 +33,7 @@ * math_pos.[Ch]: remove (it's now cursor_slice.[Ch]) - * Makefile.am: + * Makefile.am: * math_cursor.[Ch]: * math_iterator.[Ch]: adjust @@ -36,7 +52,7 @@ 2003-11-10 André Pönitz * formula.C: - * formulabase.C: adjust to removed inset locking + * formulabase.C: adjust to removed inset locking 2003-11-05 José Matos diff --git a/src/mathed/math_atom.C b/src/mathed/math_atom.C index c77a1512ee..bd5cda75be 100644 --- a/src/mathed/math_atom.C +++ b/src/mathed/math_atom.C @@ -13,6 +13,7 @@ #include "math_atom.h" #include "math_inset.h" +using std::swap; MathAtom::MathAtom() @@ -38,7 +39,7 @@ void MathAtom::operator=(MathAtom const & at) if (&at == this) return; MathAtom tmp(at); - std::swap(tmp.nucleus_, nucleus_); + swap(tmp.nucleus_, nucleus_); } diff --git a/src/mathed/math_atom.h b/src/mathed/math_atom.h index 9e02b7a8d3..751735e4a2 100644 --- a/src/mathed/math_atom.h +++ b/src/mathed/math_atom.h @@ -58,6 +58,7 @@ public: void operator=(MathAtom const &); /// access to the inset (checked with gprof) MathInset * nucleus() { return nucleus_; } + MathInset const * nucleus() const { return nucleus_; } /// access to the inset MathInset const * operator->() const { return nucleus_; } diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index cd65ed5b79..b8766d4f1a 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -78,7 +78,7 @@ namespace mathcursor { void eraseSelection(LCursor & cur); /// the name of the macro we are currently inputting - std::string macroName(LCursor & cur); + string macroName(LCursor & cur); /// where in the curent cell does the macro name start? difference_type macroNamePos(LCursor & cur); /// can we enter the inset? @@ -184,7 +184,7 @@ bool openable(MathAtom const & t, bool sel) // we can't move into anything new during selection if (cur.depth() == Anchor_.size()) return false; - if (t.operator->() != Anchor_[cur.depth()].asMathInset()) + if (t.nucleus() != Anchor_[cur.depth()].asMathInset()) return false; } #else @@ -662,7 +662,7 @@ InsetFormulaBase * formula() void adjust(LCursor & cur, pos_type from, difference_type diff) -{ +{ if (cur.pos() > from) cur.pos() += diff; if (cur.anchor().pos_ > from) diff --git a/src/mathed/math_extern.C b/src/mathed/math_extern.C index ab7e39c904..78dcf35092 100644 --- a/src/mathed/math_extern.C +++ b/src/mathed/math_extern.C @@ -51,6 +51,8 @@ using std::auto_ptr; using std::istringstream; using std::ostream; using std::ostringstream; +using std::swap; +using std::vector; ostream & operator<<(ostream & os, MathArray const & ar) @@ -290,7 +292,7 @@ void splitScripts(MathArray & ar) // create extra script inset and move superscript over MathScriptInset * p = ar[i].nucleus()->asScriptInset(); auto_ptr q(new MathScriptInset(true)); - std::swap(q->up(), p->up()); + swap(q->up(), p->up()); p->removeScript(true); // insert new inset behind @@ -982,7 +984,7 @@ namespace { expr.insert(pos, "*"); } - std::vector tmp = getVectorFromString(out, "$$"); + vector tmp = getVectorFromString(out, "$$"); if (tmp.size() < 2) return MathArray(); diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 9909ee8ff1..2dbfd74a28 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -884,7 +884,7 @@ bool MathGridInset::idxDelete(idx_type & idx) // move cells if necessary for (idx_type i = index(row(idx), 0); i < idx; ++i) - std::swap(cell(i), cell(i + ncols())); + swap(cell(i), cell(i + ncols())); delRow(row(idx)); @@ -1087,11 +1087,11 @@ MathGridInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd) // split line for (col_type c = col(cur.idx()) + 1; c < ncols(); ++c) - std::swap(cell(index(r, c)), cell(index(r + 1, c))); + swap(cell(index(r, c)), cell(index(r + 1, c))); // split cell splitCell(cur); - std::swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1)); + swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1)); if (cur.idx() > 0) --cur.idx(); cur.idx() = cur.lastpos(); diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 781cfd08b4..64c960fb39 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -42,8 +42,11 @@ using std::max; using std::string; using std::auto_ptr; using std::istringstream; +using std::ostream; using std::ostringstream; using std::pair; +using std::swap; +using std::vector; namespace { @@ -319,8 +322,7 @@ bool MathHullInset::display() const } -void MathHullInset::getLabelList(Buffer const &, - std::vector & labels) const +void MathHullInset::getLabelList(Buffer const &, vector & labels) const { for (row_type row = 0; row < nrows(); ++row) if (!label_[row].empty() && nonum_[row] != 1) @@ -449,8 +451,8 @@ void MathHullInset::swapRow(row_type row) return; if (row + 1 == nrows()) --row; - std::swap(nonum_[row], nonum_[row + 1]); - std::swap(label_[row], label_[row + 1]); + swap(nonum_[row], nonum_[row + 1]); + swap(label_[row], label_[row + 1]); MathGridInset::swapRow(row); } @@ -690,7 +692,7 @@ void MathHullInset::mathmlize(MathMLStream & os) const } -void MathHullInset::infoize(std::ostream & os) const +void MathHullInset::infoize(ostream & os) const { os << "Type: " << type_; } diff --git a/src/paragraph.C b/src/paragraph.C index 1dec5968ed..ce19157b87 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -55,6 +55,7 @@ using lyx::pos_type; using lyx::support::contains; using lyx::support::subst; +using std::distance; using std::endl; using std::list; using std::stack; @@ -518,7 +519,7 @@ void Paragraph::setFont(pos_type pos, LyXFont const & font) if (it->pos() >= pos) break; } - unsigned int i = std::distance(beg, it); + unsigned int i = distance(beg, it); bool notfound = (it == endit); if (!notfound && pimpl_->fontlist[i].font() == font) @@ -712,7 +713,7 @@ InsetBibitem * Paragraph::bibitem() const namespace { // paragraphs inside floats need different alignment tags to avoid -// unwanted space +// unwanted space bool noTrivlistCentering(UpdatableInset const * inset) { @@ -1338,7 +1339,7 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf, int char_line_count = depth; bool label_closed = true; bool para_closed = true; - + if (style->latextype == LATEX_ITEM_ENVIRONMENT) { string ls = ""; Counters & counters = buf.params().getLyXTextClass().counters(); @@ -1351,11 +1352,11 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf, if (!defaultstyle->latexparam().empty()) { counters.step("para"); ls = tostr(counters.value("para")); - ls = " id=\"" + ls = " id=\"" + subst(defaultstyle->latexparam(), "#", ls) + '"'; } - os << "<" << style->itemtag() << ">\n" - << string(depth, ' ') << "<" + os << "<" << style->itemtag() << ">\n" + << string(depth, ' ') << "<" << defaultstyle->latexname() << ls << ">\n"; para_closed = false; } @@ -1408,8 +1409,8 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf, os << str; } else if (!style->labeltag().empty() && !label_closed) { ++char_line_count; - os << "\nlabeltag() << "><" - << style->itemtag() << "><" + os << "\nlabeltag() << "><" + << style->itemtag() << "><" << defaultstyle->latexname() << ">"; label_closed = true; para_closed = false; @@ -1431,12 +1432,12 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf, // resets description flag correctly if (!label_closed) { // not closed... - os << "labeltag() << ">\n<" - << style->itemtag() << "><" + os << "labeltag() << ">\n<" + << style->itemtag() << "><" << defaultstyle->latexname() << "> "; } if (!para_closed) { - os << "\n" << string(depth, ' ') << "latexname() << ">\n"; } if (style->free_spacing) diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 0a65f4b3b7..5f0eaee7d0 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,8 @@ +2004-01-28 Lars Gullik Bjonnes + + * globbing.C: add using statement for std::distance, remove std:: + from string. + 2004-01-08 Angus Leeming * globbing.[Ch]: add a new class FileFilterList to parse a Qt-style @@ -6,10 +11,10 @@ 2003-12-14 Ronald Florence * tostr.[hC]: added tostr(long unsigned int i). - + * path_defines.C.in: determine system directory and set PATH for relocatable LyX/Mac bundle. - + 2004-01-06 Angus Leeming * globbing.C (glob): compilation fix for cygwin. diff --git a/src/support/globbing.C b/src/support/globbing.C index 61f10d1edf..b0d16e88e4 100644 --- a/src/support/globbing.C +++ b/src/support/globbing.C @@ -23,6 +23,7 @@ #include "glob.h" +using std::distance; using std::ostringstream; using std::string; using std::vector; @@ -65,7 +66,7 @@ string const convert_brace_glob(string const & glob) pattern += boost::regex_merge(tail, block_re, fmt); // Increment the iterator to the end of the match. - it += std::distance(it, what[0].second); + it += distance(it, what[0].second); } return pattern; @@ -86,7 +87,7 @@ vector const glob(string const & pattern, int flags) vector const expand_globs(string const & mask, - std::string const & directory) + string const & directory) { typedef boost::tokenizer > Tokenizer; boost::char_separator const separator(" "); @@ -134,7 +135,7 @@ FileFilterList::FileFilterList(string const & qt_style_filter) parse_filter(string(what[-1].first, what[-1].second)); // Increment the iterator to the end of the match. - it += std::distance(it, what[0].second); + it += distance(it, what[0].second); } } diff --git a/src/text.C b/src/text.C index 24b65382f5..a5f41923b8 100644 --- a/src/text.C +++ b/src/text.C @@ -58,6 +58,8 @@ using lyx::support::contains; using lyx::support::lowercase; using lyx::support::uppercase; +using std::advance; +using std::distance; using std::max; using std::endl; using std::string; @@ -344,7 +346,7 @@ int LyXText::rightMargin(Paragraph const & par) const { LyXTextClass const & tclass = bv()->buffer()->params().getLyXTextClass(); - return + return RIGHT_MARGIN + font_metrics::signedWidth(tclass.rightmargin(), tclass.defaultfont()) @@ -1404,7 +1406,7 @@ ParagraphList::iterator LyXText::getPar(int par) const BOOST_ASSERT(par >= 0); BOOST_ASSERT(par < int(paragraphs().size())); ParagraphList::iterator pit = paragraphs().begin(); - std::advance(pit, par); + advance(pit, par); return pit; } @@ -1543,7 +1545,7 @@ string LyXText::selectionAsString(Buffer const & buffer, bool label) const int LyXText::parOffset(ParagraphList::iterator pit) const { - return std::distance(paragraphs().begin(), pit); + return distance(paragraphs().begin(), pit); } @@ -1773,7 +1775,7 @@ void LyXText::write(Buffer const & buf, std::ostream & os) const bool LyXText::read(Buffer const & buf, LyXLex & lex) -{ +{ static Change current_change; bool the_end_read = false; -- 2.39.2