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_pimpl.C (erasePos): remove function, move contents...
* paragraph.C (erase): return a bool
* paragraph_pimpl.C (erasePos): remove function, move contents...
////////// The ParagraphList proper
////////// The ParagraphList proper
ParagraphList::ParagraphList()
: parlist(0)
{}
ParagraphList::ParagraphList()
: 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::insert(ParagraphList::iterator it, Paragraph * par)
{
ParagraphList::iterator
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()
{
#ifndef NO_NEXT
void ParagraphList::clear()
{
#ifndef NO_NEXT
+ 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 erase(iterator it);
void clear();
///
void erase(iterator it);