X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fiterators.h;h=a68f7ff12d565886c7c732b4332edd0d79a214b0;hb=67f9c9fdae42211aa3ff8d0c6f62485bd721d8eb;hp=c76a7136194db50e64f75603897193d3a3f127ab;hpb=4faa9e29cf9d341bd1ab84e0e1a99985f2cceac2;p=lyx.git diff --git a/src/iterators.h b/src/iterators.h index c76a713619..a68f7ff12d 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -13,18 +13,39 @@ #define ITERATORS_H #include "ParagraphList_fwd.h" +#include "InsetList.h" + #include "support/types.h" -#include +#include + +#include class LyXText; -class InsetOld; +class InsetBase; class Cursor; -class BufferView; +class Buffer; class PosIterator; -class ParIterator { +class ParPosition { +public: + /// + ParPosition(ParagraphList::iterator p, ParagraphList const & pl); + /// + ParagraphList::iterator pit; + /// + ParagraphList const * plist; + /// + boost::optional it; + /// + boost::optional index; +}; + + +class ParIterator : public std::iterator< + std::forward_iterator_tag, + ParagraphList::value_type> { public: /// ParIterator(ParagraphList::iterator pit, ParagraphList const & pl); @@ -33,6 +54,8 @@ public: /// ParIterator(ParIterator const &); /// + ParIterator(PosIterator const &); + /// void operator=(ParIterator const &); /// ParIterator & operator++(); @@ -46,28 +69,22 @@ public: ParagraphList::iterator pit() const; /// ParagraphList & plist() const; - /// returns 'innermost' LyXText if in an inset or '0' instead of - //bv->text - LyXText * text() const; + /// returns 'innermost' LyXText + LyXText * text(Buffer &) const; /// returns innermost inset - InsetOld * inset() const; + InsetBase * inset() const; /// returns index of cell in innermost inset int index() const; /// size_t size() const; - /// - void asCursor(Cursor & cursor) const; - /// - friend - bool operator==(ParIterator const & iter1, ParIterator const & iter2); - /// - void lockPath(BufferView *) const; - /// - PosIterator asPosIterator(lyx::pos_type) const; + typedef std::vector PosHolder; + PosHolder const & positions() const + { + return positions_; + } private: - struct Pimpl; - boost::scoped_ptr pimpl_; + PosHolder positions_; }; /// @@ -77,7 +94,9 @@ bool operator==(ParIterator const & iter1, ParIterator const & iter2); bool operator!=(ParIterator const & iter1, ParIterator const & iter2); -class ParConstIterator { +class ParConstIterator : public std::iterator< + std::forward_iterator_tag, + ParagraphList::value_type> { public: /// ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl); @@ -98,14 +117,13 @@ public: /// depth of nesting size_t size() const; - /// - friend - bool operator==(ParConstIterator const & iter1, - ParConstIterator const & iter2); - + typedef std::vector PosHolder; + PosHolder const & positions() const + { + return positions_; + } private: - struct Pimpl; - boost::scoped_ptr pimpl_; + PosHolder positions_; }; bool operator==(ParConstIterator const & iter1,