[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: branches/koffice/2.0/koffice/krita/plugins/paintops/libbrush
From:       Cyrille Berger <cberger () cberger ! net>
Date:       2009-04-23 12:23:31
Message-ID: 200904231423.32650.cberger () cberger ! net
[Download RAW message or body]

On Thursday 23 April 2009, Boudewijn Rempt wrote:
> On Thu, 23 Apr 2009, Cyrille Berger wrote:
> > On Thursday 23 April 2009, Boudewijn Rempt wrote:
> > > This is a bit tricky & ugly, but it does work around the problem
> > > that we cannot put shared pointers into a resource server
> >
> > Why not ?
>
> For one thing, because of the KoResource* signature of the createResource
> method, see lines like
>
> T* resource = createResource(front);
>
> in KoResourceServer:107.
>
> Boudewijn

A solution would be:

Replace:
template <class T> class KoResourceServer : public KoResourceServerBase {

by
template <class T, class TStar = T*> class KoResourceServer : public 
KoResourceServerBase {

And replace all T* by TStar in that class. Then when instanciating the 
resource server for brush, we will do KoResourceServer<KisBrush, KisBrushSP> .

-- 
Cyrille Berger

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" \
content="1" /><style type="text/css">p, li { white-space: pre-wrap; \
}</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; \
font-weight:400; font-style:normal;">On Thursday 23 April 2009, Boudewijn Rempt \
wrote:<br> &gt; On Thu, 23 Apr 2009, Cyrille Berger wrote:<br>
&gt; &gt; On Thursday 23 April 2009, Boudewijn Rempt wrote:<br>
&gt; &gt; &gt; This is a bit tricky &amp; ugly, but it does work around the \
problem<br> &gt; &gt; &gt; that we cannot put shared pointers into a resource \
server<br> &gt; &gt;<br>
&gt; &gt; Why not ?<br>
&gt;<br>
&gt; For one thing, because of the KoResource* signature of the createResource<br>
&gt; method, see lines like<br>
&gt;<br>
&gt; T* resource = createResource(front);<br>
&gt;<br>
&gt; in KoResourceServer:107.<br>
&gt;<br>
&gt; Boudewijn<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>A solution would be:<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>Replace:<br> template &lt;class T&gt; class \
KoResourceServer : public KoResourceServerBase {<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>by<br> template &lt;class T, class TStar = T*&gt; class \
KoResourceServer : public KoResourceServerBase {<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>And \
replace all T* by TStar in that class. Then when instanciating the resource server \
for brush, we will do KoResourceServer&lt;KisBrush, KisBrushSP&gt; .<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>-- \
<br> Cyrille Berger</p></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic