8 #include "math_inset.h"
10 #include "support/LAssert.h"
11 #include "support/LOstream.h"
14 MathCursorPos::MathCursorPos()
15 : par_(0), idx_(0), pos_(0)
19 MathCursorPos::MathCursorPos(MathInset * p)
20 : par_(p), idx_(0), pos_(0)
27 MathArray & MathCursorPos::cell(MathArray::idx_type idx) const
30 return par_->cell(idx);
34 MathArray & MathCursorPos::cell() const
37 return par_->cell(idx_);
41 void MathCursorPos::getPos(int & x, int & y) const
43 par_->getPos(idx_, pos_, x, y);
47 std::ostream & operator<<(std::ostream & os, MathCursorPos const & p)
49 os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ")";
54 bool operator==(MathCursorPos const & p, MathCursorPos const & q)
56 return p.par_ == q.par_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
60 bool operator!=(MathCursorPos const & p, MathCursorPos const & q)
62 return p.par_ != q.par_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
66 bool operator<(MathCursorPos const & p, MathCursorPos const & q)
68 if (p.par_ != q.par_) {
69 lyxerr << "can't compare cursor and anchor in different insets\n";
73 return p.idx_ < q.idx_;
74 return p.pos_ < q.pos_;