3 #include "math_rowst.h"
4 #include "support/LAssert.h"
11 MathedRowStruct::MathedRowStruct()
12 : asc_(0), desc_(0), y_(0), numbered_(true)
16 string const & MathedRowStruct::getLabel() const
22 bool MathedRowStruct::isNumbered() const
28 int MathedRowStruct::getBaseline() const
34 void MathedRowStruct::setBaseline(int b)
40 int MathedRowStruct::ascent() const
46 int MathedRowStruct::descent() const
52 void MathedRowStruct::ascent(int a)
58 void MathedRowStruct::descent(int d)
64 int MathedRowStruct::getTab(unsigned int i) const
66 return i < widths_.size() ? widths_[i] : 0;
70 void MathedRowStruct::setLabel(string const & l)
76 void MathedRowStruct::setNumbered(bool nf)
82 void MathedRowStruct::setTab(unsigned int i, int t)
84 if (i >= widths_.size())
85 widths_.resize(i + 2);
96 MathedRowContainer::iterator MathedRowContainer::begin()
98 return iterator(this);
102 MathedRowContainer::iterator MathedRowContainer::end()
105 it.pos_ = data_.size();
110 bool MathedRowContainer::empty() const
112 return data_.size() == 0;
116 void MathedRowContainer::insert(iterator const & it)
118 lyx::Assert(it.st_ == this);
119 data_.insert(data_.begin() + it.pos_, MathedRowStruct());
123 void MathedRowContainer::erase(iterator & it)
125 lyx::Assert(it.st_ == this);
126 data_.erase(data_.begin() + it.pos_);
130 MathedRowStruct & MathedRowContainer::back()
132 lyx::Assert(data_.size());
137 MathedRowStruct const & MathedRowContainer::back() const
139 lyx::Assert(data_.size());
144 void MathedRowContainer::push_back()
146 data_.push_back(MathedRowStruct());
150 MathedRowContainer::size_type MathedRowContainer::size() const
158 // MathedRowContainer::iterator
161 MathedRowContainer::iterator::iterator()
166 MathedRowContainer::iterator::iterator(MathedRowContainer * m)
171 MathedRowContainer::iterator::operator void *() const
173 return (void *)(st_ && pos_ < st_->size());
177 MathedRowStruct * MathedRowContainer::iterator::operator->()
180 return &st_->data_[pos_];
184 MathedRowStruct const * MathedRowContainer::iterator::operator->() const
187 return &st_->data_[pos_];
191 void MathedRowContainer::iterator::operator++()
198 bool MathedRowContainer::iterator::is_last() const
201 return pos_ == st_->size() - 1;
205 bool MathedRowContainer::iterator::operator==(const iterator & it) const
207 return st_ == it.st_ && pos_ == it.pos_;