Пример #1
0
bool NPN_SetProperty(NPP id, NPObject* obj, NPIdentifier identifier, const NPVariant *variant)
{
    char msg[1024];
    sprintf(msg, "NPN_SetProperty");
    logger->logMessage(msg);

    bool rv = NPNFuncs.setproperty(id, obj, identifier, variant);

    sprintf(msg, "--Return: %x", rv);
    logger->logMessage(msg);

    return rv;
}
Пример #2
0
SEXP R_NPAPI_SetProperty(SEXP plug, SEXP Robj, SEXP Rname, SEXP Rval, SEXP RconvValue)
{
 
  NPP inst = (NPP) R_ExternalPtrAddr(GET_SLOT( plug , Rf_install( "ref" ) ) );
  NPNetscapeFuncs *funcs = (NPNetscapeFuncs *) R_ExternalPtrAddr(GET_SLOT( GET_SLOT(plug, Rf_install("funcs")), Rf_install("ref")));

  NPVariant *obj = (NPVariant *) R_ExternalPtrAddr(GET_SLOT( Robj , Rf_install( "ref" ) ) );
  
  if(!NPVARIANT_IS_OBJECT(*obj))
    {
      //What should we return in this case?
      Rf_error("Robj is not an NPVariant containing an NPObject.");
      return R_NilValue;
    }
  convert_t convVal = (convert_t) INTEGER(RconvValue)[0];

  
  //NPVariant *val = (NPVariant *) funcs->memalloc(sizeof(NPVariant)); 
  NPVariant val;
  ConvertRToNP(Rval, inst, funcs, &val, convVal);
  const char *ccname = CHAR(STRING_ELT(Rname, 0));

  bool success = funcs->setproperty(inst, obj->value.objectValue, funcs->getstringidentifier(ccname), &val);
 
  if(!success)
    {
      //funcs->memfree(val);
      Rf_error("SetProperty failed.");
      return R_NilValue;
    }
  else {
    funcs->releasevariantvalue(&val);
    //funcs->memfree(val);
  }
  return ScalarLogical(success) ;
}
Пример #3
0
bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
                     const NPVariant *value)
{
  return NPNFuncs.setproperty(npp, obj, propertyName, value);
}