4 #include "math_inset.h"
6 #include "support/LAssert.h"
7 #include "support/LOstream.h"
10 MathCursorPos::MathCursorPos()
11 : par_(0), idx_(0), pos_(0)
15 MathCursorPos::MathCursorPos(MathInset * p)
16 : par_(p), idx_(0), pos_(0)
23 MathArray & MathCursorPos::cell(MathArray::idx_type idx) const
26 return par_->cell(idx);
30 MathArray & MathCursorPos::cell() const
33 return par_->cell(idx_);
37 void MathCursorPos::getPos(int & x, int & y) const
39 par_->getPos(idx_, pos_, x, y);
43 void MathCursorPos::setPos(MathArray::pos_type pos)
49 std::ostream & operator<<(std::ostream & os, MathCursorPos const & p)
51 os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')';
56 bool operator==(MathCursorPos const & p, MathCursorPos const & q)
58 return p.par_ == q.par_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
62 bool operator!=(MathCursorPos const & p, MathCursorPos const & q)
64 return p.par_ != q.par_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
68 bool operator<(MathCursorPos const & p, MathCursorPos const & q)
70 if (p.par_ != q.par_) {
71 lyxerr << "can't compare cursor and anchor in different insets\n";
75 return p.idx_ < q.idx_;
76 return p.pos_ < q.pos_;