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


C++ Arguments::Callee方法代码示例

本文整理汇总了C++中Arguments::Callee方法的典型用法代码示例。如果您正苦于以下问题:C++ Arguments::Callee方法的具体用法?C++ Arguments::Callee怎么用?C++ Arguments::Callee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arguments的用法示例。


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

示例1: New

Handle<Value> jsWindow::PlaceHolder(const Arguments& args)
{
    Local<Object> self = args.This();
    Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
    void* ptr = wrap->Value();
    jsWindow* el = static_cast<jsWindow*>(ptr);

    string ret;
    ret = value_to_string(args.Callee()->ToString());
    ret += " [Window; uuid=";
    ret += el->win_uuid;
    ret += "; name=";
    ret += value_to_string(el->props["name"]->ToString());
    ret += "]";
    LOG4CXX_DEBUG(iLogger::GetLogger(), _T("jsWindow::PlaceHolder - ") << ret);
    return String::New(ret.c_str());
}
开发者ID:abhishekbhalani,项目名称:webapptools,代码行数:17,代码来源:jsWindow.cpp

示例2: function

 Handle< Value > V8Scope::nativeCallback( const Arguments &args ) {
     Local< External > f = External::Cast( *args.Callee()->Get( v8::String::New( "_native_function" ) ) );
     NativeFunction function = ( NativeFunction )( f->Value() );
     BSONObjBuilder b;
     for( int i = 0; i < args.Length(); ++i ) {
         stringstream ss;
         ss << i;
         v8ToMongoElement( b, v8::String::New( "foo" ), ss.str(), args[ i ] );
     }
     BSONObj ret;
     try {
         ret = function( b.done() );
     } catch( const std::exception &e ) {
         return v8::ThrowException(v8::String::New(e.what()));
     } catch( ... ) {
         return v8::ThrowException(v8::String::New("unknown exception"));            
     }
     return mongoToV8Element( ret.firstElement() );
 }
开发者ID:alanw,项目名称:mongo,代码行数:19,代码来源:engine_v8.cpp

示例3:

Handle<Value> jsBrowser::WinInterceptor( const Arguments& args )
{
    Handle<Value> retval;
    Local<Context> ctx = v8::Context::GetCurrent();
    Local<Object> exec = Local<Object>::Cast(ctx->Global()->Get(String::New("v8_context")));
    Local<External> wrap = Local<External>::Cast(exec->GetInternalField(0));
    void* ptr = wrap->Value();
    jsBrowser* el = static_cast<jsBrowser*>(ptr);

    string fname = value_to_string(args.Callee()->GetName()->ToString());

    Local<Object> _obj = Local<Object>::New(v8_wrapper::wrap_object<jsWindow>(el->window));
    Local<Function> _func = Local<Function>::Cast(_obj->Get(String::New(fname.c_str())));
    Handle<Value> *fargs = new Handle<Value>[args.Length()];
    for (int i = 0; i < args.Length(); ++i) {
        fargs[i] = args[i];
    }
    retval = _func->Call(_obj, args.Length(), fargs );

    return retval;
}
开发者ID:abhishekbhalani,项目名称:webapptools,代码行数:21,代码来源:jsBrowser.cpp

示例4: createJavaProxy

jobject ProxyFactory::createJavaProxy(jclass javaClass, Local<Object> v8Proxy, const Arguments& args)
{
	ProxyInfo* info;
	GET_PROXY_INFO(javaClass, info);

	if (!info) {
		JNIUtil::logClassName("ProxyFactory: failed to find class for %s", javaClass, true);
		LOGE(TAG, "No proxy info found for class.");
		return NULL;
	}

	JNIEnv* env = JNIScope::getEnv();
	if (!env) {
		LOG_JNIENV_ERROR("while creating Java proxy.");
		return NULL;
	}

	// Create a persistent handle to the V8 proxy
	// and cast it to a pointer. The Java proxy needs
	// a reference to the V8 proxy for later use.
	Proxy* proxy = NativeObject::Unwrap<Proxy>(v8Proxy);
	jlong pv8Proxy = (jlong) *(proxy->handle_);

	// We also pass the creation URL of the proxy so we can track relative URLs
	Handle<Value> sourceUrl = args.Callee()->GetScriptOrigin().ResourceName();
	String::Utf8Value sourceUrlValue(sourceUrl);

	const char *url = "app://app.js";
	jstring javaSourceUrl = NULL;
	if (sourceUrlValue.length() > 0) {
		url = *sourceUrlValue;
		javaSourceUrl = env->NewStringUTF(url);
	}

	// Determine if this constructor call was made within
	// the createXYZ() wrapper function. This can be tested by checking
	// if an Arguments object was passed as the sole argument.
	bool calledFromCreate = false;
	if (args.Length() == 1 && args[0]->IsObject()) {
		if (V8Util::constructorNameMatches(args[0]->ToObject(), "Arguments")) {
			calledFromCreate = true;
		}
	}

	// Convert the V8 arguments into Java types so they can be
	// passed to the Java creator method. Which converter we use
	// depends how this constructor was called.
	jobjectArray javaArgs;
	if (calledFromCreate) {
		Local<Object> arguments = args[0]->ToObject();
		int length = arguments->Get(Proxy::lengthSymbol)->Int32Value();
		int start = 0;

		// Get the scope variables if provided and extract the source URL.
		// We need to send that to the Java side when creating the proxy.
		if (length > 0) {
			Local<Object> scopeVars = arguments->Get(0)->ToObject();
			if (V8Util::constructorNameMatches(scopeVars, "ScopeVars")) {
				Local<Value> sourceUrl = scopeVars->Get(Proxy::sourceUrlSymbol);
				javaSourceUrl = TypeConverter::jsValueToJavaString(sourceUrl);
				start = 1;
			}
		}

		javaArgs = TypeConverter::jsObjectIndexPropsToJavaArray(arguments, start, length);
	} else {
		javaArgs = TypeConverter::jsArgumentsToJavaArray(args);
	}

	jobject javaV8Object = env->NewObject(JNIUtil::v8ObjectClass,
		JNIUtil::v8ObjectInitMethod, pv8Proxy);

	// Create the java proxy using the creator static method provided.
	// Send along a pointer to the v8 proxy so the two are linked.
	jobject javaProxy = env->CallStaticObjectMethod(JNIUtil::krollProxyClass,
		info->javaProxyCreator, javaClass, javaV8Object, javaArgs, javaSourceUrl);

	if (javaSourceUrl) {
		LOGV(TAG, "delete source url!");
		env->DeleteLocalRef(javaSourceUrl);
	}

	env->DeleteLocalRef(javaV8Object);
	env->DeleteLocalRef(javaArgs);

	return javaProxy;
}
开发者ID:1rp,项目名称:titanium_mobile,代码行数:87,代码来源:ProxyFactory.cpp


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