From b12c42a381abc34270f1c685d3d6c8be2e150c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 22 May 2003 17:26:50 +0000 Subject: [PATCH] parlist-17-b.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7005 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 3 +++ src/ParagraphList.C | 14 +++++++++++++- src/ParagraphList.h | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2daa04db55..4398a8ba22 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2003-05-22 Lars Gullik Bjønnes + + * ParagraphList.C (erase): new function, taking two iterators 2003-05-22 André Pönitz diff --git a/src/ParagraphList.C b/src/ParagraphList.C index d87634c74c..deba8829c5 100644 --- a/src/ParagraphList.C +++ b/src/ParagraphList.C @@ -257,7 +257,7 @@ void ParagraphList::clear() } -void ParagraphList::erase(ParagraphList::iterator it) +ParagraphList::iterator ParagraphList::erase(ParagraphList::iterator it) { #ifndef NO_NEXT Paragraph * prev = it->previous_; @@ -274,6 +274,7 @@ void ParagraphList::erase(ParagraphList::iterator it) it->previous_ = 0; it->next_ = 0; delete &*it; + return next; #else Paragraph * prev = it->prev_par_; Paragraph * next = it->next_par_; @@ -287,10 +288,21 @@ void ParagraphList::erase(ParagraphList::iterator it) next->prev_par_ = prev; delete &*it; + return next; #endif } +ParagraphList::iterator ParagraphList::erase(ParagraphList::iterator first, + ParagraphList::iterator last) +{ + while (first != last) { + erase(first++); + } + return last; +} + + ParagraphList::iterator ParagraphList::begin() { return iterator(parlist); diff --git a/src/ParagraphList.h b/src/ParagraphList.h index 92470cb976..9f049bf895 100644 --- a/src/ParagraphList.h +++ b/src/ParagraphList.h @@ -61,7 +61,9 @@ public: /// void clear(); /// - void erase(iterator it); + iterator erase(iterator it); + /// + iterator erase(iterator first, iterator last); /// iterator begin(); ///