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"
17 #include "support/LOstream.h"
19 using namespace lyx::support;
24 CursorPos::CursorPos()
25 : inset_(0), idx_(0), pos_(0)
29 CursorPos::CursorPos(MathInset * p)
30 : inset_(p), idx_(0), pos_(0)
37 MathArray & CursorPos::cell(MathArray::idx_type idx) const
40 return inset_->cell(idx);
44 MathArray & CursorPos::cell() const
47 return inset_->cell(idx_);
51 void CursorPos::getPos(int & x, int & y) const
53 inset_->getPos(idx_, pos_, x, y);
57 void CursorPos::setPos(MathArray::pos_type pos)
63 std::ostream & operator<<(std::ostream & os, CursorPos const & p)
65 os << "(par: " << p.inset_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')';
70 bool operator==(CursorPos const & p, CursorPos const & q)
72 return p.inset_ == q.inset_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
76 bool operator!=(CursorPos const & p, CursorPos const & q)
78 return p.inset_ != q.inset_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
82 bool operator<(CursorPos const & p, CursorPos const & q)
84 if (p.inset_ != q.inset_) {
85 lyxerr << "can't compare cursor and anchor in different insets"
90 return p.idx_ < q.idx_;
91 return p.pos_ < q.pos_;