The InternalFieldCount is used for "connection" a JavaScript object and a
C++ object in the embedding application. See section Accessing Dynamic
Variables in Embedder's Guide <http://code.google.com/apis/v8/embed.html>.

Enumerating the properties of an object in C++ is currently not implemented,
see issue 33 <http://code.google.com/p/v8/issues/detail?id=33> for details.

As a workaround you could create a simple JavaScript which enumerates the
properties and returns the property names in an array. Call this function
from C++ and get the property names out of the array.

Regards,
Søren


On Mon, Sep 15, 2008 at 2:55 AM, Hector <[EMAIL PROTECTED]> wrote:

>
> Soren,
>
> I was able to get further by using adding  ToObject()
>
>  Handle<Object> msg = args[0]->ToObject();
>
> One last thing will finally get me to point of testing this method.
> How to iterate thru the msg object to extract the field names.      I
> tried to do this:
>
>  printf("- msg length: %d\n",msg->InternalFieldCount());
>  for (int i=0; i < msg->InternalFieldCount(); i++) {
>          v8::String::AsciiValue field(msg->GetInternalField(i));
>          printf("- field(%d): [%s]\n",i,*field);
>  }
>
> But the internal field count is zero.
>
> Note: This is the method I used in our PHP extension as a "marshal"
> between PHP Arrays and  the c-based structure.  The PHP function
> handle will traverse thru the passed msg array.
>
> --
> HLS
>
> On Sep 14, 5:01 pm, "Søren Gjesse" <[EMAIL PROTECTED]> wrote:
> > The value of args[0] in the call to the callback is an Object, and its
> > properties can be retrieved using the Get method, e.g. for subject:
> >
> >   Handle<Value> subject = args[0]->Get(v8::String::New("Subject"))
> >
> > Regards,
> > Søren
> >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to