]> git.lyx.org Git - features.git/commitdiff
add more functions to ParagraphList
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 1 May 2003 12:31:35 +0000 (12:31 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 1 May 2003 12:31:35 +0000 (12:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6906 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/ParagraphList.C
src/ParagraphList.h

index a16bf32488f6a8c3e589ea6669694481a6cb9c49..a12d7fe6676ba9c3e62039649c771905f90deb60 100644 (file)
@@ -1,5 +1,9 @@
 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...
index 4f4b50633b97c4835a99dc76f36fac9701489c2d..3a579413e1c0259d4b5282e24102cafcc91ef2df 100644 (file)
@@ -86,13 +86,35 @@ bool operator!=(ParagraphList::iterator const & i1,
        return !(i1 == i2);
 }
 
-
+//////////
 ////////// The ParagraphList proper
+//////////
+
 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)
 {
@@ -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()
 {
 #ifndef NO_NEXT
index f60337eff4f1b58040303fea17cad0f152733bd2..52154c115648660789644491f4d6d69f0557711b 100644 (file)
@@ -47,8 +47,14 @@ public:
        ///
        ParagraphList();
        ///
+       ParagraphList(ParagraphList const &);
+       ///
+       ParagraphList & operator=(ParagraphList const &);
+       ///
        iterator insert(iterator it, Paragraph * par);
        ///
+       void assign(iterator beg, iterator end);
+       ///
        void clear();
        ///
        void erase(iterator it);