static void convertValue(JSContext * jct, JS::MutableHandleValue theData, const yarp::os::Value & inputValue) { ODL_ENTER(); //#### ODL_P2("jct = ", jct, "inputValue = ", &inputValue); //#### if (inputValue.isBool()) { theData.setBoolean(inputValue.asBool()); } else if (inputValue.isInt()) { theData.setInt32(inputValue.asInt()); } else if (inputValue.isString()) { YarpString value = inputValue.asString(); JSString * aString = JS_NewStringCopyZ(jct, value.c_str()); if (aString) { theData.setString(aString); } } else if (inputValue.isDouble()) { theData.setDouble(inputValue.asDouble()); } else if (inputValue.isDict()) { yarp::os::Property * value = inputValue.asDict(); if (value) { yarp::os::Bottle asList(value->toString()); convertDictionary(jct, theData, asList); } } else if (inputValue.isList()) { yarp::os::Bottle * value = inputValue.asList(); if (value) { yarp::os::Property asDict; if (ListIsReallyDictionary(*value, asDict)) { convertDictionary(jct, theData, *value); } else { convertList(jct, theData, *value); } } } else { // We don't know what to do with this... theData.setNull(); } ODL_EXIT(); //#### } // convertValue
bool JSAudioNodeCustomSource::JSGetter_position(JSContext *cx, JS::MutableHandleValue vp) { vp.setDouble(0); return true; }