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"
30 class ParIterator
: public std::iterator
<std::forward_iterator_tag
, Paragraph
>,
34 typedef std::iterator
<std::forward_iterator_tag
, Paragraph
> StdIt
;
36 typedef StdIt::value_type value_type
;
37 typedef StdIt::difference_type difference_type
;
38 typedef StdIt::pointer pointer
;
39 typedef StdIt::reference reference
;
43 ParIterator(Buffer
* buf
) : DocIterator(buf
) {}
46 ParIterator(Buffer
* buf
, Inset
&, pit_type pit
);
48 ParIterator(ParIterator
const &);
50 explicit ParIterator(DocIterator
const &);
52 /// This really should be implemented...
53 //ParIterator & operator=(ParIterator const &);
55 ParIterator
& operator++();
57 ParIterator
operator++(int);
58 /// See comment in ParIterator.cpp
59 //ParIterator & operator--();
61 Paragraph
& operator*() const;
63 Paragraph
* operator->() const;
64 /// This gives us the top-most parent paragraph
65 pit_type
outerPar() const;
69 /// return the paragraph this cursor is in
70 pit_type
& pit() { return DocIterator::pit(); }
72 ParagraphList
& plist() const;
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(Buffer
const * buf
);
101 ParConstIterator(ParConstIterator
const &);
103 explicit ParConstIterator(DocIterator
const &);
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);