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


C++ KValueRef::IsMethod方法代码示例

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


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

示例1: Wrap

	KValueRef ProfiledBoundObject::Wrap(KValueRef value, std::string type)
	{
		if (AlreadyWrapped(value))
		{
			return value;
		}
		else if (value->IsMethod())
		{
			KMethodRef toWrap = value->ToMethod();
			KMethodRef wrapped = new ProfiledBoundMethod(toWrap, type);
			return Value::NewMethod(wrapped);
		}
		else if (value->IsList())
		{
			KListRef wrapped = new ProfiledBoundList(value->ToList());
			return Value::NewList(wrapped);
		}
		else if (value->IsObject())
		{
			KObjectRef wrapped = new ProfiledBoundObject(value->ToObject());
			return Value::NewObject(wrapped);
		}
		else
		{
			return value;
		}
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:27,代码来源:profiled_bound_object.cpp

示例2: DeliverMessage

	void WorkerContext::DeliverMessage(KValueRef message)
	{
		AutoPtr<Event> event(this->CreateEvent("worker.message"));
		event->Set("message", message);

		KValueRef callback = this->Get("onmessage");
		if (callback->IsMethod())
			callback->ToMethod()->Call(Value::NewObject(event));
	}
开发者ID:fossamikom,项目名称:TideSDK,代码行数:9,代码来源:worker_context.cpp

示例3: GetMethod

KMethodRef KObject::GetMethod(const char* name, KMethodRef defaultValue)
{
    KValueRef prop = this->Get(name);
    if (prop->IsMethod())
    {
        return prop->ToMethod();
    }
    else
    {
        return defaultValue;
    }
}
开发者ID:toisoftware,项目名称:TideSDK,代码行数:12,代码来源:kobject.cpp

示例4: DeliverMessage

void WorkerContext::DeliverMessage(KValueRef message)
{
    AutoPtr<Event> event(this->CreateEvent("worker.message"));
    event->Set("message", message);

    KValueRef callback = this->Get("onmessage");
    if (callback->IsMethod())
    {
        Host::GetInstance()->RunOnMainThread(
            callback->ToMethod(),
            ValueList(Value::NewObject(event)),
            false);
    }
}
开发者ID:finglish,项目名称:titanium_desktop,代码行数:14,代码来源:WorkerContext.cpp

示例5: m_missing

    static VALUE m_missing(int argc, VALUE* argv, VALUE self)
    {
        bool assignment = false;

        if (global_object.isNull())
            return Qnil;

        // store the method name and arguments in separate variables
        VALUE method_name, args;
        rb_scan_args(argc, argv, "1*", &method_name, &args);
        char* name = strdup(rb_id2name(SYM2ID(method_name)));

        // Check if this is an assignment
        if (name[strlen(name) - 1] == '=')
        {
            name[strlen(name) - 1] = '\0';
            assignment = true;
        }
        // If we can't find this property perhaps we should return
        // the same property name except capitalized.
        KValueRef v = global_object->Get(name);
        if (v->IsUndefined())
        {
            name[0] = toupper(name[0]);
            v = global_object->Get(name);
        }
        // Okay, maybe not
        if (v->IsUndefined())
            name[0] = tolower(name[0]);

        VALUE rval;
        if (assignment) // Assignment
        {
            rval = rb_ary_entry(args, 0);
            KValueRef val = RubyUtils::ToKrollValue(rval);
            global_object->Set(name, val);
        }
        else if (v->IsMethod()) // Method call
        {
            rval = RubyUtils::GenericKMethodCall(v->ToMethod(), args);
        }
        else // Plain old access
        {
            rval = RubyUtils::ToRubyValue(v);
        }
        return rval;
    }
开发者ID:Adimpression,项目名称:TideSDK,代码行数:47,代码来源:ruby_evaluator.cpp

示例6: AddKrollValueToPHPArray

    void KPHPArrayObject::AddKrollValueToPHPArray(KValueRef value, zval *phpArray)
    {
        if (value->IsNull() || value->IsUndefined())
        {
            add_next_index_null(phpArray);
        }
        else if (value->IsBool())
        {
            if (value->ToBool())
                add_next_index_bool(phpArray, 1);
            else
                add_next_index_bool(phpArray, 0);
        }
        else if (value->IsNumber())
        {
            /* No way to check whether the number is an
               integer or a double here. All Kroll numbers
               are doubles, so return a double. This could
               cause some PHP to function incorrectly if it's
               doing strict type checking. */
            add_next_index_double(phpArray, value->ToNumber());
        }
        else if (value->IsString())
        {
            add_next_index_stringl(phpArray, (char *) value->ToString(), strlen(value->ToString()), 1);
        }
        else if (value->IsObject())
        {
            /*TODO: Implement*/
        }
        else if (value->IsMethod())
        {
            /*TODO: Implement*/
        }
        else if (value->IsList())
        {
            zval *phpValue;
            AutoPtr<KPHPArrayObject> pl = value->ToList().cast<KPHPArrayObject>();
            if (!pl.isNull())
                phpValue = pl->ToPHP();
            else
                phpValue = PHPUtils::ToPHPValue(value);

            add_next_index_zval(phpArray, phpValue);
        }
    }
开发者ID:fossamikom,项目名称:TideSDK,代码行数:46,代码来源:k_php_array_object.cpp

示例7: AlreadyWrapped

	bool ProfiledBoundObject::AlreadyWrapped(KValueRef value)
	{
		if (value->IsMethod()) {
			KMethodRef source = value->ToMethod();
			AutoPtr<ProfiledBoundMethod> po = source.cast<ProfiledBoundMethod>();
			return !po.isNull();

		} else if (value->IsList()) {
			KListRef source = value->ToList();
			AutoPtr<ProfiledBoundList> po = source.cast<ProfiledBoundList>();
			return !po.isNull();

		} else if (value->IsObject()) {
			KObjectRef source = value->ToObject();
			AutoPtr<ProfiledBoundObject> po = source.cast<ProfiledBoundObject>();
			return !po.isNull();

		} else {
			return true;
		}
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:21,代码来源:profiled_bound_object.cpp

示例8: SendQueuedMessages

	void WorkerContext::SendQueuedMessages()
	{
		Logger *logger = Logger::Get("WorkerContext");
		logger->Debug("SendQueuedMessages called");

		if (messages.size() <= 0)
			return;

		KValueRef onMessageValue = worker->Get("onmessage");
		if (!onMessageValue->IsMethod())
			return;

		KMethodRef onMessage(onMessageValue->ToMethod());
		Poco::ScopedLock<Poco::Mutex> lock(mutex);
		std::list<KValueRef>::iterator i = messages.begin();
		while (i != messages.end())
		{
			KValueRef message(*i++);
			this->CallOnMessageCallback(onMessage, message);
		}
		messages.clear();
	}
开发者ID:JamesHayton,项目名称:titanium_desktop,代码行数:22,代码来源:worker_context.cpp


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