]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_iterator.C
drop another function unknown to the outer world...
[lyx.git] / src / mathed / math_iterator.C
index aa2d5a8b55220d9ab503946651372e505c4e9775..8c11cad1196d5d6e76f1519ccec6b79336414807 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "math_iterator.h"
 #include "math_inset.h"
+#include "math_data.h"
 
 #include <boost/assert.hpp>
 
@@ -26,22 +27,11 @@ MathIterator::MathIterator(MathInset * p)
 }
 
 
-MathInset const * MathIterator::inset() const
-{
-       return back().inset_;
-}
-
-
-MathInset * MathIterator::inset()
-{
-       return back().inset_;
-}
-
 
 MathArray const & MathIterator::cell() const
 {
-       CursorPos const & top = back();
-       return top.inset_->cell(top.idx_);
+       CursorSlice const & top = back();
+       return top.asMathInset()->cell(top.idx_);
 }
 
 
@@ -49,7 +39,7 @@ MathArray const & MathIterator::cell() const
 void MathIterator::push(MathInset * p)
 {
        //lyxerr << "push: " << p << endl;
-       push_back(CursorPos(p));
+       push_back(CursorSlice(p));
 }
 
 
@@ -61,30 +51,18 @@ void MathIterator::pop()
 }
 
 
-CursorPos const & MathIterator::operator*() const
-{
-       return back();
-}
-
-
-CursorPos const & MathIterator::operator->() const
-{
-       return back();
-}
-
-
 void MathIterator::goEnd()
 {
-       CursorPos & top = back();
-       top.idx_ = top.inset_->nargs() - 1;
+       CursorSlice & top = back();
+       top.idx_ = top.asMathInset()->nargs() - 1;
        top.pos_ = cell().size();
 }
 
 
 void MathIterator::operator++()
 {
-       CursorPos & top = back();
-       MathArray     & ar  = top.inset_->cell(top.idx_);
+       CursorSlice & top = back();
+       MathArray   & ar  = top.asMathInset()->cell(top.idx_);
 
        // move into the current inset if possible
        // it is impossible for pos() == size()!
@@ -104,10 +82,10 @@ void MathIterator::operator++()
        }
 
        // otherwise try to move on one cell if possible
-       while (top.idx_ + 1 < top.inset_->nargs()) {
+       while (top.idx_ + 1 < top.asMathInset()->nargs()) {
                // idx() == nargs() is _not_ valid!
                ++top.idx_;
-               if (top.inset_->validCell(top.idx_)) {
+               if (top.asMathInset()->validCell(top.idx_)) {
                        top.pos_ = 0;
                        return;
                }
@@ -121,14 +99,6 @@ void MathIterator::operator++()
 }
 
 
-void MathIterator::jump(difference_type i)
-{
-       back().pos_ += i;
-       //BOOST_ASSERT(back().pos_ >= 0);
-       BOOST_ASSERT(back().pos_ <= cell().size());
-}
-
-
 bool MathIterator::normal() const
 {
        return back().pos_ < cell().size();