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::operator[];
22 using base_type::size_type;
23 using base_type::difference_type;
24 using base_type::const_iterator;
25 friend bool operator!=(MathIterator const &, MathIterator const &);
26 friend bool operator==(MathIterator const &, MathIterator const &);
28 /// default constructor
30 /// start with given inset
31 explicit MathIterator(MathInset * p);
33 MathCursorPos const & operator*() const;
35 MathCursorPos const & operator->() const;
38 /// move on several steps
39 void jump(difference_type);
40 /// read access to top most inset
41 MathInset const * par() const;
42 /// read access to top most inset
46 /// read access to top most item
47 MathArray const & cell() const;
51 void push(MathInset *);
57 bool operator==(MathIterator const &, MathIterator const &);
59 bool operator!=(MathIterator const &, MathIterator const &);
62 MathIterator ibegin(MathInset * p);
64 MathIterator iend(MathInset * p);