Angus Leeming wrote:
[EMAIL PROTECTED] wrote:

Author: younes
Date: Thu Oct 18 17:29:51 2007
New Revision: 21033

URL: http://www.lyx.org/trac/changeset/21033
Log:
Reduce header dependencies in Paragraph.h
- Move Changes.h out of Paragraph.h
- pimpl the inset list.

==============================================================================
--- lyx-devel/trunk/src/InsetList.cpp (original) +++
lyx-devel/trunk/src/InsetList.cpp Thu Oct 18 17:29:51 2007 @@ -138,4
+138,12 @@
 }
+void InsetList::clone()
+{
+     List::iterator it = list_.begin();
+     List::iterator end = list_.end();
+     for (; it != end; ++it)
+             it->inset = it->inset->clone();
+}
+
 } // namespace lyx

==============================================================================
--- lyx-devel/trunk/src/Paragraph.cpp (original) +++
lyx-devel/trunk/src/Paragraph.cpp Thu Oct 18 17:29:51 2007 @@ -21,10
@@ -277,6 +282,8 @@
 inset_owner = p.inset_owner;
 fontlist = p.fontlist;
 id_ = paragraph_id++;
+     insetlist_ = p.insetlist_;
+     insetlist_.clone();
 }

This is a very strange "clone". Why aren't you writing it:

   class InsetList {
       static InsetList clone(InsetList & rhs)
       {
           InsetList lhs = rhs;
           List::iterator it = lhs.begin();
           List::iterator const end = lhs.end();
           for (; it != end; ++it)
           {
               // Indeed, I think Inset::clone should be similar.
               it->inset = it->inset->clone();
           }
           return lhs;
       }
   };

 ?

Well it was just modeled after Inset::clone but you're right, it's strange. Maybe I should just rename it to cloneInset() instead or implement a copy ctor...

Abdel.

Reply via email to