Re: [Crystal-cvs] SF.net SVN: crystal:[38126] CS/branches/soc2012/editor

Christian Van Brussel <[email protected]>
Newsgroups gmane.comp.graphics.crystalspace.devel
Organization UCL - TELE
Message-ID <1338906761.19582.34.camel@scylla>
Hi Andrei,

Unfortunately, all the changes you made in modifiable.h around the
conversion from a csPtr to a csRef for the returned value where not
desired.

The goal of using a csPtr was that the object was allocated only if
necessary. The ownership of the object is also transfered through the
caller of the methods, and that caller should deallocate the objects
once he doesn't need them anymore.

You can find more information about CS's smart pointers at
http://www.crystalspace3d.org/docs/online/manual/Smart-Pointers.html



On Mon, 2012-06-04 at 18:27 +0000, [email protected]
wrote:
> Modified: CS/branches/soc2012/editor/include/iutil/modifiable.h
> ===================================================================
> --- CS/branches/soc2012/editor/include/iutil/modifiable.h	2012-06-04 13:24:53 UTC (rev 38125)
> +++ CS/branches/soc2012/editor/include/iutil/modifiable.h	2012-06-04 18:27:11 UTC (rev 38126)
> @@ -71,13 +71,13 @@
>     *   Returns char* entry for the parameter's name
>     *   to be processed by the translator.
>     */
> -  virtual char* GetName () const = 0;
> +  virtual const char* GetName () const = 0;
>  
>    /**
>     *   Returns char* entry for the parameter's textual description
>     *   to be processed by the translator.
>     */
> -  virtual char* GetDescription () const = 0;
> +  virtual const char* GetDescription () const = 0;
>  
>    /**
>     * Returns the type of this parameter                                                           */
> @@ -107,8 +107,10 @@
>  
>    virtual size_t GetParameterCount () const = 0;
>  
> -  virtual csPtr<iModifiableParameter> GetParameter (csStringID id) const = 0;
> -  virtual csPtr<iModifiableParameter> GetParameterByIndex (size_t index) const = 0;
> +  virtual csRef<iModifiableParameter> GetParameter (csStringID id) const = 0;
> +  virtual csRef<iModifiableParameter> GetParameterByIndex (size_t index) const = 0;
> +
> +  virtual void Push(iModifiableParameter* param) = 0;
>  };
>  
> 
> @@ -119,7 +121,7 @@
>    SCF_INTERFACE(iModifiable, 1, 0 ,0);
>  
>    virtual const csStringID GetID () const = 0;
> -  virtual csPtr<iModifiableDescription> GetDescription () const = 0;
> +  virtual csRef<iModifiableDescription> GetDescription () const = 0;
>  
>    virtual void GetParameterValue (csStringID id, const csVariant& value) const = 0;
>    virtual bool SetParameterValue (csStringID id, const csVariant& value) = 0;



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.