3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
15 #include "DocIterator.h"
17 #include "support/types.h"
29 class ParIterator : public std::iterator<std::forward_iterator_tag, Paragraph>,
33 typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt;
35 typedef StdIt::value_type value_type;
36 typedef StdIt::difference_type difference_type;
37 typedef StdIt::pointer pointer;
38 typedef StdIt::reference reference;
41 ParIterator() : DocIterator() {}
44 ParIterator(Inset &, pit_type pit);
46 ParIterator(ParIterator const &);
48 ParIterator(DocIterator const &);
50 /// This really should be implemented...
51 //ParIterator & operator=(ParIterator const &);
53 ParIterator & operator++();
55 ParIterator operator++(int);
56 /// See comment in ParIterator.cpp
57 //ParIterator & operator--();
59 Paragraph & operator*() const;
61 Paragraph * operator->() const;
62 /// This gives us the top-most parent paragraph
63 pit_type outerPar() const;
67 /// return the paragraph this cursor is in
68 pit_type & pit() { return DocIterator::pit(); }
70 ParagraphList & plist() const;
74 DocIterator makeDocIterator(ParIterator const &, pos_type);
76 ParIterator par_iterator_begin(Inset & inset);
78 ParIterator par_iterator_end(Inset & inset);
82 bool operator==(ParIterator const & iter1, ParIterator const & iter2);
84 // FIXME: Unfortunately operator!=(ParIterator &, ParIterator &) is implemented with
85 // operator!=(DocIterator &, DocIterator &) that gives false if the positions
86 // are different, even if the pars are the same. So ultimately it's a bug in
87 // operator!=(ParIterator &, ParIterator &) I'd say (nevertheless, I would be
88 // reluctant to change it, because I fear that some part of the code could rely on
89 // this "bug". --Alfredo
90 bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
93 class ParConstIterator : public std::iterator<std::forward_iterator_tag,
99 ParConstIterator(): DocIterator() {}
101 ParConstIterator(ParConstIterator const &);
103 ParConstIterator(DocIterator const &);
106 ParConstIterator & operator++();
108 ParConstIterator & operator--();
110 Paragraph const & operator*() const;
112 Paragraph const * operator->() const;
114 ParagraphList const & plist() const;
117 bool operator==(ParConstIterator const & iter1,
118 ParConstIterator const & iter2);
120 bool operator!=(ParConstIterator const & iter1,
121 ParConstIterator const & iter2);
124 ParConstIterator par_const_iterator_begin(Inset const & inset);
126 ParConstIterator par_const_iterator_end(Inset const & inset);