2 #ifndef MATH_ITERATOR_H
3 #define MATH_ITERATOR_H
8 // this is used for traversing math insets
10 class MathIterator : private std::vector<MathCursorPos> {
12 // re-use inherited stuff
13 typedef std::vector<MathCursorPos> base_type;
14 using base_type::clear;
15 using base_type::size;
16 using base_type::push_back;
17 using base_type::pop_back;
18 using base_type::back;
19 using base_type::begin;
21 using base_type::erase;
22 using base_type::operator[];
23 using base_type::size_type;
24 using base_type::difference_type;
25 using base_type::const_iterator;
26 friend bool operator!=(MathIterator const &, MathIterator const &);
27 friend bool operator==(MathIterator const &, MathIterator const &);
29 /// default constructor
31 /// start with given inset
32 explicit MathIterator(MathInset * p);
34 MathCursorPos const & operator*() const;
36 MathCursorPos const & operator->() const;
39 /// move on several steps
40 void jump(difference_type);
41 /// read access to top most inset
42 MathInset const * par() const;
43 /// read access to top most inset
47 /// read access to top most item
48 MathArray const & cell() const;
49 /// shrinks to at most i levels
50 void shrink(size_type i);
54 void push(MathInset *);
60 bool operator==(MathIterator const &, MathIterator const &);
62 bool operator!=(MathIterator const &, MathIterator const &);
65 MathIterator ibegin(MathInset * p);
67 MathIterator iend(MathInset * p);