]> git.lyx.org Git - features.git/commitdiff
iterators-2.diff + some whitespace changes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 21 May 2003 21:20:50 +0000 (21:20 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 21 May 2003 21:20:50 +0000 (21:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6995 a592a061-630c-0410-9148-cb99ea01b6c8

16 files changed:
src/BufferView.C
src/BufferView_pimpl.C
src/ChangeLog
src/CutAndPaste.C
src/buffer.C
src/insets/ChangeLog
src/insets/insetbutton.C
src/insets/insetcollapsable.C
src/insets/inseterror.C
src/insets/insetert.C
src/insets/insetfloat.C
src/iterators.C
src/iterators.h
src/mathed/math_cursor.C
src/mathed/math_parser.C
src/toc.C

index 4de7fcd0615b5df24c4e7b0c578f978f0f5c7098..730e30ac974ef5a9527673979e38e31462831e91 100644 (file)
@@ -373,7 +373,7 @@ bool BufferView::removeAutoInsets()
        ParIterator it = buffer()->par_iterator_begin();
        ParIterator end = buffer()->par_iterator_end();
        for (; it != end; ++it) {
-               Paragraph * par = *it;
+               Paragraph * par = &*(*it);
                Paragraph * par_prev = par ? par->previous() : 0;
                bool removed = false;
 
@@ -495,7 +495,7 @@ void BufferView::showErrorList(string const & action) const
 }
 
 
-ErrorList const & 
+ErrorList const &
 BufferView::getErrorList() const
 {
        return pimpl_->errorlist_;
@@ -764,7 +764,7 @@ bool BufferView::ChangeInsets(Inset::Code code,
        ParIterator end = buffer()->par_iterator_end();
        for (ParIterator it = buffer()->par_iterator_begin();
             it != end; ++it) {
-               Paragraph * par = *it;
+               Paragraph * par = &*(*it);
                bool changed_inset = false;
                for (InsetList::iterator it2 = par->insetlist.begin();
                     it2 != par->insetlist.end(); ++it2) {
index 176a0a496140a2ea01ab4248459a07fed455543e..9787625304cd1e21c508de1ebdcdbe9a2917a99a 100644 (file)
@@ -842,9 +842,9 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
        string const disp_fn = MakeDisplayPath(filename);
        owner_->message(bformat(_("Inserting document %1$s..."), disp_fn));
        bool const res = bv_->insertLyXFile(filename);
-       if (res) 
+       if (res)
                owner_->message(bformat(_("Document %1$s inserted."), disp_fn));
-       else 
+       else
                owner_->message(bformat(_("Could not insert document %1$s"), disp_fn));
 }
 
index 9b9d5d7d446627f1ee6c61e7f57b4ee7cc81b84b..cae91f9913854c252c93bf6b043130916967ef6d 100644 (file)
@@ -1,3 +1,17 @@
+2003-05-21  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * toc.C (getTocList): adjust
+
+       * iterators.[Ch]: rework for parlist
+
+       * buffer.C (par_iterator_begin): adjust
+       (par_iterator_end): adjust
+
+       * CutAndPaste.C (SwitchLayoutsBetweenClasses): adjust
+
+       * BufferView.C (removeAutoInsets): adjust
+       (ChangeInsets): adjust
+
 2003-05-21  Alfredo Braunstein  <abraunst@libero.it>
 
        * text.C (top_y): fix bug 1110
        * ParagraphParameters.C (params2string): small bug fixed
 
 2003-05-16  André Pönitz  <poenitz@gmx.net>
-       
+
        * debug.C:
-       * bufferview_funcs.C: patch from Kornel Benko to prevent 
+       * bufferview_funcs.C: patch from Kornel Benko to prevent
          crash when _(...) is called twice in a statement
 
 2003-05-16  André Pönitz  <poenitz@gmx.net>
-       
+
        * BufferView.C:
        * lyxfunc.C:
        * text.C:
@@ -74,7 +88,7 @@
        * lyx_main.C (init): remove spurious static_cast
 
 2003-05-14  André Pönitz  <poenitz@gmx.net>
-       
+
        * BufferView.C: fix format string
 
 2003-05-12  Alfredo Braunstein  <abraunst@libero.it>
@@ -85,7 +99,7 @@
        * converter.C (scanLog): call showErrorList instead of inserterrors
 
 2003-05-13  André Pönitz  <poenitz@gmx.net>
-       
+
        * BufferView_pimpl.C:
        * buffer.C:
        * bufferview_func.C:
index 91762f895ee9da0ff41faffac32bf06a449d5ee7..c2c4c04b37bd1e41d9ec5891b9431f013c5cd6b8 100644 (file)
@@ -223,7 +223,7 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
        // new environment and set also another font if that is required.
 
        // Make sure there is no class difference.
-       SwitchLayoutsBetweenClasses(textclass, tc, simple_cut_clone, 
+       SwitchLayoutsBetweenClasses(textclass, tc, simple_cut_clone,
                                    errorlist);
 
        ParagraphList::iterator tmpbuf = simple_cut_clone.begin();
@@ -338,17 +338,15 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
 {
        lyx::Assert(!pars.empty());
 
-       Paragraph * par = &*pars.begin();
-
        int ret = 0;
        if (c1 == c2)
                return ret;
 
        LyXTextClass const & tclass1 = textclasslist[c1];
        LyXTextClass const & tclass2 = textclasslist[c2];
-       ParIterator end = ParIterator();
-       for (ParIterator it = ParIterator(par); it != end; ++it) {
-               par = *it;
+       ParIterator end = ParIterator(pars.end(), pars);
+       for (ParIterator it = ParIterator(pars.begin(), pars); it != end; ++it) {
+               Paragraph * par = &*(*it);
                string const name = par->layout()->name();
                bool hasLayout = tclass2.hasLayout(name);
 
@@ -364,8 +362,8 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
                                "because of class conversion from\n%3$s to %4$s"),
                         name, par->layout()->name(), tclass1.name(), tclass2.name());
                        // To warn the user that something had to be done.
-                       errorlist.push_back(ErrorItem("Changed Layout", s, 
-                                                     par->id(), 0, 
+                       errorlist.push_back(ErrorItem("Changed Layout", s,
+                                                     par->id(), 0,
                                                      par->size()));
                }
        }
index ccb271815e175d2b3616dc2cbc637f0919e6b0ec..3bb3d789518e390cf590a928b0e9705589609346 100644 (file)
@@ -148,7 +148,7 @@ Buffer::~Buffer()
                users->buffer(0);
 
        if (!tmppath.empty() && destroyDir(tmppath) != 0) {
-               Alert::warning(_("Could not remove temporary directory"), 
+               Alert::warning(_("Could not remove temporary directory"),
                        bformat(_("Could not remove the temporary directory %1$s"), tmppath));
        }
 
@@ -249,7 +249,7 @@ namespace {
 
 void unknownClass(string const & unknown)
 {
-       Alert::warning(_("Unknown document class"), 
+       Alert::warning(_("Unknown document class"),
                bformat(_("Using the default document class, because the "
                        " class %1$s is unknown."), unknown));
 }
@@ -1969,7 +1969,7 @@ int Buffer::runChktex()
                        _("Could not run chktex successfully."));
        } else if (res > 0) {
                // Insert all errors as errors boxes
-               ErrorList el (*this, terr); 
+               ErrorList el (*this, terr);
                users->setErrorList(el);
                users->showErrorList(_("ChkTeX"));
        }
@@ -2249,24 +2249,24 @@ bool Buffer::hasParWithID(int id) const
 
 ParIterator Buffer::par_iterator_begin()
 {
-       return ParIterator(&*(paragraphs.begin()));
+       return ParIterator(paragraphs.begin(), paragraphs);
 }
 
 
 ParIterator Buffer::par_iterator_end()
 {
-       return ParIterator();
+       return ParIterator(paragraphs.end(), paragraphs);
 }
 
 ParConstIterator Buffer::par_iterator_begin() const
 {
-       return ParConstIterator(&*(paragraphs.begin()));
+       return ParConstIterator(paragraphs.begin(), paragraphs);
 }
 
 
 ParConstIterator Buffer::par_iterator_end() const
 {
-       return ParConstIterator();
+       return ParConstIterator(paragraphs.end(), paragraphs);
 }
 
 
index 9e13ba024e344a7b03aa87ffd3804349ed5c740c..3ca4cff9b50333c9bf14c1955e09ba3ac3c181e9 100644 (file)
@@ -1,3 +1,6 @@
+2003-05-21  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * insetfloat.C (addToToc): adjust
 
 2003-05-21  André Pönitz  <poenitz@gmx.net>
 
        * insetspecialchar.[Ch]:
        * insettabular.[Ch]:
        * insettext.[Ch]: dimensions() instead of ascend/descend/width
-       
+
 2003-05-19  André Pönitz  <poenitz@gmx.net>
 
        * insetenv.[Ch]:
-       * insettext.C: more insetenv 
+       * insettext.C: more insetenv
 
 2003-05-16  André Pönitz  <poenitz@gmx.net>
 
        * insetcommand.C:
        * insetminimpage.[Ch]:
-       * insetcollapsable.[Ch]: fix #832 
+       * insetcollapsable.[Ch]: fix #832
 
 2003-05-16  André Pönitz  <poenitz@gmx.net>
 
@@ -61,7 +64,7 @@
        * insettoc.[Ch]:
        * inseturl.[Ch]:
        * updatableinset.[Ch]: edit() -> LFUN_INSET_EDIT
-       
+
 2003-05-13  André Pönitz <poenitz@gmx.net>
 
        * insetbibitem.C:
index 8f46a7557427258f7b269516d9acea6e7b439598..7367a638ac5372569847a62689136c5ac1d14b7d 100644 (file)
@@ -37,11 +37,11 @@ void InsetButton::dimension(BufferView * bv, LyXFont const &,
 
        string const s = getScreenLabel(bv->buffer());
 
-       if (editable()) 
+       if (editable())
                font_metrics::buttonText(s, font, dim.w, dim.a, dim.d);
-       else 
+       else
                font_metrics::rectText(s, font, dim.w, dim.a, dim.d);
-       
+
        dim.w += 4;
 }
 
index 3bb3f46f1d8afcbd0b5aae0862700c80974c68cb..4b9c48381f185ab2092fa2325f9df34278f9bdcc 100644 (file)
@@ -127,7 +127,7 @@ void InsetCollapsable::dimension(BufferView * bv, LyXFont const & font,
        Dimension & dim) const
 {
        dimension_collapsed(dim);
-       if (collapsed_) 
+       if (collapsed_)
                return;
        Dimension insetdim;
        inset.dimension(bv, font, insetdim);
index dbca5c1222b1ece0c93b97abeac04551daa5acf1..568f5758d05fc8bae628b67cd32a68ef66e1dfb1 100644 (file)
@@ -44,8 +44,8 @@ dispatch_result InsetError::localDispatch(FuncRequest const & cmd)
        dispatch_result result = UNDISPATCHED;
 
        switch (cmd.action) {
-       case LFUN_MOUSE_RELEASE: 
-       case LFUN_INSET_EDIT: 
+       case LFUN_MOUSE_RELEASE:
+       case LFUN_INSET_EDIT:
                cmd.view()->owner()->getDialogs().show("error", getContents(), this);
                return DISPATCHED;
 
index 24c076ff63eef6ab773bd751ae7026df3d43332f..881ca1c0179050e4a1e87e70f8b08ede1bed205f 100644 (file)
@@ -555,7 +555,7 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */)
 void InsetERT::dimension(BufferView * bv, LyXFont const & font,
        Dimension & dim) const
 {
-       if (inlined()) 
+       if (inlined())
                inset.dimension(bv, font, dim);
        else
                InsetCollapsable::dimension(bv, font, dim);
index 54295b4d8ddb688be3c8a46bcc8ccc3f7434290e..d987fc3ec84463959c2c291e1894706bfc6ce643 100644 (file)
@@ -362,12 +362,12 @@ void InsetFloat::wide(bool w, BufferParams const & bp)
 
 void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
 {
-       ParIterator pit(&*inset.paragraphs.begin());
-       ParIterator end;
+       ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
+       ParIterator end(inset.paragraphs.end(), inset.paragraphs);
 
        // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
-               Paragraph * tmp = *pit;
+               Paragraph * tmp = &*(*pit);
 
                if (tmp->layout()->name() == caplayout) {
                        string const name = floatname(params_.type, buf->params);
@@ -401,7 +401,7 @@ void InsetFloatMailer::string2params(string const & in,
 
        if (in.empty())
                return;
-       
+
        istringstream data(STRCONV(in));
        LyXLex lex(0,0);
        lex.setStream(data);
index 9521313243cbf24a37717ead27b5fbedb858beaa..7f067728d1e14549f9a3740fede79f14851af54b 100644 (file)
+/* \file iterators.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author unknown
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+
 #include <config.h>
 
 #include "iterators.h"
+#include "paragraph.h"
+
+#include <boost/next_prior.hpp>
+#include <boost/optional.hpp>
+
+#include <stack>
+
+using boost::next;
+using boost::optional;
+using std::stack;
+
+///
+/// ParPosition
+///
+
+class ParPosition {
+public:
+       ///
+       ParPosition(ParagraphList::iterator p, ParagraphList const & pl);
+       ///
+       ParagraphList::iterator pit;
+       ///
+       ParagraphList const * plist;
+       ///
+       optional<InsetList::iterator> it;
+       ///
+       optional<int> index;
+};
+
+
+ParPosition::ParPosition(ParagraphList::iterator p, ParagraphList const & pl)
+       : pit(p), plist(&pl)
+{
+       if (p != pl.end()) {
+               it.reset(p->insetlist.begin());
+       }
+}
+
+
+bool operator==(ParPosition const & pos1, ParPosition const & pos2)
+{
+       return pos1.pit == pos2.pit;
+}
+
+
+bool operator!=(ParPosition const & pos1, ParPosition const & pos2)
+{
+       return !(pos1 == pos2);
+}
+
+
+///
+/// ParIterator
+///
+
+struct ParIterator::Pimpl {
+       typedef stack<ParPosition> PosHolder;
+       PosHolder positions;
+};
+
+ParIterator::ParIterator(ParagraphList::iterator pit, ParagraphList const & pl)
+       : pimpl_(new Pimpl)
+{
+       pimpl_->positions.push(ParPosition(pit, pl));
+}
+
+
+ParIterator::~ParIterator()
+{}
+
+
+ParIterator::ParIterator(ParIterator const & pi)
+       : pimpl_(new Pimpl(*pi.pimpl_))
+{}
+
 
 ParIterator & ParIterator::operator++()
 {
-       while (!positions.empty()) {
-               ParPosition & p = positions.top();
+       while (!pimpl_->positions.empty()) {
+               ParPosition & p = pimpl_->positions.top();
 
                // Does the current inset contain more "cells" ?
-               if (p.index >= 0) {
-                       ++p.index;
-                       ParagraphList * plist = p.it.getInset()->getParagraphs(p.index);
+               if (p.index) {
+                       ++(*p.index);
+                       ParagraphList * plist = p.it->getInset()->getParagraphs(*p.index);
                        if (plist && !plist->empty()) {
-                               positions.push(ParPosition(&plist->front()));
+                               pimpl_->positions.push(ParPosition(plist->begin(), *plist));
                                return *this;
                        }
-                       ++p.it;
+                       ++(*p.it);
                } else
                        // The following line is needed because the value of
                        // p.it may be invalid if inset was added/removed to
                        // the paragraph pointed by the iterator
-                       p.it = p.par->insetlist.begin();
+                       p.it.reset(p.pit->insetlist.begin());
 
                // Try to find the next inset that contains paragraphs
-               InsetList::iterator end = p.par->insetlist.end();
-               for (; p.it != end; ++p.it) {
-                       ParagraphList * plist = p.it.getInset()->getParagraphs(0);
+               InsetList::iterator end = p.pit->insetlist.end();
+               for (; *p.it != end; ++(*p.it)) {
+                       ParagraphList * plist = p.it->getInset()->getParagraphs(0);
                        if (plist && !plist->empty()) {
-                               p.index = 0;
-                               positions.push(ParPosition(&plist->front()));
+                               p.index.reset(0);
+                               pimpl_->positions.push(ParPosition(plist->begin(), *plist));
                                return *this;
                        }
                }
+
                // Try to go to the next paragarph
-               if (p.par->next()) {
-                       p = ParPosition(p.par->next());
+               if (next(p.pit) != p.plist->end()
+                   || pimpl_->positions.size() == 1) {
+                       ++p.pit;
+                       p.index.reset();
+                       p.it.reset();
+
                        return *this;
                }
 
-               positions.pop();
+               // Drop end and move up in the stack.
+               pimpl_->positions.pop();
        }
        return *this;
 }
 
 
+ParagraphList::iterator ParIterator::operator*()
+{
+       return pimpl_->positions.top().pit;
+}
+
+
+ParagraphList::iterator ParIterator::operator->()
+{
+       return pimpl_->positions.top().pit;
+}
+
+
+size_t ParIterator::size() const
+{
+       return pimpl_->positions.size();
+}
+
+
+bool operator==(ParIterator const & iter1, ParIterator const & iter2)
+{
+       return iter1.pimpl_->positions == iter2.pimpl_->positions;
+}
+
+
+bool operator!=(ParIterator const & iter1, ParIterator const & iter2)
+{
+       return !(iter1 == iter2);
+}
+
+
+///
+/// ParConstIterator
+///
+
+
+struct ParConstIterator::Pimpl {
+       typedef stack<ParPosition> PosHolder;
+       PosHolder positions;
+};
+
+
+ParConstIterator::ParConstIterator(ParagraphList::iterator pit,
+                                  ParagraphList const & pl)
+       : pimpl_(new Pimpl)
+{
+       pimpl_->positions.push(ParPosition(pit, pl));
+}
+
+
+ParConstIterator::~ParConstIterator()
+{}
+
+
+ParConstIterator::ParConstIterator(ParConstIterator const & pi)
+       : pimpl_(new Pimpl(*pi.pimpl_))
+{}
+
+
 ParConstIterator & ParConstIterator::operator++()
 {
-       while (!positions.empty()) {
-               ParPosition & p = positions.top();
+       while (!pimpl_->positions.empty()) {
+               ParPosition & p = pimpl_->positions.top();
 
                // Does the current inset contain more "cells" ?
-               if (p.index >= 0) {
-                       ++p.index;
-                       ParagraphList * plist = p.it.getInset()->getParagraphs(p.index);
+               if (p.index) {
+                       ++(*p.index);
+                       ParagraphList * plist = p.it->getInset()->getParagraphs(*p.index);
                        if (plist && !plist->empty()) {
-                               positions.push(ParPosition(&plist->front()));
+                               pimpl_->positions.push(ParPosition(plist->begin(), *plist));
                                return *this;
                        }
-                       ++p.it;
+                       ++(*p.it);
                } else
                        // The following line is needed because the value of
                        // p.it may be invalid if inset was added/removed to
                        // the paragraph pointed by the iterator
-                       p.it = p.par->insetlist.begin();
+                       p.it.reset(p.pit->insetlist.begin());
 
                // Try to find the next inset that contains paragraphs
-               InsetList::iterator end = p.par->insetlist.end();
-               for (; p.it != end; ++p.it) {
-                       ParagraphList * plist = p.it.getInset()->getParagraphs(0);
+               InsetList::iterator end = p.pit->insetlist.end();
+               for (; *p.it != end; ++(*p.it)) {
+                       ParagraphList * plist = p.it->getInset()->getParagraphs(0);
                        if (plist && !plist->empty()) {
-                               p.index = 0;
-                               positions.push(ParPosition(&plist->front()));
+                               p.index.reset(0);
+                               pimpl_->positions.push(ParPosition(plist->begin(), *plist));
                                return *this;
                        }
                }
+
                // Try to go to the next paragarph
-               if (p.par->next()) {
-                       p = ParPosition(p.par->next());
+               if (next(p.pit) != p.plist->end()
+                   || pimpl_->positions.size() == 1) {
+                       ++p.pit;
+                       p.index.reset();
+                       p.it.reset();
+
                        return *this;
                }
 
-               positions.pop();
+               // Drop end and move up in the stack.
+               pimpl_->positions.pop();
        }
+
        return *this;
 }
+
+
+ParagraphList::iterator ParConstIterator::operator*()
+{
+       return pimpl_->positions.top().pit;
+}
+
+
+ParagraphList::iterator ParConstIterator::operator->()
+{
+       return pimpl_->positions.top().pit;
+}
+
+
+size_t ParConstIterator::size() const
+{
+       return pimpl_->positions.size();
+}
+
+
+bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2)
+{
+       return iter1.pimpl_->positions == iter2.pimpl_->positions;
+}
+
+
+bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2)
+{
+       return !(iter1 == iter2);
+}
index 8bc2128a08c297b9a7fb7e3aa855421c86221704..9bc322ec6bae490e301ed3a63c2191de6711a030 100644 (file)
 // -*- C++ -*-
+/* \file iterators.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author unknown
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
+ */
 
 #ifndef ITERATORS_H
 #define ITERATORS_H
 
-#include <stack>
-
-#include "paragraph.h"
-
-class ParPosition {
-public:
-       ParPosition(Paragraph * p)
-               : par(p), it(p->insetlist.begin()), index(-1) {}
-       ///
-       Paragraph * par;
-       ///
-       InsetList::iterator it;
-       ///
-       int index;
-};
-
-
-inline
-bool operator==(ParPosition const & pos1, ParPosition const & pos2) {
-       return pos1.par == pos2.par &&
-               pos1.it == pos2.it &&
-               pos1.index == pos2.index;
-}
-
-inline
-bool operator!=(ParPosition const & pos1, ParPosition const & pos2) {
-       return !(pos1 == pos2);
-}
+#include "ParagraphList.h"
 
+#include <boost/scoped_ptr.hpp>
 
 class ParIterator {
 public:
        ///
-       typedef std::stack<ParPosition> PosHolder;
+       ParIterator(ParagraphList::iterator pit, ParagraphList const & pl);
        ///
-       ParIterator() {}
+       ~ParIterator();
        ///
-       ParIterator(Paragraph * par) {
-               positions.push(ParPosition(par));
-       }
+       ParIterator(ParIterator const &);
        ///
        ParIterator & operator++();
        ///
-       Paragraph * operator*() {
-               return positions.top().par;
-       }
+       ParagraphList::iterator operator*();
+       ///
+       ParagraphList::iterator operator->();
        ///
-       PosHolder::size_type size() const
-               { return positions.size(); }
+       size_t size() const;
        ///
        friend
        bool operator==(ParIterator const & iter1, ParIterator const & iter2);
 private:
-       ///
-       PosHolder positions;
+       struct Pimpl;
+       boost::scoped_ptr<Pimpl> pimpl_;
 };
 
-
 ///
-inline
-bool operator==(ParIterator const & iter1, ParIterator const & iter2) {
-       return iter1.positions == iter2.positions;
-}
-
+bool operator==(ParIterator const & iter1, ParIterator const & iter2);
 
 ///
-inline
-bool operator!=(ParIterator const & iter1, ParIterator const & iter2) {
-       return !(iter1 == iter2);
-}
+bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
 
 
 class ParConstIterator {
 public:
        ///
-       typedef std::stack<ParPosition> PosHolder;
+       ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl);
        ///
-       ParConstIterator() {}
+       ~ParConstIterator();
        ///
-       ParConstIterator(Paragraph * par) {
-               positions.push(ParPosition(par));
-       }
+       ParConstIterator(ParConstIterator const &);
        ///
        ParConstIterator & operator++();
        ///
-       Paragraph const * operator*() {
-               return positions.top().par;
-       }
+       ParagraphList::iterator operator*();
+
+       ///
+       ParagraphList::iterator operator->();
+
        ///
-       PosHolder::size_type size() const
-               { return positions.size(); }
+       size_t size() const;
        ///
        friend
        bool operator==(ParConstIterator const & iter1,
                        ParConstIterator const & iter2);
 private:
-       ///
-       PosHolder positions;
+       struct Pimpl;
+       boost::scoped_ptr<Pimpl> pimpl_;
 };
 
+bool operator==(ParConstIterator const & iter1,
+               ParConstIterator const & iter2);
 
-///
-inline
-bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2) {
-       return iter1.positions == iter2.positions;
-}
-
-///
-inline
-bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2) {
-       return !(iter1 == iter2);
-}
+bool operator!=(ParConstIterator const & iter1,
+               ParConstIterator const & iter2);
 
 #endif
index 0ae4239153c7ccf7d7e634010664f9b3b045e06b..ac95f75b97ca369978f4f147672b8d9e41f67d6d 100644 (file)
@@ -1409,7 +1409,7 @@ MathCursorPos MathCursor::normalAnchor() const
 
 dispatch_result MathCursor::dispatch(FuncRequest const & cmd)
 {
-       // mouse clicks are somewhat special 
+       // mouse clicks are somewhat special
        // check
        switch (cmd.action) {
                case LFUN_MOUSE_PRESS:
index 8d023680489a6fd83af634fadb8f084f49216b2f..56b89b58f150c870a8f01a529813382c908aa3c1 100644 (file)
@@ -617,7 +617,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
 
                if (flags & FLAG_ITEM) {
 
-               if (t.cat() == catBegin) {
+               if (t.cat() == catBegin) {
                                // skip the brace and collect everything to the next matching
                                // closing brace
                                parse1(grid, FLAG_BRACE_LAST, mode, numbered);
index 8912609988453cf427c989ccc936a08eed286361..96ea0364eeda170f81712503bcd6ed6016c9ec19 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -78,26 +78,24 @@ TocList const getTocList(Buffer const * buf)
        ParConstIterator pit = buf->par_iterator_begin();
        ParConstIterator end = buf->par_iterator_end();
        for (; pit != end; ++pit) {
-               Paragraph const * par = *pit;
-
 #ifdef WITH_WARNINGS
 #warning bogus type (Lgb)
 #endif
-               char const labeltype = par->layout()->labeltype;
+               char const labeltype = pit->layout()->labeltype;
 
                if (labeltype >= LABEL_COUNTER_CHAPTER
                    && labeltype <= LABEL_COUNTER_CHAPTER + buf->params.tocdepth) {
                                // insert this into the table of contents
                        const int depth = max(0, labeltype - textclass.maxcounter());
-                       TocItem const item(par->id(), depth,
-                                          par->asString(buf, true));
+                       TocItem const item(pit->id(), depth,
+                                          pit->asString(buf, true));
                        toclist["TOC"].push_back(item);
                }
 
                // For each paragraph, traverse its insets and look for
                // FLOAT_CODE or WRAP_CODE
-               InsetList::iterator it = par->insetlist.begin();
-               InsetList::iterator end = par->insetlist.end();
+               InsetList::iterator it = pit->insetlist.begin();
+               InsetList::iterator end = pit->insetlist.end();
                for (; it != end; ++it) {
                        if (it.getInset()->lyxCode() == Inset::FLOAT_CODE) {
                                InsetFloat * il =