On Mon, May 14, 2007 at 04:57:03PM -0000, [EMAIL PROTECTED] wrote:+int DocIterator::find(MathData const & cell) const +{ + for (size_t l = 0; l != slices_.size(); ++l) { + if (slices_[l].asInsetMath() && &slices_[l].cell() == &cell) + return l; + } + return -1; +} + + +int DocIterator::find(InsetMath const * inset) const +{ + for (size_t l = 0; l != slices_.size(); ++l) { + if (slices_[l].asInsetMath() == inset) + return l; + } + return -1; +}Are the used somewhere?
Yes!
+void DocIterator::cutOff(int above, std::vector<CursorSlice> & cut) +{ + cut.resize(std::max((int)slices_.size()-above-1, 0)); + for (size_t i = 0; above+1+i < slices_.size(); ++i) + cut[i] = slices_[above+1+i]; + slices_.resize(above+1); +}Spacing.+void DocIterator::cutOff(int above) +{ + slices_.resize(above+1); +} + + +void DocIterator::append(std::vector<CursorSlice> const x) +{ + for (size_t i = 0; i < x.size(); ++i) + slices_.push_back(x[i]); +}Isn't there std::vector<>::insert?
Right. This came from a (too) mechanical translation from a version outside of the DocIterator class. There was no direct vector access.
Why isn't 'x passed by reference?
Because my & key was broken for a moment.
+ + +void DocIterator::append(int idx, int pos) +{ + slices_.push_back(CursorSlice()); + top().idx() = idx; + top().pos() = pos; +} + +std::ostream & operator<<(std::ostream & os, DocIterator const & dit){ for (size_t i = 0, n = dit.depth(); i != n; ++i) os << " " << dit[i] << "\n"; return os; }I seemingly missed the discussion of this pathc on the list. Can anybodygive me a pointer?
It's in my personal branch. No discussion on the list therefore... Cleaning up is left for the following days. But I wanted to have it at some saver place than my personal computer now.
Stefan
PGP.sig
Description: Signierter Teil der Nachricht