2 * This file is part of LyX, the document processor.
3 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
13 #include "pariterator.h"
15 #include "ParagraphList_fwd.h"
16 #include "paragraph.h"
19 #include "insets/inset.h"
28 ParIterator::ParIterator(DocIterator const & cur) : DocIterator(cur)
32 ParIterator par_iterator_begin(InsetBase & inset)
34 return ParIterator(doc_iterator_begin(inset));
38 ParIterator par_iterator_end(InsetBase & inset)
40 return ParIterator(doc_iterator_end(inset));
44 ParIterator::ParIterator(ParIterator const & pi)
45 : DocIterator(DocIterator(pi))
49 ParIterator & ParIterator::operator++()
56 ParIterator ParIterator::operator++(int)
58 ParIterator tmp(*this);
65 // Unused member functions. Also having this makes ParIterator not be
66 // an forward iterator anymore. So unless we change that, this function
67 // should not be compiled/used. (Lgb)
68 ParIterator & ParIterator::operator--()
73 // DocIterator::backwardPar();
79 Paragraph & ParIterator::operator*() const
81 return const_cast<Paragraph&>(text()->getPar(pit()));
85 pit_type ParIterator::pit() const
87 return DocIterator::pit();
91 Paragraph * ParIterator::operator->() const
93 return const_cast<Paragraph*>(&text()->getPar(pit()));
97 pit_type ParIterator::outerPar() const
99 return bottom().pit();
103 ParagraphList & ParIterator::plist() const
105 return const_cast<ParagraphList&>(text()->paragraphs());
109 bool operator==(ParIterator const & iter1, ParIterator const & iter2)
111 return DocIterator(iter1) == DocIterator(iter2);
115 bool operator!=(ParIterator const & iter1, ParIterator const & iter2)
117 return !(iter1 == iter2);
121 DocIterator makeDocIterator(ParIterator const & par, lyx::pos_type pos)
123 DocIterator dit(par);
135 ParConstIterator::ParConstIterator(DocIterator const & dit)
140 ParConstIterator::ParConstIterator(ParConstIterator const & pi)
141 : DocIterator(DocIterator(pi))
145 ParConstIterator & ParConstIterator::operator++()
147 DocIterator::forwardPar();
152 Paragraph const & ParConstIterator::operator*() const
154 return text()->getPar(pit());
158 Paragraph const * ParConstIterator::operator->() const
160 return &text()->getPar(pit());
164 ParagraphList const & ParConstIterator::plist() const
166 return text()->paragraphs();
170 bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2)
172 return DocIterator(iter1) == DocIterator(iter2);
176 bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2)
178 return !(iter1 == iter2);
183 #warning const correctness!
186 ParConstIterator par_const_iterator_begin(InsetBase const & inset)
188 return ParConstIterator(doc_iterator_begin(const_cast<InsetBase &>(inset)));
192 ParConstIterator par_const_iterator_end(InsetBase const & inset)
194 return ParConstIterator(doc_iterator_end(const_cast<InsetBase &>(inset)));