2 #ifndef MATH_ITERATOR_H
3 #define MATH_ITERATOR_H
12 // this is used for traversing math insets
14 class MathIterator : private std::vector<MathCursorPos> {
16 // re-use inherited stuff
17 typedef std::vector<MathCursorPos> base_type;
18 using base_type::clear;
19 using base_type::size;
20 using base_type::push_back;
21 using base_type::pop_back;
22 using base_type::back;
23 using base_type::begin;
25 using base_type::erase;
26 using base_type::operator[];
27 using base_type::size_type;
28 using base_type::difference_type;
29 using base_type::const_iterator;
30 friend bool operator!=(MathIterator const &, MathIterator const &);
31 friend bool operator==(MathIterator const &, MathIterator const &);
33 /// default constructor
35 /// start with given inset
36 explicit MathIterator(MathInset * p);
38 MathCursorPos const & operator*() const;
40 MathCursorPos const & operator->() const;
43 /// move on several steps
44 void jump(difference_type);
45 /// read access to top most inset
46 MathInset const * par() const;
47 /// read access to top most inset
51 /// read access to top most item
52 MathArray const & cell() const;
53 /// is this a non-end position
55 /// shrinks to at most i levels
56 void shrink(size_type i);
60 void push(MathInset *);
66 bool operator==(MathIterator const &, MathIterator const &);
68 bool operator!=(MathIterator const &, MathIterator const &);
71 MathIterator ibegin(MathInset * p);
73 MathIterator iend(MathInset * p);