3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
14 #include "math_inset.h"
16 #include "support/LAssert.h"
18 using namespace lyx::support;
23 CursorPos::CursorPos()
24 : inset_(0), idx_(0), pos_(0)
28 CursorPos::CursorPos(MathInset * p)
29 : inset_(p), idx_(0), pos_(0)
36 MathArray & CursorPos::cell(MathArray::idx_type idx) const
39 return inset_->cell(idx);
43 MathArray & CursorPos::cell() const
46 return inset_->cell(idx_);
50 void CursorPos::getPos(int & x, int & y) const
52 inset_->getPos(idx_, pos_, x, y);
56 void CursorPos::setPos(MathArray::pos_type pos)
62 std::ostream & operator<<(std::ostream & os, CursorPos const & p)
64 os << "(par: " << p.inset_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')';
69 bool operator==(CursorPos const & p, CursorPos const & q)
71 return p.inset_ == q.inset_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
75 bool operator!=(CursorPos const & p, CursorPos const & q)
77 return p.inset_ != q.inset_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
81 bool operator<(CursorPos const & p, CursorPos const & q)
83 if (p.inset_ != q.inset_) {
84 lyxerr << "can't compare cursor and anchor in different insets"
89 return p.idx_ < q.idx_;
90 return p.pos_ < q.pos_;