On Fri, Jan 7, 2011 at 3:09 AM, getify <[email protected]> wrote:

> That seems kinda convoluted, but works. However, is there another more
> direct way?
>

AFAIK, that is the way to do it. See String::AsciiValue and
String::Utf8Value. However, be aware that the lifetimes of their string
bytes is not well defined, so they must be copied if you want to use them
safely from outside of v8. (The std::string ctor copies them, but when using
the raw (char const *) one must be careful about the lifetime.)


> And what about extracting a Boolean? Integer? Float? Array? Haven't
> found any documentation about how to get at those other property
> types. Any help is greatly appreciated.
>

See the API docs for the Value type. Value has methods which return a value
as the various numeric types. For Object and Arrays, something like this:

if( handle->IsObject() ) {
  Local<Object> obj( Object::Cast(*handle) );
}

the approach is the same for Arrays.


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



-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

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

Reply via email to