Abdelrazak Younes wrote:
[EMAIL PROTECTED] wrote:
Modified: lyx-devel/trunk/src/Paragraph.cpp

@@ -78,7 +79,7 @@
 {
 public:
     ///
-    Private(Paragraph * owner);
+    Private(Paragraph * owner, Layout const & layout);
     /// "Copy constructor"
     Private(Private const &, Paragraph * owner);
@@ -189,8 +190,12 @@
     ///
     InsetList insetlist_;
+ // This little bit of indirection is needed so that we can protect
+    // the layout as const but still be able to change layout_.
     ///
-    LayoutPtr layout_;
+    Layout const & layout() const { return *layout_; }
+    ///
+    void setLayout(Layout const & layout) { layout_ = &layout; }


Private interface are meant to be used like normal members by the owner class. You don't have to create interface for them. IOW, accessing d->layout_ directly in Paragraph methods _is_ OK.

Yes, I know that's normally how it is. But you'll note here that I want Paragraph to interact with the pimpl as if the pimpl stored a Layout const &, so that all interaction assumes we do have a Layout. Unfortunately, we can't actually store a Layout const &, because then we're not allowed to change it.

Richard

Reply via email to