2 #ifndef MATH_ITERATOR_H
3 #define MATH_ITERATOR_H
9 // this is used for traversing math insets
11 class MathIterator : private std::vector<MathCursorPos> {
13 // re-use inherited stuff
14 typedef std::vector<MathCursorPos> base_type;
15 using base_type::clear;
16 using base_type::size;
17 using base_type::push_back;
18 using base_type::pop_back;
19 using base_type::back;
20 using base_type::begin;
22 using base_type::erase;
23 using base_type::operator[];
24 using base_type::size_type;
25 using base_type::difference_type;
26 using base_type::const_iterator;
27 friend bool operator!=(MathIterator const &, MathIterator const &);
28 friend bool operator==(MathIterator const &, MathIterator const &);
30 /// default constructor
32 /// start with given inset
33 explicit MathIterator(MathInset * p);
35 MathCursorPos const & operator*() const;
37 MathCursorPos const & operator->() const;
40 /// move on several steps
41 void jump(difference_type);
42 /// read access to top most inset
43 MathInset const * par() const;
44 /// read access to top most inset
48 /// read access to top most item
49 MathArray const & cell() const;
50 /// is this a non-end position
52 /// shrinks to at most i levels
53 void shrink(size_type i);
57 void push(MathInset *);
63 bool operator==(MathIterator const &, MathIterator const &);
65 bool operator!=(MathIterator const &, MathIterator const &);
68 MathIterator ibegin(MathInset * p);
70 MathIterator iend(MathInset * p);