3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
8 * Full author contact details are available in file CREDITS.
14 #include "ParagraphList_fwd.h"
16 #include "iterators.h"
18 #include "support/types.h"
25 struct PosIteratorItem {
26 PosIteratorItem(ParagraphList * pl,
27 ParagraphList::iterator pit,
30 : pl(pl), pit(pit), pos(pos), index(index) {};
32 ParagraphList::iterator pit;
40 PosIterator(BufferView & bv);
41 PosIterator(ParIterator & par, lyx::pos_type pos);
42 PosIterator(ParagraphList * pl, ParagraphList::iterator pit,
44 PosIterator(ParIterator const & parit, lyx::pos_type p);
45 PosIterator & operator++();
46 PosIterator & operator--();
47 friend bool operator==(PosIterator const &, PosIterator const &);
49 ParagraphList::iterator pit() const { return stack_.back().pit; }
50 lyx::pos_type pos() const { return stack_.back().pos; }
52 InsetBase * inset() const;
53 friend PosIterator ParIterator::asPosIterator(lyx::pos_type) const;
54 friend ParIterator::ParIterator(PosIterator const &);
58 //this is conceptually a stack, but we need random access sometimes
59 std::vector<PosIteratorItem> stack_;
63 bool operator!=(PosIterator const &, PosIterator const &);
64 bool operator==(PosIterator const &, PosIterator const &);
66 int distance(PosIterator const &, PosIterator const &);
67 void advance(PosIterator &, int);