3 #include "math_rowst.h"
4 #include "support/LAssert.h"
11 MathedRowStruct::MathedRowStruct()
12 : asc_(0), desc_(0), y_(0), numbered_(true)
15 string const & MathedRowStruct::getLabel() const
20 bool MathedRowStruct::isNumbered() const
25 int MathedRowStruct::getBaseline() const
30 void MathedRowStruct::setBaseline(int b)
35 int MathedRowStruct::ascent() const
40 int MathedRowStruct::descent() const
45 void MathedRowStruct::ascent(int a)
50 void MathedRowStruct::descent(int d)
55 int MathedRowStruct::getTab(unsigned int i) const
57 return i < widths_.size() ? widths_[i] : 0;
60 void MathedRowStruct::setLabel(string const & l)
65 void MathedRowStruct::setNumbered(bool nf)
70 void MathedRowStruct::setTab(unsigned int i, int t)
72 if (i >= widths_.size())
73 widths_.resize(i + 2);
84 MathedRowContainer::iterator MathedRowContainer::begin()
86 return iterator(this);
89 MathedRowContainer::iterator MathedRowContainer::end()
92 it.pos_ = data_.size();
96 bool MathedRowContainer::empty() const
98 return data_.size() == 0;
101 void MathedRowContainer::insert(iterator const & it)
103 Assert(it.st_ == this);
104 data_.insert(data_.begin() + it.pos_, MathedRowStruct());
107 void MathedRowContainer::erase(iterator & it)
109 Assert(it.st_ == this);
110 data_.erase(data_.begin() + it.pos_);
113 MathedRowStruct & MathedRowContainer::back()
115 Assert(data_.size());
119 void MathedRowContainer::push_back()
121 data_.push_back(MathedRowStruct());
125 MathedRowContainer::size_type MathedRowContainer::size() const
133 // MathedRowContainer::iterator
136 MathedRowContainer::iterator::iterator()
140 MathedRowContainer::iterator::iterator(MathedRowContainer * m)
144 MathedRowContainer::iterator::operator void *() const
146 return (void *)(st_ && pos_ < st_->size());
149 MathedRowStruct * MathedRowContainer::iterator::operator->()
152 return &st_->data_[pos_];
155 MathedRowStruct const * MathedRowContainer::iterator::operator->() const
158 return &st_->data_[pos_];
161 void MathedRowContainer::iterator::operator++()
167 bool MathedRowContainer::iterator::is_last() const
170 return pos_ == st_->size() - 1;
173 bool MathedRowContainer::iterator::operator==(const iterator & it) const
175 return st_ == it.st_ && pos_ == it.pos_;