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"
28 class ParIterator : public std::iterator<std::forward_iterator_tag, Paragraph>,
32 typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt;
34 typedef StdIt::value_type value_type;
35 typedef StdIt::difference_type difference_type;
36 typedef StdIt::pointer pointer;
37 typedef StdIt::reference reference;
41 ParIterator(Buffer * buf) : DocIterator(buf) {}
43 ParIterator(ParIterator const & pi) :
44 DocIterator(DocIterator(pi)) {}
46 explicit ParIterator(DocIterator const & dit) :
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)
97 : DocIterator(const_cast<Buffer *>(buf)) {}
99 ParConstIterator(ParConstIterator const & pi)
100 : DocIterator(DocIterator(pi)) {}
102 explicit ParConstIterator(DocIterator const & dit)
103 : DocIterator(dit) {}
105 void push_back(Inset const &);
107 ParConstIterator & operator++();
109 ParConstIterator & operator--();
111 Paragraph const & operator*() const;
113 Paragraph const * operator->() const;
115 ParagraphList const & plist() const;
118 //bool operator==(ParConstIterator const & it1, ParConstIterator const & it2);
120 //bool operator!=(ParConstIterator const & it1, ParConstIterator const & it2);