• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NPVARIANT_TO_STRING函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: NPVARIANT_TO_STRING

bool ScriptablePluginObject::SetProperty(NPIdentifier name, const NPVariant *value)
{
    if (!m_plugin)
        return false;

    std::string str;
    std::stringstream ss;
    bool boolean = false;
    unsigned short val = -1;

    if (NPVARIANT_IS_STRING(*value))
    {
        str.assign(NPVARIANT_TO_STRING(*value).UTF8Characters,
                   NPVARIANT_TO_STRING(*value).UTF8Length);
    }
    else if (NPVARIANT_IS_BOOLEAN(*value))
    {
        boolean = NPVARIANT_TO_BOOLEAN(*value);
    }
    else if (NPVARIANT_IS_INT32(*value))
    {
        val = NPVARIANT_TO_INT32(*value);
        ss << val;
        ss >> str;
    }
开发者ID:Acidburn0zzz,项目名称:spice-xpi,代码行数:25,代码来源:nsScriptablePeer.cpp


示例2: NPN_SetException

bool nsScriptableObjectOverwolfSample::Echo(
  NPIdentifier name, 
  const NPVariant *args, 
  uint32_t argCount, 
  NPVariant *result) {

  if (argCount < 2 ||
    !NPVARIANT_IS_STRING(args[0]) ||
    !NPVARIANT_IS_OBJECT(args[1])) {
      NPN_SetException(this, "invalid params passed to function");
      return true;
  }

  // add ref count to callback object so it won't delete
  NPN_RetainObject(NPVARIANT_TO_OBJECT(args[1]));

  // convert into std::string
  std::string message;
  message.append(
    NPVARIANT_TO_STRING(args[0]).UTF8Characters,
    NPVARIANT_TO_STRING(args[0]).UTF8Length);

  // post to separate thread so that we are responsive
  return thread_->PostTask(
    std::bind(
      &nsScriptableObjectOverwolfSample::EchoTask, 
      this, 
      message, 
      NPVARIANT_TO_OBJECT(args[1])));
}
开发者ID:Capibara-,项目名称:overwolf-sample-plugin,代码行数:30,代码来源:nsScriptableObjectOverwolfSample.cpp


示例3: convert_js_to_mrb

bool convert_js_to_mrb(NPP npp, const NPVariant &variant, mrb_state *mrb, mrb_value *result)
{
    switch(variant.type){
      case NPVariantType_Void:
      case NPVariantType_Null:
        *result = mrb_nil_value();
        return true;
      case NPVariantType_Bool:
        if (NPVARIANT_TO_BOOLEAN(variant)){
            *result = mrb_true_value();
        }else{
            *result = mrb_false_value();
        }
        return true;
      case NPVariantType_Int32:
        *result = mrb_fixnum_value(NPVARIANT_TO_INT32(variant));
        return true;
      case NPVariantType_Double:
        *result = mrb_float_value(NPVARIANT_TO_DOUBLE(variant));
        return true;
      case NPVariantType_String:
        *result = mrb_str_new(mrb, NPVARIANT_TO_STRING(variant).UTF8Characters,
                              NPVARIANT_TO_STRING(variant).UTF8Length);
        return true;
      case NPVariantType_Object:
        return convert_js_to_mrb_object(npp, variant, mrb, result);
      default:
        break;
    }
    return false;
}
开发者ID:guofei,项目名称:JsMruby,代码行数:31,代码来源:mrb_js.cpp


示例4: createCStringFromNPVariant

NPUTF8* createCStringFromNPVariant(const NPVariant* variant) {
  size_t length = NPVARIANT_TO_STRING(*variant).UTF8Length;
  NPUTF8* result = (NPUTF8*)malloc(length + 1);
  memcpy(result, NPVARIANT_TO_STRING(*variant).UTF8Characters, length);
  result[length] = '\0';
  return result;
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:7,代码来源:nptest_utils.cpp


示例5: getInterfaceName

std::string getInterfaceName(NPP npp, NPObject* object)
{
    std::string className;
    NPVariant result;
    bool asConstructor = true;  // true if object can be a constructor

    VOID_TO_NPVARIANT(result);
    NPN_Invoke(npp, object, NPN_GetStringIdentifier("toString"), 0, 0, &result);
    for (;;)
    {
        if (NPVARIANT_IS_STRING(result))
        {
            className = std::string(NPVARIANT_TO_STRING(result).utf8characters,
                                    NPVARIANT_TO_STRING(result).utf8length);
        }
        NPN_ReleaseVariantValue(&result);
        if (className.compare(0, 9, "function ") == 0)
        {
            // In Chrome, a [Constructor] object is represented as a 'Function'.
            className = className.substr(9);
            size_t pos = className.find('(');
            if (pos != std::string::npos)
            {
                className = className.substr(0, pos);
                break;
            }
            return "Function";
        }
        if (className.compare(0, 8, "[object ", 8) == 0 && className[className.length() - 1] == ']')
        {
            className = className.substr(8, className.length() - 9);
            break;
        }
        // This object is likely to have a stringifier. Check the constructor name directly.
        NPVariant constructor;
        VOID_TO_NPVARIANT(constructor);
        if (asConstructor && NPN_GetProperty(npp, object, NPN_GetStringIdentifier("constructor"), &constructor))
        {
            if (NPVARIANT_IS_OBJECT(constructor) &&
                NPN_Invoke(npp, NPVARIANT_TO_OBJECT(constructor), NPN_GetStringIdentifier("toString"), 0, 0, &result))
            {
                NPN_ReleaseVariantValue(&constructor);
                asConstructor = false;
                continue;
            }
            NPN_ReleaseVariantValue(&constructor);
        }
        return "Object";
    }
    // In Firefox, the constructor and an instance object cannot be distinguished by toString().
    // Check if object has a 'prototype' to see if it is a constructor.
    if (asConstructor && NPN_HasProperty(npp, object, NPN_GetStringIdentifier("prototype")))
    {
        className += "_Constructor";
    }
    return className;
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:57,代码来源:bridge.cpp


示例6: NPN_SetException

bool PluginMethodListenOnFile::ExecuteListenOnFile(
  const NPVariant *args,
  uint32_t argCount,
  NPVariant *result) {
  std::string filename;
  bool skip_to_end = false;

  try {
    if (argCount < 3 ||
      !NPVARIANT_IS_STRING(args[0]) ||
      !NPVARIANT_IS_BOOLEAN(args[1]) ||
      !NPVARIANT_IS_OBJECT(args[2])) {
      NPN_SetException(
        object_, 
        "invalid or missing params passed to function - expecting 3 params: "
        "filename, skipToEnd, callback(status, data)");
      return false;
    }

    callback_ = NPVARIANT_TO_OBJECT(args[2]);
    skip_to_end = NPVARIANT_TO_BOOLEAN(args[1]);

    // add ref count to callback object so it won't delete
    NPN_RetainObject(callback_);

    filename.append(
      NPVARIANT_TO_STRING(args[0]).UTF8Characters,
      NPVARIANT_TO_STRING(args[0]).UTF8Length);  
  } catch(...) {

  }

  if (nullptr == thread_.get()) {
    thread_.reset(new utils::Thread);
    if (!thread_->Start()) {
      NPN_SetException(
        __super::object_,
        "an unexpected error occurred - couldn't start file listening thread");
      return false;
    }
  }

  std::wstring wide_filename = utils::Encoders::utf8_decode(filename);

  if (!file_stream_.Initialize(wide_filename.c_str(), this, skip_to_end)) {
    NPN_SetException(
      __super::object_,
      "an unexpected error occurred - couldn't open the file for read access");
    return false;
  }

  return thread_->PostTask(
    std::bind(
    &PluginMethodListenOnFile::StartListening,
    this));
}
开发者ID:Ridrog,项目名称:overwolf-simple-io-plugin,代码行数:56,代码来源:plugin_method_listen_on_file.cpp


示例7: NPVARIANT_TO_OBJECT

bool JsAgent::onLoad(const NPVariant* args, unsigned argCount) {
	Debug::println("JsAgent::onLoad");

	if(argCount != 4) {
		Debug::println("JsAgent::onLoad> argCount != 4");
		return false;
	}

	if( !NPVARIANT_IS_OBJECT(args[0]) ||
		!NPVARIANT_IS_STRING(args[1]) ||
		!NPVARIANT_IS_INT32(args[2]) ||
		!NPVARIANT_IS_STRING(args[3]) ) {
		Debug::println("JsAgent::onLoad> arg types wrong");
		return false;
	}

	NPObject* pObject = NPVARIANT_TO_OBJECT(args[0]);
	m_helper = NPN_RetainObject(pObject);

	NPObject* pDebug = NPN_CreateObject(getNPP(), GetNPClass<JsDebug>());
	NPN_RetainObject(pDebug);
	Variant var;
	var.set(pDebug);

	if(!NPN_SetProperty(getNPP(), m_window, methods.debug, var.ptr())) {
		Debug::println("JsAgent::onLoad> set property failed");
		return false;
	}

	NPString npstr = NPVARIANT_TO_STRING(args[1]);
	std::string host(npstr.UTF8Characters, npstr.UTF8Length);

	int port = NPVARIANT_TO_INT32(args[2]);

	npstr = NPVARIANT_TO_STRING(args[3]);
	std::string typeName(npstr.UTF8Characters, npstr.UTF8Length);

	if(!m_channel->connect(host.c_str(), port)) {
		Debug::println("JsAgent::onLoad> could not connect");
		return false;
	}

	LoadMessage msg;
	msg.typeName = typeName;

	ArchiveWriter<Channel> ar(*m_channel);
	if(!Message::send(msg, ar)) {
		Debug::println("JsAgent::onLoad> send failed");
		return false;
	}

	JsValue ret;
	return dispatchAndReturn(ret);
}
开发者ID:JimmyJune,项目名称:DotWeb,代码行数:54,代码来源:JsAgent.cpp


示例8: NPN_SetException

bool PluginMethodListenOnFile::ExecuteStopFileListen(
  const NPVariant *args,
  uint32_t argCount,
  NPVariant *result) {

  std::string id;
  try {
    if (argCount < 1 || !NPVARIANT_IS_STRING(args[0])) {
      NPN_SetException(
        object_,
        "invalid or missing params passed to function - expecting 1 params: "
        "id");
      return false;
    }

    id.append(
      NPVARIANT_TO_STRING(args[0]).UTF8Characters,
      NPVARIANT_TO_STRING(args[0]).UTF8Length);
  }
  catch (...) {

  }

  TextFileThreadMap::iterator iter = threads_.find(id);
  if (iter != threads_.end()) {
    if (!iter->second.first->StopListening()) {
      NPN_SetException(
        __super::object_,
        "an unexpected error occurred - couldn't stop existing listener");
      return false;
    }

    if (!iter->second.second->Stop()) {
      NPN_SetException(
        __super::object_,
        "an unexpected error occurred - couldn't stop existing listener thread");
      return false;
    }

	delete iter->second.first;
	delete iter->second.second;

    threads_.erase(id);

    if (nullptr != ids_to_callbacks_[id]) {
      NPN_ReleaseObject(ids_to_callbacks_[id]);
      ids_to_callbacks_[id] = nullptr;
      ids_to_callbacks_.erase(id);
    }
  }

  return true;
}
开发者ID:JonasFortmann,项目名称:simple-io-plugin,代码行数:53,代码来源:plugin_method_listen_on_file.cpp


示例9: convertToAny

Any convertToAny(NPP npp, const NPVariant* variant)
{
    switch (variant->type)
    {
    case NPVariantType_Void:
    case NPVariantType_Null:
        return Any();
        break;
    case NPVariantType_Bool:
        return NPVARIANT_TO_BOOLEAN(*variant);
        break;
    case NPVariantType_Int32:
        return NPVARIANT_TO_INT32(*variant);
        break;
    case NPVariantType_Double:
        return NPVARIANT_TO_DOUBLE(*variant);
        break;
    case NPVariantType_String:
        return std::string(NPVARIANT_TO_STRING(*variant).utf8characters, NPVARIANT_TO_STRING(*variant).utf8length);
        break;
    case NPVariantType_Object:
    {
        NPObject* object = NPVARIANT_TO_OBJECT(*variant);
        if (!object)
        {
            break;
        }
        if (StubObject::isStub(object))
        {
            StubObject* stub = static_cast<StubObject*>(object);
            return stub->getObject();
        }
        PluginInstance* instance = static_cast<PluginInstance*>(npp->pdata);
        if (instance)
        {
            ProxyControl* proxyControl = instance->getProxyControl();
            if (proxyControl)
            {
                return proxyControl->createProxy(object);
            }
        }
        break;
    }
    default:
        break;
    }
    return Any();
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:48,代码来源:bridge.cpp


示例10: ArgToStr

char * ArgToStr(const NPVariant arg) {
	NPString str = NPVARIANT_TO_STRING(arg);
	char * r = (char *)malloc(str.UTF8Length + 1);
	memcpy(r, str.UTF8Characters, str.UTF8Length);
	r[str.UTF8Length] = '\0';
	return r;
}
开发者ID:AllenWeb,项目名称:chrome-hostadmin,代码行数:7,代码来源:hostadmin.c


示例11: NPVARIANT_TO_STRING

bool
ScriptablePluginObject::Invoke(NPIdentifier name, const NPVariant *args,
                               uint32_t argCount, NPVariant *result)
{
  if (name == sendCmd_id)
  {
	if ( argCount < 1 )
	{
		return false;
	}

	PString strParam = "";
	NPString npStr = NPVARIANT_TO_STRING( args[0] );
	for (unsigned int i=0; i<npStr.utf8length; i++)
	{
		strParam += npStr.utf8characters[ i ];
	}


	PString strResult = g_NativeLogic.InvokeFunction( strParam );

	char* pszName = (char*)NPN_MemAlloc( strResult.GetSize() + 1 );
	strcpy( pszName, strResult );
    STRINGZ_TO_NPVARIANT(pszName, *result);

    return PR_TRUE;
  }

  return PR_FALSE;
}
开发者ID:xgc820313,项目名称:js2n,代码行数:30,代码来源:plugin.cpp


示例12: NOTE

bool
xplayerNPObject::Invoke (NPIdentifier aName,
                       const NPVariant *argv,
                       uint32_t argc,
                       NPVariant *_result)
{
  if (!IsValid ())
    return false;

  NOTE (g_print ("xplayerNPObject::Invoke [%p] %s\n", (void*) this, NPN_UTF8FromIdentifier (aName)));
  int methodIndex = GetClass()->GetMethodIndex (aName);
  if (methodIndex >= 0)
    return InvokeByIndex (methodIndex, argv, argc, _result);

  if (aName == NPN_GetStringIdentifier ("__noSuchMethod__")) {
    /* http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object:_noSuchMethod */
    if (!CheckArgv (argv, argc, 2, NPVariantType_String, NPVariantType_Object))
      return false;

    const char *id = NPVARIANT_TO_STRING (argv[0]).UTF8Characters;
    g_message ("NOTE: site calls unknown function \"%s\" on xplayerNPObject %p\n", id ? id : "(null)", (void*) this);

    /* Silently ignore the invocation */
    VOID_TO_NPVARIANT (*_result);
    return true;
  }

  return Throw ("No method with this name exists.");
}
开发者ID:linuxmint,项目名称:xplayer,代码行数:29,代码来源:xplayerNPObject.cpp


示例13: get_string_property

static inline gchar *
get_string_property (NPP         instance,
                     NPObject   *obj,
                     const char *name)
{
  NPVariant result = { NPVariantType_Void };
  NPString result_str;
  gchar *result_copy;

  result_copy = NULL;

  if (!funcs.getproperty (instance, obj,
                          funcs.getstringidentifier (name),
                          &result))
    goto out;

  if (!NPVARIANT_IS_STRING (result))
    goto out;

  result_str = NPVARIANT_TO_STRING (result);
  result_copy = g_strndup (result_str.UTF8Characters, result_str.UTF8Length);

 out:
  funcs.releasevariantvalue (&result);
  return result_copy;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:26,代码来源:browser-plugin.c


示例14: convertNPVariantToV8Object

v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant* variant, NPObject* owner, v8::Isolate* isolate)
{
    NPVariantType type = variant->type;

    switch (type) {
    case NPVariantType_Int32:
        return v8::Integer::New(NPVARIANT_TO_INT32(*variant), isolate);
    case NPVariantType_Double:
        return v8::Number::New(isolate, NPVARIANT_TO_DOUBLE(*variant));
    case NPVariantType_Bool:
        return v8Boolean(NPVARIANT_TO_BOOLEAN(*variant), isolate);
    case NPVariantType_Null:
        return v8::Null(isolate);
    case NPVariantType_Void:
        return v8::Undefined(isolate);
    case NPVariantType_String: {
        NPString src = NPVARIANT_TO_STRING(*variant);
        return v8::String::NewFromUtf8(isolate, src.UTF8Characters, v8::String::kNormalString, src.UTF8Length);
    }
    case NPVariantType_Object: {
        NPObject* object = NPVARIANT_TO_OBJECT(*variant);
        if (V8NPObject* v8Object = npObjectToV8NPObject(object))
            return v8::Local<v8::Object>::New(isolate, v8Object->v8Object);
        return createV8ObjectForNPObject(object, owner, isolate);
    }
    default:
        return v8::Undefined(isolate);
    }
}
开发者ID:Igalia,项目名称:blink,代码行数:29,代码来源:V8NPUtils.cpp


示例15: plugin_object_invoke

static bool
plugin_object_invoke (NPObject        *npobj,
		      NPIdentifier     name,
		      const NPVariant *args,
		      uint32_t         argc,
		      NPVariant       *result)
{
  PluginObject *obj;

  g_return_val_if_fail (plugin_object_has_method (npobj, name), FALSE);

  g_debug ("invoking plugin object method");

  obj = (PluginObject*) npobj;

  VOID_TO_NPVARIANT (*result);

  if (name == list_extensions_id)
    return plugin_list_extensions (obj, result);
  else if (name == get_metadata_id)
    {
      g_return_val_if_fail (argc >= 1, FALSE);
      g_return_val_if_fail (NPVARIANT_IS_STRING(args[0]), FALSE);

      return plugin_get_metadata (obj, NPVARIANT_TO_STRING(args[0]), result);
    }
  else if (name == enable_extension_id)
    {
      g_return_val_if_fail (argc >= 2, FALSE);
      g_return_val_if_fail (NPVARIANT_IS_STRING(args[0]), FALSE);
      g_return_val_if_fail (NPVARIANT_IS_BOOLEAN(args[1]), FALSE);

      return plugin_enable_extension (obj,
				      NPVARIANT_TO_STRING(args[0]),
				      NPVARIANT_TO_BOOLEAN(args[1]));
    }
  else if (name == install_extension_id)
    {
      g_return_val_if_fail (argc >= 1, FALSE);
      g_return_val_if_fail (NPVARIANT_IS_STRING(args[0]), FALSE);

      return plugin_install_extension (obj,
				       NPVARIANT_TO_STRING(args[0]));
    }

  return TRUE;
}
开发者ID:gcampax,项目名称:sweettooth-plugin,代码行数:47,代码来源:sweettooth-plugin.c


示例16: convert_js_to_mrb_object

bool convert_js_to_mrb_object(NPP npp, const NPVariant &variant, mrb_state *mrb, mrb_value *result)
{
    if (NPVARIANT_IS_MRB_JS_OBJECT(variant)){
        MrbJsObject *obj = static_cast< MrbJsObject* >(NPVARIANT_TO_OBJECT(variant));
        *result = obj->Value();
        return true;
    }

    NPObject *window;
    NPN_GetValue(npp, NPNVWindowNPObject, &window);

    NPVariant object;
    NPN_GetProperty(npp, window, NPN_GetStringIdentifier("Object"), &object);
    NPN_ReleaseObject(window);

    NPVariant prototype;
    NPN_GetProperty(npp, NPVARIANT_TO_OBJECT(object), NPN_GetStringIdentifier("prototype"), &prototype);
    NPN_ReleaseVariantValue(&object);

    NPVariant to_string;
    NPN_GetProperty(npp, NPVARIANT_TO_OBJECT(prototype), NPN_GetStringIdentifier("toString"), &to_string);
    NPN_ReleaseVariantValue(&prototype);

    NPVariant type_string;
    NPN_Invoke(npp, NPVARIANT_TO_OBJECT(to_string), NPN_GetStringIdentifier("call"), &variant, 1, &type_string);
    NPN_ReleaseVariantValue(&to_string);

    if (!NPVARIANT_IS_STRING(type_string)){
        NPN_ReleaseVariantValue(&type_string);
        return false;
    }

    std::string type(NPVARIANT_TO_STRING(type_string).UTF8Characters, NPVARIANT_TO_STRING(type_string).UTF8Length);
    NPN_ReleaseVariantValue(&type_string);
    if (type == "[object Array]"){
        return convert_js_to_mrb_array(npp, variant, mrb, result);
    }else if (type == "[object Object]"){
        return convert_js_to_mrb_hash(npp, variant, mrb, result);
    }else if (type == "[object Function]"){
        return convert_js_to_mrb_function(npp, variant, mrb, result);
    }else{
        *result = mrb_js_obj_class_new(mrb, NPVARIANT_TO_OBJECT(variant));
        return true;
    }

    return true;
}
开发者ID:guofei,项目名称:JsMruby,代码行数:47,代码来源:mrb_js.cpp


示例17: cloud_spy_init_npvariant_with_other

void
cloud_spy_init_npvariant_with_other (NPVariant * var, const NPVariant * other)
{
  memcpy (var, other, sizeof (NPVariant));

  if (other->type == NPVariantType_String)
  {
    const NPString * from = &NPVARIANT_TO_STRING (*other);
    NPString * to = &NPVARIANT_TO_STRING (*var);
    to->UTF8Characters = static_cast<NPUTF8 *> (cloud_spy_nsfuncs->memalloc (from->UTF8Length));
    memcpy (const_cast<NPUTF8 *> (to->UTF8Characters), from->UTF8Characters, from->UTF8Length);
  }
  else if (other->type == NPVariantType_Object)
  {
    cloud_spy_nsfuncs->retainobject (NPVARIANT_TO_OBJECT (*var));
  }
}
开发者ID:key2,项目名称:frida-ire,代码行数:17,代码来源:cloud-spy-plugin.cpp


示例18: WEBKIT_ASSERT

vector<string> CppVariant::toStringVector() const
{

    WEBKIT_ASSERT(isObject());
    vector<string> stringVector;
    NPObject* npValue = value.objectValue;
    NPIdentifier lengthId = WebBindings::getStringIdentifier("length");

    if (!WebBindings::hasProperty(0, npValue, lengthId))
        return stringVector;

    NPVariant lengthValue;
    if (!WebBindings::getProperty(0, npValue, lengthId, &lengthValue))
        return stringVector;

    int length = 0;
    // The length is a double in some cases.
    if (NPVARIANT_IS_DOUBLE(lengthValue))
        length = static_cast<int>(NPVARIANT_TO_DOUBLE(lengthValue));
    else if (NPVARIANT_IS_INT32(lengthValue))
        length = NPVARIANT_TO_INT32(lengthValue);
    WebBindings::releaseVariantValue(&lengthValue);

    // For sanity, only allow 100 items.
    length = min(100, length);
    for (int i = 0; i < length; ++i) {
        // Get each of the items.
        char indexInChar[20]; // Enough size to store 32-bit integer
        snprintf(indexInChar, 20, "%d", i);
        string index(indexInChar);
        NPIdentifier indexId = WebBindings::getStringIdentifier(index.c_str());
        if (!WebBindings::hasProperty(0, npValue, indexId))
            continue;
        NPVariant indexValue;
        if (!WebBindings::getProperty(0, npValue, indexId, &indexValue))
            continue;
        if (NPVARIANT_IS_STRING(indexValue)) {
            string item(NPVARIANT_TO_STRING(indexValue).UTF8Characters,
                        NPVARIANT_TO_STRING(indexValue).UTF8Length);
            stringVector.push_back(item);
        }
        WebBindings::releaseVariantValue(&indexValue);
    }
    return stringVector;
}
开发者ID:fmalita,项目名称:webkit,代码行数:45,代码来源:CppVariant.cpp


示例19: Close

void
StatementObject::GetProcedureColumns(const NPVariant *arg0, const NPVariant *arg1, 
	const NPVariant *arg2, const NPVariant *arg3)
{
  NPString *cat = NULL;
  NPString *sch = NULL; 
  NPString *prc = NULL;
  NPString *col = NULL;

  if (NPVARIANT_IS_STRING(*arg0))
    cat = (NPString*)&NPVARIANT_TO_STRING(*arg0);
  if (NPVARIANT_IS_STRING(*arg1))
    sch = (NPString*)&NPVARIANT_TO_STRING(*arg1);
  if (NPVARIANT_IS_STRING(*arg2))
    prc = (NPString*)&NPVARIANT_TO_STRING(*arg2);
  if (NPVARIANT_IS_STRING(*arg3))
    col = (NPString*)&NPVARIANT_TO_STRING(*arg3);

  if (!m_hstmt) {
    NPN_SetException(this, "Statement isn't initialized");
    return;
  }

  NPError rc = Close();
  if (rc != NPERR_NO_ERROR)
    return;

  SQLRETURN code = SQLProcedureColumnsW(m_hstmt, 
  	(cat?nsWString(cat).Data():NULL), (cat?SQL_NTS:0),
  	(sch?nsWString(sch).Data():NULL), (sch?SQL_NTS:0),
  	(prc?nsWString(prc).Data():NULL), (prc?SQL_NTS:0),
  	(col?nsWString(col).Data():NULL), (col?SQL_NTS:0));
  if (!SQL_SUCCEEDED(code) && code != SQL_NO_DATA) {
    StoreError(SQL_HANDLE_STMT, m_hstmt);  
    return;
  } 
    
  SQLSMALLINT cols;
  if (SQL_SUCCEEDED(SQLNumResultCols(m_hstmt, &cols)))
    m_columnCount = cols;

  SQLLEN rcnt;
  if (SQL_SUCCEEDED(SQLRowCount(m_hstmt, &rcnt)))
    m_rowCount = rcnt;
}
开发者ID:openlink,项目名称:WebDB_ODBC,代码行数:45,代码来源:Statement.cpp


示例20: stringValue

char* RuntimeNPObject::stringValue(const NPVariant &v)
{
    char *s = NULL;
    if( NPVARIANT_IS_STRING(v) )
    {
        return stringValue(NPVARIANT_TO_STRING(v));
    }
    return s;
}
开发者ID:FranEstSol,项目名称:vc-axnp-vlc,代码行数:9,代码来源:nporuntime.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NRAND函数代码示例发布时间:2022-05-30
下一篇:
C++ NPVARIANT_IS_STRING函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap