]> git.lyx.org Git - lyx.git/blobdiff - src/pariterator.C
hopefully fix tex2lyx linking.
[lyx.git] / src / pariterator.C
index efb94c14ead80409cfba8491f8c1ad59534eb05c..90199a702b379ef444312431976fd0079fcf65bc 100644 (file)
@@ -8,10 +8,8 @@
  * Full author contact details are available in file CREDITS.
  */
 
-
 #include <config.h>
 
-
 #include "pariterator.h"
 
 #include "ParagraphList_fwd.h"
@@ -20,7 +18,8 @@
 
 #include "insets/inset.h"
 
-using lyx::par_type;
+
+namespace lyx {
 
 ///
 /// ParIterator
@@ -54,40 +53,56 @@ ParIterator & ParIterator::operator++()
 }
 
 
+ParIterator ParIterator::operator++(int)
+{
+       ParIterator tmp(*this);
+       forwardPar();
+       return tmp;
+}
+
+
+#if 0
+// Unused member functions. Also having this makes ParIterator not be
+// an forward iterator anymore. So unless we change that, this function
+// should not be compiled/used. (Lgb)
 ParIterator & ParIterator::operator--()
 {
+#ifdef WITH_WARNINGS
+#warning look here
+#endif
 //     DocIterator::backwardPar();
        return *this;
 }
+#endif
 
 
 Paragraph & ParIterator::operator*() const
 {
-       return text()->getPar(par());
+       return const_cast<Paragraph&>(text()->getPar(pit()));
 }
 
 
-par_type ParIterator::pit() const
+pit_type ParIterator::pit() const
 {
-       return par();
+       return DocIterator::pit();
 }
 
 
 Paragraph * ParIterator::operator->() const
 {
-       return &text()->getPar(par());
+       return const_cast<Paragraph*>(&text()->getPar(pit()));
 }
 
 
-par_type ParIterator::outerPar() const
+pit_type ParIterator::outerPar() const
 {
-       return bottom().par();
+       return bottom().pit();
 }
 
 
 ParagraphList & ParIterator::plist() const
 {
-       return text()->paragraphs();
+       return const_cast<ParagraphList&>(text()->paragraphs());
 }
 
 
@@ -102,14 +117,16 @@ bool operator!=(ParIterator const & iter1, ParIterator const & iter2)
        return !(iter1 == iter2);
 }
 
-DocIterator
-makeDocIterator(ParIterator const & par, lyx::pos_type pos)
+
+DocIterator makeDocIterator(ParIterator const & par, pos_type pos)
 {
        DocIterator dit(par);
        dit.pos() = pos;
        return dit;
 }
 
+
+
 ///
 /// ParConstIterator
 ///
@@ -134,13 +151,13 @@ ParConstIterator & ParConstIterator::operator++()
 
 Paragraph const & ParConstIterator::operator*() const
 {
-       return text()->getPar(par());
+       return text()->getPar(pit());
 }
 
 
 Paragraph const * ParConstIterator::operator->() const
 {
-       return &text()->getPar(par());
+       return &text()->getPar(pit());
 }
 
 
@@ -162,7 +179,9 @@ bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2)
 }
 
 
+#ifdef WITH_WARNINGS
 #warning const correctness!
+#endif
 
 ParConstIterator par_const_iterator_begin(InsetBase const & inset)
 {
@@ -174,3 +193,6 @@ ParConstIterator par_const_iterator_end(InsetBase const & inset)
 {
        return ParConstIterator(doc_iterator_end(const_cast<InsetBase &>(inset)));
 }
+
+
+} // namespace lyx