X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fiterators.h;h=8bc2128a08c297b9a7fb7e3aa855421c86221704;hb=ac103f15a7cead429a7b2ee1f75d67cc988ec81d;hp=b87d16e5373704abc3c374ae5e712eefc5c98ccd;hpb=8283e978f8d621041c432b9b88a476bfd567385c;p=lyx.git diff --git a/src/iterators.h b/src/iterators.h index b87d16e537..8bc2128a08 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -10,11 +10,11 @@ class ParPosition { public: ParPosition(Paragraph * p) - : par(p), it(p->inset_iterator_begin()), index(-1) {} + : par(p), it(p->insetlist.begin()), index(-1) {} /// Paragraph * par; /// - Paragraph::inset_iterator it; + InsetList::iterator it; /// int index; }; @@ -74,4 +74,46 @@ bool operator!=(ParIterator const & iter1, ParIterator const & iter2) { return !(iter1 == iter2); } + +class ParConstIterator { +public: + /// + typedef std::stack PosHolder; + /// + ParConstIterator() {} + /// + ParConstIterator(Paragraph * par) { + positions.push(ParPosition(par)); + } + /// + ParConstIterator & operator++(); + /// + Paragraph const * operator*() { + return positions.top().par; + } + /// + PosHolder::size_type size() const + { return positions.size(); } + /// + friend + bool operator==(ParConstIterator const & iter1, + ParConstIterator const & iter2); +private: + /// + PosHolder positions; +}; + + +/// +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); +} + #endif