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"
27 class ParIterator : public std::iterator<std::forward_iterator_tag, Paragraph>,
31 typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt;
33 typedef StdIt::value_type value_type;
34 typedef StdIt::difference_type difference_type;
35 typedef StdIt::pointer pointer;
36 typedef StdIt::reference reference;
40 ParIterator(Buffer * buf) : DocIterator(buf) {}
43 ParIterator(Buffer * buf, Inset &, pit_type pit);
45 ParIterator(ParIterator const &);
47 explicit ParIterator(DocIterator const &);
49 /// This really should be implemented...
50 //ParIterator & operator=(ParIterator const &);
52 ParIterator & operator++();
54 ParIterator operator++(int);
55 /// See comment in ParIterator.cpp
56 //ParIterator & operator--();
58 Paragraph & operator*() const;
60 Paragraph * operator->() const;
61 /// This gives us the top-most parent paragraph
62 pit_type outerPar() const;
66 /// return the paragraph this cursor is in
67 pit_type & pit() { return DocIterator::pit(); }
69 ParagraphList & plist() const;
73 ParIterator par_iterator_begin(Inset & inset);
75 ParIterator par_iterator_end(Inset & inset);
79 //bool operator==(ParIterator const & it1, ParIterator const & it2);
81 // FIXME: Unfortunately operator!=(ParIterator &, ParIterator &) is
82 // implemented with operator!=(DocIterator &, DocIterator &) that gives
83 // false if the positions are different, even if the pars are the same.
84 // So ultimately it's a bug in operator!=(ParIterator &, ParIterator &)
85 // I'd say (nevertheless, I would be reluctant to change it, because I
86 // fear that some part of the code could rely on this "bug". --Alfredo
87 //bool operator!=(ParIterator const & it1, ParIterator const & it2);
90 class ParConstIterator : public std::iterator<std::forward_iterator_tag,
96 ParConstIterator(Buffer const * buf);
98 ParConstIterator(ParConstIterator const &);
100 explicit ParConstIterator(DocIterator const &);
102 void push_back(Inset const &);
104 ParConstIterator & operator++();
106 ParConstIterator & operator--();
108 Paragraph const & operator*() const;
110 Paragraph const * operator->() const;
112 ParagraphList const & plist() const;
115 //bool operator==(ParConstIterator const & it1, ParConstIterator const & it2);
117 //bool operator!=(ParConstIterator const & it1, ParConstIterator const & it2);