]> git.lyx.org Git - lyx.git/blob - src/pariterator.h
* src/tabular.[Ch]: simplify plaintext methods, because there
[lyx.git] / src / pariterator.h
1 // -*- C++ -*-
2 /* \file pariterator.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef PARITERATOR_H
13 #define PARITERATOR_H
14
15 #include "dociterator.h"
16 #include "ParagraphList_fwd.h"
17
18 #include "support/types.h"
19
20 #include <boost/optional.hpp>
21
22 #include <vector>
23
24
25 namespace lyx {
26
27
28
29 class InsetBase;
30 class LyXText;
31
32
33 class ParIterator : public std::iterator<std::forward_iterator_tag, Paragraph>,
34                     public DocIterator
35 {
36 public:
37         typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt;
38
39         typedef StdIt::value_type value_type;
40         typedef StdIt::difference_type difference_type;
41         typedef StdIt::pointer pointer;
42         typedef StdIt::reference reference;
43
44         ///
45         ParIterator() : DocIterator() {}
46
47
48         ///
49         ParIterator(InsetBase &, pit_type pit);
50         ///
51         ParIterator(ParIterator const &);
52         ///
53         ParIterator(DocIterator const &);
54
55         /// This really should be implemented...
56         //ParIterator & operator=(ParIterator const &);
57         ///
58         ParIterator & operator++();
59         ///
60         ParIterator operator++(int);
61         /// See comment in pariterator.C
62         //ParIterator & operator--();
63         ///
64         Paragraph & operator*() const;
65         ///
66         Paragraph * operator->() const;
67         /// This gives us the top-most parent paragraph
68         pit_type outerPar() const;
69         ///
70         pit_type pit() const;
71         ///
72         /// return the paragraph this cursor is in
73         pit_type & pit() { return DocIterator::pit(); }
74
75         ParagraphList & plist() const;
76 };
77
78
79 DocIterator makeDocIterator(ParIterator const &, pos_type);
80
81 ParIterator par_iterator_begin(InsetBase & inset);
82
83 ParIterator par_iterator_end(InsetBase & inset);
84
85
86 ///
87 bool operator==(ParIterator const & iter1, ParIterator const & iter2);
88
89 ///
90 bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
91
92
93 class ParConstIterator : public std::iterator<std::forward_iterator_tag,
94                          Paragraph>,
95                          public DocIterator
96 {
97 public:
98         ///
99         ParConstIterator(): DocIterator() {}
100         ///
101         ParConstIterator(ParConstIterator const &);
102         ///
103         ParConstIterator(DocIterator const &);
104         ///
105
106         ParConstIterator & operator++();
107         ///
108         ParConstIterator & operator--();
109         ///
110         Paragraph const & operator*() const;
111         ///
112         Paragraph const * operator->() const;
113         ///
114         ParagraphList const & plist() const;
115 };
116
117 bool operator==(ParConstIterator const & iter1,
118                 ParConstIterator const & iter2);
119
120 bool operator!=(ParConstIterator const & iter1,
121                 ParConstIterator const & iter2);
122
123
124 ParConstIterator par_const_iterator_begin(InsetBase const & inset);
125
126 ParConstIterator par_const_iterator_end(InsetBase const & inset);
127
128
129
130 } // namespace lyx
131
132 #endif