1 /* \file ParIterator.cpp
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 "CursorSlice.h"
18 #include "insets/Inset.h"
23 //////////////////////////////////////////////////////////////////////////
27 //////////////////////////////////////////////////////////////////////////
30 ParIterator par_iterator_begin(Inset & inset)
32 return ParIterator(doc_iterator_begin(&inset.buffer(), &inset));
36 ParIterator par_iterator_end(Inset & inset)
38 return ParIterator(doc_iterator_end(&inset.buffer(), &inset));
42 ParIterator & ParIterator::operator++()
49 ParIterator ParIterator::operator++(int)
51 ParIterator tmp(*this);
58 // Unused member functions. Also having this makes ParIterator not be
59 // an forward iterator anymore. So unless we change that, this function
60 // should not be compiled/used. (Lgb)
61 ParIterator & ParIterator::operator--()
64 // DocIterator::backwardPar();
70 Paragraph & ParIterator::operator*() const
72 return text()->getPar(pit());
76 pit_type ParIterator::pit() const
78 return DocIterator::pit();
82 Paragraph * ParIterator::operator->() const
84 return &text()->getPar(pit());
88 pit_type ParIterator::outerPar() const
90 return bottom().pit();
94 ParagraphList & ParIterator::plist() const
96 return text()->paragraphs();
100 //////////////////////////////////////////////////////////////////////////
104 //////////////////////////////////////////////////////////////////////////
107 void ParConstIterator::push_back(Inset const & inset)
109 DocIterator::push_back(CursorSlice(const_cast<Inset &>(inset)));
113 ParConstIterator & ParConstIterator::operator++()
115 DocIterator::forwardPar();
120 Paragraph const & ParConstIterator::operator*() const
122 return text()->getPar(pit());
126 Paragraph const * ParConstIterator::operator->() const
128 return &text()->getPar(pit());
132 ParagraphList const & ParConstIterator::plist() const
134 return text()->paragraphs();
138 bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2)
140 return static_cast<DocIterator const &>(iter1) == static_cast<DocIterator const &>(iter2);
144 bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2)
146 return !(iter1 == iter2);