]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_iterator.C
remove unneeded inset() member function
[lyx.git] / src / mathed / math_iterator.C
index bd15564ac0bb3836638e8b4f0d4eaa0f62766dc8..180de4602ff5daea747bc8b85a6bdfd8bd45a585 100644 (file)
 
 #include "math_iterator.h"
 #include "math_inset.h"
-#include "debug.h"
-#include "support/LAssert.h"
+#include "math_data.h"
+
+#include <boost/assert.hpp>
 
-using namespace lyx::support;
 
 MathIterator::MathIterator()
 {}
@@ -27,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_);
 }
 
 
@@ -50,25 +39,25 @@ MathArray const & MathIterator::cell() const
 void MathIterator::push(MathInset * p)
 {
        //lyxerr << "push: " << p << endl;
-       push_back(CursorPos(p));
+       push_back(CursorSlice(p));
 }
 
 
 void MathIterator::pop()
 {
        //lyxerr << "pop: " << endl;
-       Assert(size());
+       BOOST_ASSERT(size());
        pop_back();
 }
 
 
-CursorPos const & MathIterator::operator*() const
+CursorSlice const & MathIterator::operator*() const
 {
        return back();
 }
 
 
-CursorPos const & MathIterator::operator->() const
+CursorSlice const & MathIterator::operator->() const
 {
        return back();
 }
@@ -76,16 +65,16 @@ CursorPos const & MathIterator::operator->() const
 
 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()!
@@ -105,10 +94,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;
                }
@@ -125,8 +114,8 @@ void MathIterator::operator++()
 void MathIterator::jump(difference_type i)
 {
        back().pos_ += i;
-       //Assert(back().pos_ >= 0);
-       Assert(back().pos_ <= cell().size());
+       //BOOST_ASSERT(back().pos_ >= 0);
+       BOOST_ASSERT(back().pos_ <= cell().size());
 }