X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fiterators.h;h=a68f7ff12d565886c7c732b4332edd0d79a214b0;hb=67f9c9fdae42211aa3ff8d0c6f62485bd721d8eb;hp=8a7ea614a6d34a28f3a76fbd62cd28f2a0b61392;hpb=2e1eeac0b968511ff2084e193eac98f33cb1ea87;p=lyx.git diff --git a/src/iterators.h b/src/iterators.h index 8a7ea614a6..a68f7ff12d 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -13,10 +13,39 @@ #define ITERATORS_H #include "ParagraphList_fwd.h" +#include "InsetList.h" -#include +#include "support/types.h" -class ParIterator { +#include + +#include + +class LyXText; +class InsetBase; +class Cursor; +class Buffer; +class PosIterator; + + +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); @@ -25,6 +54,8 @@ public: /// ParIterator(ParIterator const &); /// + ParIterator(PosIterator const &); + /// void operator=(ParIterator const &); /// ParIterator & operator++(); @@ -38,14 +69,22 @@ public: ParagraphList::iterator pit() const; /// ParagraphList & plist() const; + /// returns 'innermost' LyXText + LyXText * text(Buffer &) const; + /// returns innermost inset + InsetBase * inset() const; + /// returns index of cell in innermost inset + int index() const; /// size_t size() const; - /// - friend - bool operator==(ParIterator const & iter1, ParIterator const & iter2); + + typedef std::vector PosHolder; + PosHolder const & positions() const + { + return positions_; + } private: - struct Pimpl; - boost::scoped_ptr pimpl_; + PosHolder positions_; }; /// @@ -55,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); @@ -76,13 +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,