class MathAtom;
class Paragraph;
class Text;
+class InsetIterator;
// The public inheritance should go in favour of a suitable data member
public:
///
DocIterator();
- ///
- explicit DocIterator(Inset & inset);
/// access slice at position \p i
CursorSlice const & operator[](size_t i) const { return slices_[i]; }
/// 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
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<CursorSlice> & cut);
+ int find(Inset const * inset) const;
+ /// cut off CursorSlices with index > above and store cut off slices in cut.
+ void cutOff(int above, std::vector<CursorSlice> & cut);
/// cut off CursorSlices with index > above
- void cutOff(idx_type above);
+ void cutOff(int above);
/// push CursorSlices on top
void append(std::vector<CursorSlice> 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
}
+inline
+bool operator>=(DocIterator const & p, DocIterator const & q)
+{
+ return !(p < q);
+}
+
+
// The difference to a ('non stable') DocIterator is the removed
// (overwritten by 0...) part of the CursorSlice data items. So this thing
// is suitable for external storage, but not for iteration as such.