Re: Wrapping pangocairo.h



On 5/30/06, Pierre THIERRY <nowhere man levallois eu org> wrote:
Scribit Jonathon Jongsma dies 30/05/2006 hora 07:28:
> I wonder if this function:
> static Glib::RefPtr<Layout> create_from_cairo_context(const
> Cairo::RefPtr<Cairo::Context>& context);
>
> could be replaced with a simple overloaded create function, e.g.:
> static Glib::RefPtr<Layout> create(const
> Cairo::RefPtr<Cairo::Context>& context);

Why use a helper function (I suppose that it is one) instead of a
constructor? Is it because you want it to return a RefPtr?

Yes.  There area  lot of objects in GTK+ / gtkmm that are
reference-counted, and we want to increment the reference instead of
copy them on assignment.  Therefore, we don't want to allow the user
to construct a raw object, we want a RefPtr which will handle all of
the referencing and dereferencing for us.

Jonner



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]