parlist-17-b.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7005 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-05-22 17:26:50 +00:00
parent 62be565337
commit b12c42a381
3 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* ParagraphList.C (erase): new function, taking two iterators
2003-05-22 André Pönitz <poenitz@gmx.net> 2003-05-22 André Pönitz <poenitz@gmx.net>

View File

@ -257,7 +257,7 @@ void ParagraphList::clear()
} }
void ParagraphList::erase(ParagraphList::iterator it) ParagraphList::iterator ParagraphList::erase(ParagraphList::iterator it)
{ {
#ifndef NO_NEXT #ifndef NO_NEXT
Paragraph * prev = it->previous_; Paragraph * prev = it->previous_;
@ -274,6 +274,7 @@ void ParagraphList::erase(ParagraphList::iterator it)
it->previous_ = 0; it->previous_ = 0;
it->next_ = 0; it->next_ = 0;
delete &*it; delete &*it;
return next;
#else #else
Paragraph * prev = it->prev_par_; Paragraph * prev = it->prev_par_;
Paragraph * next = it->next_par_; Paragraph * next = it->next_par_;
@ -287,10 +288,21 @@ void ParagraphList::erase(ParagraphList::iterator it)
next->prev_par_ = prev; next->prev_par_ = prev;
delete &*it; delete &*it;
return next;
#endif #endif
} }
ParagraphList::iterator ParagraphList::erase(ParagraphList::iterator first,
ParagraphList::iterator last)
{
while (first != last) {
erase(first++);
}
return last;
}
ParagraphList::iterator ParagraphList::begin() ParagraphList::iterator ParagraphList::begin()
{ {
return iterator(parlist); return iterator(parlist);

View File

@ -61,7 +61,9 @@ public:
/// ///
void clear(); void clear();
/// ///
void erase(iterator it); iterator erase(iterator it);
///
iterator erase(iterator first, iterator last);
/// ///
iterator begin(); iterator begin();
/// ///