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 explicit 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 & it1, ParIterator const & it2);
84 // FIXME: Unfortunately operator!=(ParIterator &, ParIterator &) is
85 // implemented with operator!=(DocIterator &, DocIterator &) that gives
86 // false if the positions are different, even if the pars are the same.
87 // So ultimately it's a bug in operator!=(ParIterator &, ParIterator &)
88 // I'd say (nevertheless, I would be reluctant to change it, because I
89 // fear that some part of the code could rely on this "bug". --Alfredo
90 //bool operator!=(ParIterator const & it1, ParIterator const & it2);
93 class ParConstIterator : public std::iterator<std::forward_iterator_tag,
99 ParConstIterator() : DocIterator() {}
101 ParConstIterator(ParConstIterator const &);
103 explicit 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 & it1, ParConstIterator const & it2);
119 //bool operator!=(ParConstIterator const & it1, ParConstIterator const & it2);
122 ParConstIterator par_const_iterator_begin(Inset const & inset);
124 ParConstIterator par_const_iterator_end(Inset const & inset);