当前位置: 首页>>代码示例>>C++>>正文


C++ INT32_TO_NPVARIANT函数代码示例

本文整理汇总了C++中INT32_TO_NPVARIANT函数的典型用法代码示例。如果您正苦于以下问题:C++ INT32_TO_NPVARIANT函数的具体用法?C++ INT32_TO_NPVARIANT怎么用?C++ INT32_TO_NPVARIANT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了INT32_TO_NPVARIANT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cloud_spy_variant_get_property

static bool
cloud_spy_variant_get_property (NPObject * npobj, NPIdentifier name, NPVariant * result)
{
  CloudSpyByteArray * self = reinterpret_cast<CloudSpyByteArray *> (npobj);

  if (cloud_spy_nsfuncs->identifierisstring (name))
  {
    const gchar * property_name;

    property_name = static_cast<NPString *> (name)->UTF8Characters;
    if (strcmp (property_name, "length") == 0)
    {
      INT32_TO_NPVARIANT (self->data_length, *result);
      return true;
    }
  }
  else
  {
    int32_t index;

    index = cloud_spy_nsfuncs->intfromidentifier (name);
    if (index >= 0 && index < self->data_length)
    {
      INT32_TO_NPVARIANT (self->data[index], *result);
      return true;
    }
  }

  cloud_spy_nsfuncs->setexception (npobj, "invalid property");
  return true;
}
开发者ID:key2,项目名称:frida-ire,代码行数:31,代码来源:cloud-spy-byte-array.cpp

示例2: VOID_TO_NPVARIANT

bool
StatementObject::GetProperty(NPIdentifier name, NPVariant *result)
{
//sprintf(tmp, "stmt GetProperty [%s]\n", NPN_UTF8FromIdentifier(name)); log(tmp);
  VOID_TO_NPVARIANT(*result);

  if (name == mc_rowCount_id)
    {
      INT32_TO_NPVARIANT(m_rowCount, *result);
      return true;
    }
  else if (name == mc_columnCount_id)
    {
      INT32_TO_NPVARIANT(m_columnCount, *result);
      return true;
    }
  else if (name == mc_errorMessage_id)
    {
      STRING_TO_NPVARIANT(GetErrorString(), *result);
      return true;
    }
  else if (name == mc_errorCode_id)
    {
      INT32_TO_NPVARIANT(GetErrorCode(), *result);
      return true;
    }
  else if (name == mc_errorState_id)
    {
      STRING_TO_NPVARIANT(GetErrorState(), *result);
      return true;
    }
  return false;

}
开发者ID:openlink,项目名称:WebDB_ODBC,代码行数:34,代码来源:Statement.cpp

示例3: testGetProperty

static bool testGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result)
{
    if (name == testIdentifiers[ID_PROPERTY_FOO]) {
        char* mem = static_cast<char*>(browser->memalloc(4));
        strcpy(mem, "foo");
        STRINGZ_TO_NPVARIANT(mem, *result);
        return true;
    }
    if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) {
        int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long>(npobj));

        INT32_TO_NPVARIANT(objectPointer, *result);
        return true;
    }
    if (name == testIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
        TestObject* testObject = reinterpret_cast<TestObject*>(npobj);
        if (!testObject->testObject)
            testObject->testObject = browser->createobject(0, &testClass);
        browser->retainobject(testObject->testObject);
        OBJECT_TO_NPVARIANT(testObject->testObject, *result);
        return true;
    }
    if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) {
        INT32_TO_NPVARIANT(npobj->referenceCount, *result);
        return true;
    }
    
    return false;
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:29,代码来源:TestObject.cpp

示例4: libvlc_exception_init

RuntimeNPObject::InvokeResult
LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_audio_mute:
            {
                bool muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex);
                RETURN_ON_EXCEPTION(this,ex);
                BOOLEAN_TO_NPVARIANT(muted, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_volume:
            {
                int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(volume, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_track:
            {
                libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                int track = libvlc_audio_get_track(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(track, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_count:
            {
                libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                // get the number of audio track available
                int i_track = libvlc_audio_get_track_count(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                // return it
                INT32_TO_NPVARIANT(i_track, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_audio_channel:
            {
                int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(channel, result);
                return INVOKERESULT_NO_ERROR;
            }
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
开发者ID:Kafay,项目名称:vlc,代码行数:59,代码来源:npolibvlc.cpp

示例5: scrollTo

void scrollTo(NPP instance, NPObject *scroller, int y, bool animate)
	{
	NPVariant var, args[3];
	INT32_TO_NPVARIANT(/*x*/0, args[0]);
	INT32_TO_NPVARIANT(y, args[1]);
	BOOLEAN_TO_NPVARIANT(animate, args[2]);	//	
	//BOOLEAN_TO_NPVARIANT(true, args[3]);	//	supress notifications
	scrollCommon(instance, scroller, "scrollTo", args, 3, &var);
	}
开发者ID:wosigh,项目名称:terminal,代码行数:9,代码来源:api.c

示例6: topmost_rect_ptac

static
void
topmost_rect_ptac(void *param)
{
    struct topmost_rect_param_s *p = param;
    struct pp_instance_s *pp_i = tables_get_pp_instance(p->instance);
    if (!pp_i) {
        trace_error("%s, no instance\n", __func__);
        goto err_1;
    }

    p->result = PP_FALSE;

    NPString topmost_func_src = NPString_literal(
        "(function(elem, x, y) {"
            "var r = elem.getBoundingClientRect();"
            "return document.elementFromPoint(x + r.left, y + r.top) == elem;"
        "})");
    NPVariant topmost_func;

    if (!npn.evaluate(pp_i->npp, pp_i->np_window_obj, &topmost_func_src, &topmost_func))
        goto err_1;

    if (!NPVARIANT_IS_OBJECT(topmost_func))
        goto err_1;

    NPObject *topmost_func_obj = NPVARIANT_TO_OBJECT(topmost_func);

    NPVariant is_topmost;
    NPVariant args[3];

    OBJECT_TO_NPVARIANT(pp_i->np_plugin_element_obj, args[0]);
    INT32_TO_NPVARIANT(p->rect.point.x + p->rect.size.width / 2, args[1]);
    INT32_TO_NPVARIANT(p->rect.point.y + p->rect.size.height / 2, args[2]);

    if (!npn.invokeDefault(pp_i->npp, topmost_func_obj, args, 3, &is_topmost))
        goto err_2;

    if (!NPVARIANT_IS_BOOLEAN(is_topmost))
        goto err_3;

    p->result = NPVARIANT_TO_BOOLEAN(is_topmost);

err_3:
    npn.releasevariantvalue(&is_topmost);
err_2:
    npn.releasevariantvalue(&topmost_func);
err_1:
    ppb_message_loop_post_quit_depth(p->m_loop, PP_FALSE, p->depth);
}
开发者ID:Happy-Ferret,项目名称:freshplayerplugin,代码行数:50,代码来源:ppb_flash.c

示例7: INT32_TO_NPVARIANT

bool CJSMethods::SelectWindowTab(int nTabId)
{
	if(m_pScriptableObject == NULL)
	{
		return false;
	}

	NPP pluginInstance				= m_pScriptableObject->GetPluginInstance();
	NPNetscapeFuncs *pBrowserFuncs	= m_pScriptableObject->GetBrowserFuncs();

	if(pluginInstance == NULL || pBrowserFuncs == NULL)
	{
		return false;
	}

	NPVariant varResults;

	NPVariant varArgs;
	INT32_TO_NPVARIANT(nTabId, varArgs);

	bool bResult = CallJSMethod(pBrowserFuncs, pluginInstance, "selectWindowTab", &varArgs, 1, varResults);

	pBrowserFuncs->releasevariantvalue(&varArgs);
	pBrowserFuncs->releasevariantvalue(&varResults);

	return bResult;
}
开发者ID:Chrismiqui,项目名称:minimizetotray,代码行数:27,代码来源:JSMethods.cpp

示例8: pluginGetProperty

static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant)
{
    if (name == pluginPropertyIdentifiers[ID_PROPERTY_PROPERTY]) {
        char* mem = static_cast<char*>(browser->memalloc(9));
        strcpy(mem, "property");
        STRINGZ_TO_NPVARIANT(mem, *variant);
        return true;
    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
        BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->eventLogging, *variant);
        return true;
    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_LOG_DESTROY]) {
        BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->logDestroy, *variant);
        return true;            
    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_HAS_STREAM]) {
        BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->stream != 0, *variant);
        return true;
    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
        NPObject *testObject = ((PluginObject *)obj)->testObject;
        browser->retainobject(testObject);
        OBJECT_TO_NPVARIANT(testObject, *variant);
        return true;
    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT_COUNT]) {
        INT32_TO_NPVARIANT(getTestObjectCount(), *variant);
        return true;
    }
    return false;
}
开发者ID:nghiank,项目名称:sample_webkit_plugin,代码行数:27,代码来源:PluginObject.cpp

示例9: on_shell_signal

static void
on_shell_signal (GDBusProxy *proxy,
		 gchar      *sender_name,
		 gchar      *signal_name,
		 GVariant   *parameters,
		 gpointer    user_data)
{
  PluginObject *obj = user_data;

  if (strcmp (signal_name, "ExtensionStatusChanged") == 0)
    {
      gchar *uuid;
      gint32 status;
      gchar *error;
      NPVariant args[3];
      NPVariant result;

      g_variant_get (parameters, "(sis)", &uuid, &status, &error);
      STRINGZ_TO_NPVARIANT (uuid, args[0]);
      INT32_TO_NPVARIANT (status, args[1]);
      STRINGZ_TO_NPVARIANT (error, args[2]);

      funcs.invokeDefault (obj->instance, obj->listener,
			   args, 3, &result);

      funcs.releasevariantvalue (&result);
      g_free (uuid);
      g_free (error);
    }
}
开发者ID:gcampax,项目名称:sweettooth-plugin,代码行数:30,代码来源:sweettooth-plugin.c

示例10: VOID_TO_NPVARIANT

bool
ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
{
  VOID_TO_NPVARIANT(*result);

  if (name == sBar_id) {
    static int a = 17;

    INT32_TO_NPVARIANT(a, *result);

    a += 5;

    return true;
  }

  if (name == sPluginType_id) {
    NPObject *myobj =
      NPN_CreateObject(mNpp, GET_NPOBJECT_CLASS(ConstructablePluginObject));
    if (!myobj) {
      return false;
    }

    OBJECT_TO_NPVARIANT(myobj, *result);

    return true;
  }

  return true;
}
开发者ID:sdgdsffdsfff,项目名称:SafePassword,代码行数:29,代码来源:plugin.cpp

示例11: INT32_TO_NPVARIANT

bool
xplayerNPObject::Int32Variant (NPVariant* _result,
                             int32_t value)
{
  INT32_TO_NPVARIANT (value, *_result);
  return true;
}
开发者ID:linuxmint,项目名称:xplayer,代码行数:7,代码来源:xplayerNPObject.cpp

示例12: plugin_get_api_version

static int
plugin_get_api_version (PluginObject  *obj,
                        NPVariant     *result)
{
  INT32_TO_NPVARIANT (PLUGIN_API_VERSION, *result);
  return TRUE;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:7,代码来源:browser-plugin.c

示例13: NPN_SetException

bool nsScriptableObjectRawInput::DeleteInstance(
	NPIdentifier name,
	const NPVariant *args,
	uint32_t argCount,
	NPVariant *result) {
	if (argCount != 2 ||
		!NPVARIANT_IS_DOUBLE(args[0]) ||
		!NPVARIANT_IS_OBJECT(args[1])) {
		NPN_SetException(this, "(DeleteInstance) invalid params passed to function");
		return true;
	}
	int32_t id = (int32_t)(int)floor(NPVARIANT_TO_DOUBLE(args[0]) + 0.5);	// all numbers come in as double in chrome...

	bool foundAndDeleted = PluginMethodKeyCapture::DeleteInstance(id);

	NPVariant out_args[2];
	NPVariant ret_val;

	BOOLEAN_TO_NPVARIANT(foundAndDeleted, out_args[0]);
	INT32_TO_NPVARIANT(id, out_args[1]);

	// fire callback
	NPN_InvokeDefault(
		__super::npp_,
		NPVARIANT_TO_OBJECT(args[1]),
		out_args,
		2,
		&ret_val);

	NPN_ReleaseVariantValue(&ret_val);
	return true;
}
开发者ID:o4kapuk,项目名称:overwolf-plugin-rawinput,代码行数:32,代码来源:nsScriptableObjectRawInput.cpp

示例14: convertV8ObjectToNPVariant

void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NPVariant* result)
{
    VOID_TO_NPVARIANT(*result);

    // It is really the caller's responsibility to deal with the empty handle case because there could be different actions to
    // take in different contexts.
    ASSERT(!object.IsEmpty());

    if (object.IsEmpty())
        return;

    if (object->IsInt32())
        INT32_TO_NPVARIANT(object->NumberValue(), *result);
    else if (object->IsNumber())
        DOUBLE_TO_NPVARIANT(object->NumberValue(), *result);
    else if (object->IsBoolean())
        BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result);
    else if (object->IsNull())
        NULL_TO_NPVARIANT(*result);
    else if (object->IsUndefined())
        VOID_TO_NPVARIANT(*result);
    else if (object->IsString()) {
        v8::String::Utf8Value utf8(object);
        char* utf8_chars = strdup(*utf8);
        STRINGN_TO_NPVARIANT(utf8_chars, utf8.length(), *result);
    } else if (object->IsObject()) {
        WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext());
        NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window);
        if (npobject)
            _NPN_RegisterObject(npobject, owner);
        OBJECT_TO_NPVARIANT(npobject, *result);
    }
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:33,代码来源:V8NPUtils.cpp

示例15: handleCallback

void handleCallback(PluginObject* object, const char *url, NPReason reason, void *notifyData)
{
    //assert(object);
    
    NPVariant args[2];
    
    NPObject *windowScriptObject;
    browser->getvalue(object->npp, NPNVWindowNPObject, &windowScriptObject);
    
    NPIdentifier callbackIdentifier = notifyData;

    INT32_TO_NPVARIANT(reason, args[0]);

    char *strHdr = NULL;
    if (object->firstUrl && object->firstHeaders && object->lastUrl && object->lastHeaders) {
        // Format expected by JavaScript validator: four fields separated by \n\n:
        // First URL; first header block; last URL; last header block.
        // Note that header blocks already end with \n due to how NPStream::headers works.
        int len = strlen(object->firstUrl) + 2
            + strlen(object->firstHeaders) + 1
            + strlen(object->lastUrl) + 2
            + strlen(object->lastHeaders) + 1;
        strHdr = (char*)malloc(len + 1);
        snprintf(strHdr, len + 1, "%s\n\n%s\n%s\n\n%s\n",
                 object->firstUrl, object->firstHeaders, object->lastUrl, object->lastHeaders);
        STRINGN_TO_NPVARIANT(strHdr, len, args[1]);
    } else
        NULL_TO_NPVARIANT(args[1]);

    NPVariant browserResult;
    browser->invoke(object->npp, windowScriptObject, callbackIdentifier, args, 2, &browserResult);
    browser->releasevariantvalue(&browserResult);

    free(strHdr);
}
开发者ID:nghiank,项目名称:sample_webkit_plugin,代码行数:35,代码来源:PluginObject.cpp


注:本文中的INT32_TO_NPVARIANT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。