6 #include "support/LAssert.h"
8 /** The physical structure of a row and aditional information is stored here.
9 It allows to manage the extra info independently of the paragraph data.
10 Only used for multiline paragraphs.
17 typedef std::vector<int> Widths;
21 MathedRowStruct(int n)
22 : asc_(0), desc_(0), y_(0), widths_(n + 1, 0),
26 string const & getLabel() const;
28 bool isNumbered() const;
30 int getBaseline() const;
32 void setBaseline(int b);
42 int getTab(int i) const;
44 void setLabel(string const & l);
46 void setNumbered(bool nf);
48 void setTab(int i, int t);
50 friend class MathedRowSt;
66 class MathedRowSt : public MathedRowStruct {
69 explicit MathedRowSt(int n)
70 : MathedRowStruct(n), next_(0)
72 /// Should be const but...
73 MathedRowSt * getNext() const;
74 /// ...we couldn't use this.
75 void setNext(MathedRowSt * n);
82 // The idea is to change this MathedRowContainer to mimic the behaviour
83 // of std::list<MathedRowStruct> in several small steps. In the end it
84 // could be replaced by such a list and MathedRowSt can go as well.
86 struct MathedRowContainer {
90 iterator() : st_(0) {}
92 explicit iterator(MathedRowSt * st) : st_(st) {}
93 /// "better" conversion to bool
94 explicit iterator(MathedRowContainer * m) : st_(m->data_) {}
95 /// "better" conversion to bool
96 operator void *() const { return st_; }
98 MathedRowStruct & operator*() { Assert(st_); return *st_; }
100 MathedRowStruct * operator->() { return st_; }
102 MathedRowStruct const * operator->() const { return st_; }
104 void operator++() { Assert(st_); st_ = st_->next_; }
106 bool is_last() const { Assert(st_); return st_->next_ == 0; }
108 bool operator==(const iterator & it) const { return st_ == it.st_; }
116 MathedRowContainer() : data_(0) {}
118 MathedRowContainer(MathedRowSt * data) : data_(data) {}
121 iterator begin() { return iterator(this); }
123 bool empty() const { return data_ == 0; }
132 MathedRowSt * MathedRowSt::getNext() const
139 void MathedRowSt::setNext(MathedRowSt * n)
146 string const & MathedRowStruct::getLabel() const
153 bool MathedRowStruct::isNumbered() const
160 int MathedRowStruct::getBaseline() const
167 void MathedRowStruct::setBaseline(int b)
174 int MathedRowStruct::ascent() const
181 int MathedRowStruct::descent() const
188 void MathedRowStruct::ascent(int a)
195 void MathedRowStruct::descent(int d)
202 int MathedRowStruct::getTab(int i) const
209 void MathedRowStruct::setLabel(string const & l)
216 void MathedRowStruct::setNumbered(bool nf)
223 void MathedRowStruct::setTab(int i, int t)