add more functions to ParagraphList

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6906 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-05-01 12:31:35 +00:00
parent f5e07fb302
commit 5c44cab01c
3 changed files with 43 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2003-05-01 Lars Gullik Bjønnes <larsbj@gullik.net> 2003-05-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* ParagraphList.C (ParagraphList): implement copy constructor
(operator=): implement, base on copy constructor.
(assign): new func
* paragraph.C (erase): return a bool * paragraph.C (erase): return a bool
* paragraph_pimpl.C (erasePos): remove function, move contents... * paragraph_pimpl.C (erasePos): remove function, move contents...

View File

@ -86,13 +86,35 @@ bool operator!=(ParagraphList::iterator const & i1,
return !(i1 == i2); return !(i1 == i2);
} }
//////////
////////// The ParagraphList proper ////////// The ParagraphList proper
//////////
ParagraphList::ParagraphList() ParagraphList::ParagraphList()
: parlist(0) : parlist(0)
{} {}
ParagraphList::ParagraphList(ParagraphList const & pl)
: parlist(0)
{
// Deep copy.
ParagraphList::iterator it = pl.begin();
ParagraphList::iterator end = pl.end();
for (; it != end; ++it) {
push_back(new Paragraph(*it, false));
}
}
ParagraphList & ParagraphList::operator=(ParagraphList const & rhs)
{
ParagraphList tmp(rhs);
std::swap(parlist, tmp.parlist);
return *this;
}
ParagraphList::iterator ParagraphList::iterator
ParagraphList::insert(ParagraphList::iterator it, Paragraph * par) ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
{ {
@ -136,6 +158,16 @@ ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
} }
void ParagraphList::assign(iterator beg, iterator end)
{
clear();
for (; beg != end; ++beg) {
push_back(new Paragraph(*beg, false));
}
}
void ParagraphList::clear() void ParagraphList::clear()
{ {
#ifndef NO_NEXT #ifndef NO_NEXT

View File

@ -47,8 +47,14 @@ public:
/// ///
ParagraphList(); ParagraphList();
/// ///
ParagraphList(ParagraphList const &);
///
ParagraphList & operator=(ParagraphList const &);
///
iterator insert(iterator it, Paragraph * par); iterator insert(iterator it, Paragraph * par);
/// ///
void assign(iterator beg, iterator end);
///
void clear(); void clear();
/// ///
void erase(iterator it); void erase(iterator it);