3 * Copyright 1995-2002 the LyX Team
4 * Read the file COPYING
6 * \author Matthias Ettrich
22 /// function object returning true when row number is found
23 class same_rownumber {
25 same_rownumber(int row) : row_(row) {}
26 bool operator()(TexRow::RowList::value_type const & vt) const {
27 return vt.rownumber() == row_;
35 /// increment the pos value of the argument if the par id
36 /// is the same, and the pos parameter is larger
39 increase_pos(int id, int pos)
40 : id_(id), pos_(pos) {}
42 void operator()(TexRow::RowList::value_type & vt) const {
43 if (vt.id() != id_ || vt.pos() >= pos_)
48 << "TeXRow::increasePos: ideally this "
49 "should never happen..." << endl;
51 // FIXME: When verified to work this clause should be deleted.
52 if (id_ == vt.id() && pos_ == vt.pos()) {
54 << "TexRow::increasePos: this should happen "
55 "maximum one time for each run of "
56 "increasePos!" << endl;
77 void TexRow::start(int id, int pos)
84 void TexRow::newline()
86 int const id = lastid;
87 RowList::value_type tmp(id, lastpos, ++count);
88 rowlist.push_back(tmp);
92 bool TexRow::getIdFromRow(int row, int & id, int & pos) const
94 RowList::const_iterator cit =
95 find_if(rowlist.begin(), rowlist.end(),
98 if (cit != rowlist.end()) {
109 void TexRow::increasePos(int id, int pos)
111 for_each(rowlist.begin(), rowlist.end(), increase_pos(id, pos));
115 TexRow & TexRow::operator+=(TexRow const & tr)
117 rowlist.insert(rowlist.end(), tr.rowlist.begin(), tr.rowlist.end());