I'm trying to extend the cefsimple
app that comes with the Chromium Embedded Framework to include a V8 handler. The code I've written looks like this so far;
bool SimpleHandler::Execute(const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
CefString& exception) {
int argn = arguments.size();
if (name == "serial_connect" && (argn == 4 || argn == 1))
{
if (connection.isOpen())
connection.~Serial();
connection = NULL;
if (argn == 1)
{
int port = (arguments[0]); // convert to int?
}
else
{
}
}
else if (name == "serial_send" && argn >= 1)
{
}
else if (name == "serial_recieve")
{
}
else
return false;
return true;
}
I'm having trouble converting the generic value object returned given by the handler into a cpp int that I can use in calculations. I've found the function CefV8Value::GetIntValue();
, but I can't figure out how to use it.
try calling object->GetIntValue()
The reason is that CefRefPtr is an object that holds a reference to CefV8Value, so you need the arrow operator to access the underlying CefV8Value object it points to