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

C++ JSValueMakeBoolean函数代码示例

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

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



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

示例1: Hyperloop_Binary_IsEqual

EXPORTAPI JSValueRef Hyperloop_Binary_IsEqual(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
    if (argumentCount < 2)
    {
        *exception = HyperloopMakeException(ctx, "Wrong arguments passed to IsEqual");
        return JSValueMakeUndefined(ctx);
    }

    auto isObject_a = JSValueIsObject(ctx, arguments[0]);
    auto isObject_b = JSValueIsObject(ctx, arguments[1]);

    if (isObject_a && isObject_b)
    {
        auto obj_a = HyperloopJSValueToVoidPointer(ctx, arguments[0], exception);
        auto obj_b = HyperloopJSValueToVoidPointer(ctx, arguments[1], exception);

        // nullptr means both objects are not a native object
        if (obj_a == nullptr && obj_b == nullptr) {
            return JSValueMakeBoolean(ctx, JSValueIsStrictEqual(ctx, arguments[0], arguments[1]));
        }

        return JSValueMakeBoolean(ctx, (obj_a == obj_b));
    }
    else if (!isObject_a && !isObject_b) {
        return JSValueMakeBoolean(ctx, JSValueIsStrictEqual(ctx, arguments[0], arguments[1]));
    }

    return JSValueMakeBoolean(ctx, false);
}
开发者ID:Sophrinix,项目名称:hyperloop-common,代码行数:28,代码来源:hyperloop.cpp


示例2: isMarkerRangeEqualCallback

static JSValueRef isMarkerRangeEqualCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    if (argumentCount != 1)
        return JSValueMakeBoolean(context, false);
    
    JSObjectRef otherMarker = JSValueToObject(context, arguments[0], exception);
    return JSValueMakeBoolean(context, toTextMarkerRange(thisObject)->isEqual(toTextMarkerRange(otherMarker)));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:8,代码来源:AccessibilityTextMarker.cpp


示例3: addNotificationListenerCallback

static JSValueRef addNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    if (argumentCount != 1)
        return JSValueMakeBoolean(context, false);
    
    JSObjectRef callback = JSValueToObject(context, arguments[0], exception);
    bool succeeded = toAXElement(thisObject)->addNotificationListener(callback);
    return JSValueMakeBoolean(context, succeeded);
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:9,代码来源:AccessibilityUIElement.cpp


示例4: ASSERT_ARG

JSObjectRef InspectorController::addScriptResource(InspectorResource* resource)
{
    ASSERT_ARG(resource, resource);

    // This happens for pages loaded from the back/forward cache.
    if (resource->scriptObject)
        return resource->scriptObject;

    ASSERT(m_scriptContext);
    ASSERT(m_scriptObject);
    if (!m_scriptContext || !m_scriptObject)
        return 0;

    JSStringRef resourceString = JSStringCreateWithUTF8CString("Resource");
    JSObjectRef resourceConstructor = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, resourceString, 0), 0);
    JSStringRelease(resourceString);

    String urlString = resource->requestURL.url();
    JSStringRef url = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
    JSValueRef urlValue = JSValueMakeString(m_scriptContext, url);
    JSStringRelease(url);

    urlString = resource->requestURL.host();
    JSStringRef domain = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
    JSValueRef domainValue = JSValueMakeString(m_scriptContext, domain);
    JSStringRelease(domain);

    urlString = resource->requestURL.path();
    JSStringRef path = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
    JSValueRef pathValue = JSValueMakeString(m_scriptContext, path);
    JSStringRelease(path);

    urlString = resource->requestURL.lastPathComponent();
    JSStringRef lastPathComponent = JSStringCreateWithCharacters(urlString.characters(), urlString.length());
    JSValueRef lastPathComponentValue = JSValueMakeString(m_scriptContext, lastPathComponent);
    JSStringRelease(lastPathComponent);

    JSValueRef identifier = JSValueMakeNumber(m_scriptContext, resource->identifier);
    JSValueRef mainResource = JSValueMakeBoolean(m_scriptContext, m_mainResource == resource);
    JSValueRef cached = JSValueMakeBoolean(m_scriptContext, resource->cached);

    JSValueRef arguments[] = { scriptObjectForRequest(m_scriptContext, resource), urlValue, domainValue, pathValue, lastPathComponentValue, identifier, mainResource, cached };
    JSObjectRef result = JSObjectCallAsConstructor(m_scriptContext, resourceConstructor, 8, arguments, 0);

    resource->setScriptObject(m_scriptContext, result);

    ASSERT(result);

    JSStringRef addResourceString = JSStringCreateWithUTF8CString("addResource");
    JSObjectRef addResourceFunction = JSValueToObject(m_scriptContext, JSObjectGetProperty(m_scriptContext, m_scriptObject, addResourceString, 0), 0);
    JSStringRelease(addResourceString);

    JSValueRef addArguments[] = { result };
    JSObjectCallAsFunction(m_scriptContext, addResourceFunction, m_scriptObject, 1, addArguments, 0);

    return result;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:57,代码来源:InspectorController.cpp


示例5: getIsValidCallback

static JSValueRef getIsValidCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
    AccessibilityUIElement* uiElement = toAXElement(thisObject);
    if (!uiElement->platformUIElement())
        return JSValueMakeBoolean(context, false);
    
    // There might be other platform logic that one could check here...
    
    return JSValueMakeBoolean(context, true);
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:10,代码来源:AccessibilityUIElement.cpp


示例6: addNotificationListenerCallback

static JSValueRef addNotificationListenerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    if (argumentCount != 1)
        return JSValueMakeBoolean(context, false);

    AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
    JSObjectRef callback = JSValueToObject(context, arguments[0], exception);
    bool succeeded = controller->addNotificationListener(callback);
    return JSValueMakeBoolean(context, succeeded);
}
开发者ID:Wrichik1999,项目名称:webkit,代码行数:10,代码来源:AccessibilityController.cpp


示例7: isEqualCallback

static JSValueRef isEqualCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    JSObjectRef otherElement = 0;
    if (argumentCount == 1)
        otherElement = JSValueToObject(context, arguments[0], exception);
    else
        return JSValueMakeBoolean(context, false);
    
    return JSValueMakeBoolean(context, toAXElement(thisObject)->isEqual(toAXElement(otherElement)));
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:10,代码来源:AccessibilityUIElement.cpp


示例8: main

int
main()
{
    JSContextRef ctx = JSGlobalContextCreate(NULL);
    JSValueRef jsvalue;
    JSObjectRef jsobject2;
    JSObjectRef jsobject3;
    JSValueRef jsvalue4;
    jsvalue = JSValueMakeNumber(ctx, 0.123456711111111111);
    print_js(ctx, jsvalue);
    jsvalue = JSValueMakeBoolean(ctx, 1);
    print_js(ctx, jsvalue);
    jsvalue = JSValueMakeBoolean(ctx, 0);
    print_js(ctx, jsvalue);
    jsvalue = JSValueMakeNull(ctx);
    print_js(ctx, jsvalue);
    jsvalue = JSValueMakeUndefined(ctx);
    /* JSObjectIsFunction(ctx, jsvalue); //segmentation fault */
    print_js(ctx, jsvalue);
    jsvalue = JSObjectMakeError(ctx, 0, NULL, NULL);
    printf("%lx\n", (unsigned long)jsvalue);
    printf("%lx\n", (unsigned long)(jsvalue =
                                    JSValueToObject(ctx, jsvalue, NULL)));
    printf("%lx\n", (unsigned long)(jsvalue =
                                    JSValueToObject(ctx, jsvalue, NULL)));
    print_js(ctx, jsvalue);
    jsvalue = JSObjectMake(ctx, NULL, NULL);
    print_js(ctx, jsvalue);
    jsobject2 = (JSObjectRef)get_property(ctx, jsvalue, "toString");
    print_js(ctx, jsobject2);
    jsobject3 = JSObjectMakeError(ctx, 0, NULL, NULL);
    /* jsobject3 = JSValueMakeBoolean(ctx, 0); */
    /* jsobject3 = JSValueMakeNull(ctx); */
    /* jsobject3 = JSValueMakeNumber(ctx, 0.123134123); */
    /* jsobject3 = JSValueMakeUndefined(ctx); */
    jsvalue4 = JSObjectCallAsFunction(ctx, jsobject2, jsobject3, 0, NULL, NULL);
    print_js(ctx, jsvalue4);
    printf("test_function\n");
    //test_function(ctx, jsobject3);

    JSStringRef jsstr;
    jsstr = JSStringCreateWithUTF8CString("abcdef");
    jsvalue = JSValueMakeString(ctx, jsstr);
    JSStringRelease(jsstr);
    printf("%lx\n", (unsigned long)jsvalue);
    print_js(ctx, jsvalue);
    printf("%lx\n", (unsigned long)JSValueToObject(ctx, jsvalue, NULL));
    print_js(ctx, JSValueToObject(ctx, jsvalue, NULL));
    JSObjectCopyPropertyNames(ctx, (JSObjectRef)jsvalue);
    return 0;
}
开发者ID:yuyichao,项目名称:explore,代码行数:51,代码来源:main.c


示例9: JSFeature_getProperty

static JSValueRef JSFeature_getProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
    osgEarth::Features::Feature *feature = static_cast<osgEarth::Features::Feature*>(JSObjectGetPrivate(object));

    char* attrBuf = JSUtils::JSStringRef_to_CharArray(propertyName);
    if (attrBuf)
    {
        std::string attr(attrBuf);
        delete [] attrBuf;
        
        if (attr == "attributes" || attr == "attrs")
        {
            return object;
        }
        
        osgEarth::Features::AttributeTable::const_iterator it = feature->getAttrs().find(attr);
        if (it != feature->getAttrs().end())
        {
            osgEarth::Features::AttributeType atype = (*it).second.first;
            switch (atype)
            {
                case osgEarth::Features::ATTRTYPE_BOOL:
                    return JSValueMakeBoolean(ctx, (*it).second.getBool());
                case osgEarth::Features::ATTRTYPE_DOUBLE:
                    return JSValueMakeNumber(ctx, (*it).second.getDouble());
                case osgEarth::Features::ATTRTYPE_INT:
                    return JSValueMakeNumber(ctx, (*it).second.getInt());
                default:
                    return JSValueMakeString(ctx, JSStringCreateWithUTF8CString((*it).second.getString().c_str()));
            }
        }
    }

    return JSValueMakeNull(ctx);
}
开发者ID:2php,项目名称:osgearth,代码行数:35,代码来源:JSWrappers.cpp


示例10: get_in_authentication_cb

static JSValueRef
get_in_authentication_cb(JSContextRef context,
						 JSObjectRef thisObject,
						 JSStringRef propertyName,
						 JSValueRef *exception) {
	return JSValueMakeBoolean(context, lightdm_greeter_get_in_authentication(GREETER));
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:7,代码来源:lightdm-webkit2-greeter-ext.c


示例11: get_user_logged_in_cb

static JSValueRef
get_user_logged_in_cb(JSContextRef context,
					  JSObjectRef thisObject,
					  JSStringRef propertyName,
					  JSValueRef *exception) {
	return JSValueMakeBoolean(context, lightdm_user_get_logged_in(USER));
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:7,代码来源:lightdm-webkit2-greeter-ext.c


示例12: get_select_guest_cb

static JSValueRef
get_select_guest_cb(JSContextRef context,
					JSObjectRef thisObject,
					JSStringRef propertyName,
					JSValueRef *exception) {
	return JSValueMakeBoolean(context, lightdm_greeter_get_select_guest_hint(GREETER));
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:7,代码来源:lightdm-webkit2-greeter-ext.c


示例13: start_session_sync_cb

static JSValueRef
start_session_sync_cb(JSContextRef context,
					  JSObjectRef function,
					  JSObjectRef thisObject,
					  size_t argumentCount,
					  const JSValueRef arguments[],
					  JSValueRef *exception) {

	gchar *session = NULL;
	gboolean result;
	GError *err = NULL;

	/* FIXME: old API required lightdm.login(username, session), but the username
	 * is never actually used.  At some point, deprecate the old usage.  For now,
	 * simply work around it.
	 */
	if (argumentCount == 1) {
		session = arg_to_string(context, arguments[0], exception);
	} else if (argumentCount == 2) {
		session = arg_to_string(context, arguments[1], exception);
	}

	result = lightdm_greeter_start_session_sync(GREETER, session, &err);
	g_free(session);

	if (err != NULL) {
		_mkexception(context, exception, err->message);
		g_error_free(err);
	}

	return JSValueMakeBoolean(context, result);
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:32,代码来源:lightdm-webkit2-greeter-ext.c


示例14: toBoolForJSBuffer

/**
 * toBool
 */
JSValueRef toBoolForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    PRIMITIVE_GET_ARRAY(bool);
    GET_NUMBER(0,index);
    bool v = value[(size_t)index];
    return JSValueMakeBoolean(ctx,v);
}
开发者ID:pec1985,项目名称:hyperloop,代码行数:11,代码来源:JSBuffer.cpp


示例15: get_can_shutdown_cb

static JSValueRef
get_can_shutdown_cb(JSContextRef context,
					JSObjectRef thisObject,
					JSStringRef propertyName,
					JSValueRef *exception) {

	return JSValueMakeBoolean(context, lightdm_get_can_shutdown());
}
开发者ID:sbalneav,项目名称:lightdm-webkit2-greeter,代码行数:8,代码来源:lightdm-webkit2-greeter-ext.c


示例16: WebKit_win32_NATIVE

JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(JSValueMakeBoolean)
	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
	jintLong rc = 0;
	WebKit_win32_NATIVE_ENTER(env, that, JSValueMakeBoolean_FUNC);
	rc = (jintLong)JSValueMakeBoolean((JSContextRef)arg0, (bool)arg1);
	WebKit_win32_NATIVE_EXIT(env, that, JSValueMakeBoolean_FUNC);
	return rc;
}
开发者ID:HendrikPeilke,项目名称:eclipse.platform.swt,代码行数:9,代码来源:webkit_win32.cpp


示例17: equalsConstructorForJava_java_lang_String

JSValueRef equalsConstructorForJava_java_lang_String(JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    JSPrivateObject* p = (JSPrivateObject*)JSObjectGetPrivate(object);
    if (p && p->object && argumentCount > 0) {
        JSPrivateObject* arg0 = (JSPrivateObject*)JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], NULL));
        if (arg0 == NULL || arg0->object == NULL) return JSValueMakeBoolean(ctx, false);
        JNI_ENV_ENTER
        jclass  javaClass = (*env)->FindClass(env, "java/lang/String");
        if (javaClass == NULL) return HyperloopMakeException(ctx, "Class not found: java.lang.String", exception);

        jmethodID methodId = (*env)->GetMethodID(env, javaClass, "equals", "(Ljava/lang/Object;)Z");
        if (methodId == NULL) return HyperloopMakeException(ctx, "Method not found: java.lang.String#equals", exception);
        
        jboolean result = (*env)->CallBooleanMethod(env, p->object, methodId, arg0->object);
        CHECK_JAVAEXCEPTION
        JNI_ENV_EXIT
        return result == JNI_TRUE ? JSValueMakeBoolean(ctx, true) : JSValueMakeBoolean(ctx, false);
    }
开发者ID:appcelerator-forks,项目名称:appcelerator.hyperloop,代码行数:18,代码来源:JS_java_lang_String.c


示例18: hasMarkedTextCallback

static JSValueRef hasMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject));
    
    if (controller)
        return JSValueMakeBoolean(context, controller->hasMarkedText());

    return JSValueMakeUndefined(context);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:9,代码来源:TextInputController.cpp


示例19: isActionSupportedCallback

static JSValueRef isActionSupportedCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    JSStringRef action = 0;
    if (argumentCount == 1)
        action = JSValueToStringCopy(context, arguments[0], exception);    
    JSValueRef result = JSValueMakeBoolean(context, toAXElement(thisObject)->isActionSupported(action));
    if (action)
        JSStringRelease(action);
    return result;
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:10,代码来源:AccessibilityUIElement.cpp


示例20: ASSERT

void InspectorController::updateScriptResource(InspectorResource* resource, bool finished, bool failed)
{
    ASSERT(resource->scriptObject);
    ASSERT(m_scriptContext);
    if (!resource->scriptObject || !m_scriptContext)
        return;

    JSValueRef failedValue = JSValueMakeBoolean(m_scriptContext, failed);
    JSValueRef finishedValue = JSValueMakeBoolean(m_scriptContext, finished);

    JSStringRef propertyName = JSStringCreateWithUTF8CString("failed");
    JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, failedValue, kJSPropertyAttributeNone, 0);
    JSStringRelease(propertyName);

    propertyName = JSStringCreateWithUTF8CString("finished");
    JSObjectSetProperty(m_scriptContext, resource->scriptObject, propertyName, finishedValue, kJSPropertyAttributeNone, 0);
    JSStringRelease(propertyName);

}
开发者ID:FilipBE,项目名称:qtextended,代码行数:19,代码来源:InspectorController.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ JSValueMakeNull函数代码示例发布时间:2022-05-30
下一篇:
C++ JSValue函数代码示例发布时间: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