gnash-dev
[Top][All Lists]
Advanced

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

Re: [Gnash-dev] Re: [patch #5576] Implements missing AS String Class met


From: strk
Subject: Re: [Gnash-dev] Re: [patch #5576] Implements missing AS String Class methods & adds further tests for AS String Class.
Date: Thu, 23 Nov 2006 13:49:33 +0100

On Wed, Nov 22, 2006 at 09:47:16PM +0100, Michael Meier wrote:

> Concerning the as_object::add_property:
> How do I construct the needed getter / setter as_functions? At the
> moment I am stuck with:
> 
>       boost::intrusive_ptr<builtin_function> getter(new
> builtin_function(&string_length,NULL));
>       boost::intrusive_ptr<builtin_function> setter(new
> builtin_function(NULL,NULL));
>       
>       bool m = o.add_property(std::string("mongo"),*getter,*setter);
> 
> with m == true. Probably new builtin_function(&string_length,NULL) is
> wrong. I just pass NULL as I have no idea what to pass. The doc says an
> as_object *iface. But what does this interface contain?

It *is* documented:

        /// Construct a builtin function/class
        //
        ///
        /// @param func
        ///     The C function to call when this as_function is invoked.
        ///     For classes, the function pointer is the constructor.
        ///
        /// @param iface
        ///     The interface of this class (will be inherited by
        ///     instances of this class)
        ///     If the given interface is NULL a default one
        ///     will be provided, with constructor set as 'this'.
        ///
        builtin_function(as_c_function_ptr func, as_object* iface=NULL)
 
So, your call is correct (for the getter).

> string_length never gets called. Additionally I only want to implement

Are you sure you removed the custom handling of 'length' from get_member ?

> the getter method and no setter method. Does anybody know a way to
> achieve this or has some pointers?

You should see what happen with the official player when a user tries
to set that property. There might still be a function that simply does
nothing (or, if we feel friendly, we might raise a warning: user tried
to access etc etc.).

--strk;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]