]> git.lyx.org Git - features.git/blob - src/mathed/math_iterator.h
more math iterator adjustment
[features.git] / src / mathed / math_iterator.h
1 // -*- C++ -*-
2 /**
3  * \file math_iterator.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef MATH_ITERATOR_H
13 #define MATH_ITERATOR_H
14
15 #include "cursor_slice.h"
16
17 #include <vector>
18
19
20 // this is used for traversing math insets
21
22 class MathIterator : private std::vector<CursorSlice> {
23 public:
24         // re-use inherited stuff
25         typedef std::vector<CursorSlice> base_type;
26         using base_type::clear;
27         using base_type::size;
28         using base_type::push_back;
29         using base_type::pop_back;
30         using base_type::back;
31         using base_type::begin;
32         using base_type::end;
33         using base_type::erase;
34         using base_type::operator[];
35         using base_type::size_type;
36         using base_type::difference_type;
37         using base_type::const_iterator;
38         friend bool operator!=(MathIterator const &, MathIterator const &);
39         friend bool operator==(MathIterator const &, MathIterator const &);
40
41         /// move on one step
42         void operator++();
43         /// read access to top most item
44         MathArray const & cell() const;
45 };
46
47 ///
48 bool operator==(MathIterator const &, MathIterator const &);
49 ///
50 bool operator!=(MathIterator const &, MathIterator const &);
51
52 ///
53 MathIterator ibegin(MathInset * p);
54 ///
55 MathIterator iend(MathInset * p);
56
57 #endif