//{}
-MathIterator::MathIterator(MathAtom & t)
+MathIterator::MathIterator(MathInset * p)
{
- push(t);
+ push(p);
}
-MathIterator::MathIterator(MathCursor::cursor_type const & c)
- : cursor_(c)
-{}
+//MathIterator::MathIterator(MathCursor::cursor_type const & c)
+// : cursor_(c)
+//{}
MathCursorPos const & MathIterator::position() const
}
-MathAtom const & MathIterator::par() const
+MathInset const * MathIterator::par() const
{
- return *(position().par_);
+ return position().par_;
}
-MathAtom & MathIterator::par()
+MathInset * MathIterator::par()
{
- return *(position().par_);
+ return position().par_;
}
}
-MathAtom * MathIterator::nextInset() const
+MathArray const & MathIterator::cell() const
+{
+ return par()->xcell(position().idx_).data_;
+}
+
+
+MathInset * MathIterator::nextInset() const
{
if (position().pos_ == xcell().data_.size())
return 0;
- return const_cast<MathAtom *>(&*(xcell().begin() + position().pos_));
+ return (xcell().begin() + position().pos_)->nucleus();
}
-void MathIterator::push(MathAtom & t)
+void MathIterator::push(MathInset * p)
{
//lyxerr << "push: " << p << endl;
- cursor_.push_back(MathCursorPos(t));
+ cursor_.push_back(MathCursorPos(p));
}
{
// move into the current inset if possible
// it is impossible for pos() == size()!
- if (nextInset() && nextInset()->nucleus()->isActive()) {
- push(*nextInset());
+ if (nextInset() && nextInset()->isActive()) {
+ push(nextInset());
return;
}
}
+void MathIterator::jump(MathInset::difference_type i)
+{
+ position().pos_ += i;
+ //lyx::Assert(position().pos_ >= 0);
+ lyx::Assert(position().pos_ <= cell().size());
+}
+
bool operator==(MathIterator const & it, MathIterator const & jt)
{
}
-
-MathIterator ibegin(MathAtom & t)
+MathIterator ibegin(MathInset * p)
{
- return MathIterator(t);
+ return MathIterator(p);
}
-MathIterator iend(MathAtom & t)
+MathIterator iend(MathInset * p)
{
- MathIterator it(t);
+ MathIterator it(p);
it.goEnd();
return it;
}