X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FDocIterator.h;h=d994c3a1e7a20a50007e4eabddb91b0e007a5c74;hb=1ab314f8e6e145dc73d0a26b7e82a280b497ea3c;hp=4feff6c4a8c3ff3bda68e01923b637f314dc0f67;hpb=32fe0493334a623de5feefcb58af786d57372183;p=lyx.git diff --git a/src/DocIterator.h b/src/DocIterator.h index 4feff6c4a8..d994c3a1e7 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -23,6 +23,7 @@ class LyXErr; class MathAtom; class Paragraph; class Text; +class InsetIterator; // The public inheritance should go in favour of a suitable data member @@ -40,8 +41,6 @@ public: public: /// DocIterator(); - /// - explicit DocIterator(Inset & inset); /// access slice at position \p i CursorSlice const & operator[](size_t i) const { return slices_[i]; } @@ -57,6 +56,8 @@ public: /// does this iterator have any content? bool empty() const { return slices_.empty(); } + /// is this the end position? + bool atEnd() const { return slices_.empty(); } // // access to slice at tip @@ -211,19 +212,24 @@ public: bool fixIfBroken(); /// find index of CursorSlice with &cell() == &cell (or -1 if not found) - idx_type find(MathData const & cell) const; + int find(MathData const & cell) const; /// find index of CursorSlice with inset() == inset (or -1 of not found) - idx_type find(InsetMath const * inset) const; - /// cut off CursorSlices with index > above and store cut off slices in cut - void cutOff(idx_type above, std::vector & cut); + int find(InsetMath const * inset) const; + /// cut off CursorSlices with index > above and store cut off slices in cut. + void cutOff(int above, std::vector & cut); /// cut off CursorSlices with index > above - void cutOff(idx_type above); + void cutOff(int above); /// push CursorSlices on top void append(std::vector const & x); /// push one CursorSlice on top and set its index and position void append(idx_type idx, pos_type pos); private: + friend class InsetIterator; + friend DocIterator doc_iterator_begin(Inset & inset); + friend DocIterator doc_iterator_end(Inset & inset); + /// + explicit DocIterator(Inset & inset); /** * Normally, when the cursor is at position i, it is painted *before* * the character at position i. However, what if we want the cursor