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

C++ TypeTest类代码示例

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

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



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

示例1: js_cocos2dx_GLNode_constructor

bool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{

    if (argc == 0) {
        GLNode* cobj = new GLNode();
        cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
        if (_ccobj) {
            _ccobj->autorelease();
        }

        TypeTest<GLNode> t;
        js_type_class_t *typeClass = nullptr;
        std::string typeName = t.s_name();
        auto typeMapIter = _js_global_type_map.find(typeName);

        CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
        typeClass = typeMapIter->second;
        CCASSERT(typeClass, "The value is null.");

        JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
        JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
        // link the native object with the javascript object
        js_proxy_t *p = jsb_new_proxy(cobj, obj);

        JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode");

        return true;
    }
    JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
    return false;
}
开发者ID:2youyou2,项目名称:cocos2d-js,代码行数:31,代码来源:js_bindings_opengl.cpp


示例2: js_register_cocos2dx_DrawNode3D

void js_register_cocos2dx_DrawNode3D(JSContext *cx, JS::HandleObject global) {
    jsb_cocos2d_DrawNode3D_class = (JSClass *)calloc(1, sizeof(JSClass));
    jsb_cocos2d_DrawNode3D_class->name = "DrawNode3D";
    jsb_cocos2d_DrawNode3D_class->addProperty = JS_PropertyStub;
    jsb_cocos2d_DrawNode3D_class->delProperty = JS_DeletePropertyStub;
    jsb_cocos2d_DrawNode3D_class->getProperty = JS_PropertyStub;
    jsb_cocos2d_DrawNode3D_class->setProperty = JS_StrictPropertyStub;
    jsb_cocos2d_DrawNode3D_class->enumerate = JS_EnumerateStub;
    jsb_cocos2d_DrawNode3D_class->resolve = JS_ResolveStub;
    jsb_cocos2d_DrawNode3D_class->convert = JS_ConvertStub;
    jsb_cocos2d_DrawNode3D_class->finalize = js_cocos2d_DrawNode3D_finalize;
    jsb_cocos2d_DrawNode3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

    static JSPropertySpec properties[] = {
        JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_PS_END
    };

    static JSFunctionSpec funcs[] = {
        JS_FN("getBlendFunc", js_cocos2dx_DrawNode3D_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setBlendFunc", js_cocos2dx_DrawNode3D_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("drawLine", js_cocos2dx_DrawNode3D_drawLine, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("clear", js_cocos2dx_DrawNode3D_clear, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("onDraw", js_cocos2dx_DrawNode3D_onDraw, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("init", js_cocos2dx_DrawNode3D_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("drawCube", js_cocos2dx_DrawNode3D_drawCube, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };

    static JSFunctionSpec st_funcs[] = {
        JS_FS_END
    };

    jsb_cocos2d_DrawNode3D_prototype = JS_InitClass(
        cx, global,
        JS::RootedObject(cx, jsb_cocos2d_Node_prototype),
        jsb_cocos2d_DrawNode3D_class,
        js_cocos2dx_DrawNode3D_constructor, 0, // constructor
        properties,
        funcs,
        NULL, // no static properties
        st_funcs);
    // make the class enumerable in the registered namespace
//  bool found;
//FIXME: Removed in Firefox v27 
//  JS_SetPropertyAttributes(cx, global, "DrawNode3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

    // add the proto and JSClass to the type->js info hash table
    TypeTest<cocos2d::DrawNode3D> t;
    js_type_class_t *p;
    std::string typeName = t.s_name();
    if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
    {
        p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
        p->jsclass = jsb_cocos2d_DrawNode3D_class;
        p->proto = jsb_cocos2d_DrawNode3D_prototype;
        p->parentProto = jsb_cocos2d_Node_prototype;
        _js_global_type_map.insert(std::make_pair(typeName, p));
    }
}
开发者ID:1414648814,项目名称:cocos2d-js,代码行数:60,代码来源:js_DrawNode3D_bindings.cpp


示例3: dummy_constructor

static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    JS::RootedValue initializing(cx);
    bool isNewValid = true;
    JS::RootedObject global(cx, ScriptingCore::getInstance()->getGlobalObject());
    isNewValid = JS_GetProperty(cx, global, "initializing", &initializing) && initializing.toBoolean();
    if (isNewValid)
    {
        TypeTest<T> t;
        js_type_class_t *typeClass = nullptr;
        std::string typeName = t.s_name();
        auto typeMapIter = _js_global_type_map.find(typeName);
        CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
        typeClass = typeMapIter->second;
        CCASSERT(typeClass, "The value is null.");

        JS::RootedObject proto(cx, typeClass->proto.get());
        JS::RootedObject parent(cx, typeClass->parentProto.get());
        JS::RootedObject _tmp(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
        
        args.rval().set(OBJECT_TO_JSVAL(_tmp));
        return true;
    }

    JS_ReportError(cx, "Constructor for the requested class is not available, please refer to the API reference.");
    return false;
}
开发者ID:xungong91,项目名称:ZjhMobile,代码行数:27,代码来源:jsb_cocos2dx_nativehelper.cpp


示例4: js_cocos2dx_extension_HttpRequest_constructor

JSBool js_cocos2dx_extension_HttpRequest_constructor(JSContext *cx, uint32_t argc, jsval *vp){
	if(argc == 0){
		HttpRequest* cobj = new HttpRequest(); 
		cocos2d::CCObject *_ccobj = dynamic_cast<cocos2d::CCObject *>(cobj);
		if (_ccobj) {
			_ccobj->autorelease();
		}

		TypeTest<cocos2d::extension::CCHttpRequest> t;
		js_type_class_t *typeClass;
		uint32_t typeId = t.s_id();
		HASH_FIND_INT(_js_global_type_ht, &typeId, typeClass);
		assert(typeClass);
		JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);

		JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
		// link the native object with the javascript object
		js_proxy_t *p;
		JS_NEW_PROXY(p, cobj, obj);
		JS_AddNamedObjectRoot(cx, &p->obj, "HttpRequest");

		return JS_TRUE;
	}
	JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
	return JS_FALSE;
}
开发者ID:akira-cn,项目名称:cocos2dx-cqwrap,代码行数:26,代码来源:cqwrap_httprequest_manual.cpp


示例5: dummy_constructor

static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
    JS::RootedValue initializing(cx);
    bool isNewValid = true;
#if not $script_control_cpp
    JSObject* global = ScriptingCore::getInstance()->getGlobalObject();
	isNewValid = JS_GetProperty(cx, global, "initializing", &initializing) && JSVAL_TO_BOOLEAN(initializing);
#end if
	if (isNewValid)
	{
		TypeTest<T> t;
		js_type_class_t *typeClass = nullptr;
		std::string typeName = t.s_name();
		auto typeMapIter = _js_global_type_map.find(typeName);
		CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
		typeClass = typeMapIter->second;
		CCASSERT(typeClass, "The value is null.");

		JSObject *_tmp = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
	#if $script_control_cpp
		T* cobj = new T();
		js_proxy_t *pp = jsb_new_proxy(cobj, _tmp);
		JS_AddObjectRoot(cx, &pp->obj);
	#end if
		JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
		return true;
	}

#if not $script_control_cpp
    JS_ReportError(cx, "Don't use `new cc.XXX`, please use `cc.XXX.create` instead! ");
#end if
    return false;
}
开发者ID:289997171,项目名称:cocos2d-x,代码行数:32,代码来源:layout_head.c


示例6: js_register_cocos2dx_nativehelper_NativeHelper

void js_register_cocos2dx_nativehelper_NativeHelper(JSContext *cx, JS::HandleObject global) {
    jsb_cocos2d_NativeHelper_class = (JSClass *)calloc(1, sizeof(JSClass));
    jsb_cocos2d_NativeHelper_class->name = "NativeHelper";
    jsb_cocos2d_NativeHelper_class->addProperty = JS_PropertyStub;
    jsb_cocos2d_NativeHelper_class->delProperty = JS_DeletePropertyStub;
    jsb_cocos2d_NativeHelper_class->getProperty = JS_PropertyStub;
    jsb_cocos2d_NativeHelper_class->setProperty = JS_StrictPropertyStub;
    jsb_cocos2d_NativeHelper_class->enumerate = JS_EnumerateStub;
    jsb_cocos2d_NativeHelper_class->resolve = JS_ResolveStub;
    jsb_cocos2d_NativeHelper_class->convert = JS_ConvertStub;
    jsb_cocos2d_NativeHelper_class->finalize = js_cocos2d_NativeHelper_finalize;
    jsb_cocos2d_NativeHelper_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

    static JSPropertySpec properties[] = {
        JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_PS_END
    };

    static JSFunctionSpec funcs[] = {
        JS_FN("recvJsMsg", js_cocos2dx_nativehelper_NativeHelper_recvJsMsg, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("startSendMsg", js_cocos2dx_nativehelper_NativeHelper_startSendMsg, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setPacketAssembler", js_cocos2dx_nativehelper_NativeHelper_setPacketAssembler, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setCallBack", js_cocos2dx_nativehelper_NativeHelper_setCallBack, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("sendJsMsg", js_cocos2dx_nativehelper_NativeHelper_sendJsMsg, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("test", js_cocos2dx_nativehelper_NativeHelper_test, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };

    static JSFunctionSpec st_funcs[] = {
        JS_FN("singleton", js_cocos2dx_nativehelper_NativeHelper_singleton, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };

    jsb_cocos2d_NativeHelper_prototype = JS_InitClass(
        cx, global,
        JS::NullPtr(), // parent proto
        jsb_cocos2d_NativeHelper_class,
        dummy_constructor<cocos2d::NativeHelper>, 0, // no constructor
        properties,
        funcs,
        NULL, // no static properties
        st_funcs);
    // make the class enumerable in the registered namespace
//  bool found;
//FIXME: Removed in Firefox v27 
//  JS_SetPropertyAttributes(cx, global, "NativeHelper", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

    // add the proto and JSClass to the type->js info hash table
    TypeTest<cocos2d::NativeHelper> t;
    js_type_class_t *p;
    std::string typeName = t.s_name();
    if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
    {
        p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
        p->jsclass = jsb_cocos2d_NativeHelper_class;
        p->proto = jsb_cocos2d_NativeHelper_prototype;
        p->parentProto = NULL;
        _js_global_type_map.insert(std::make_pair(typeName, p));
    }
}
开发者ID:xungong91,项目名称:ZjhMobile,代码行数:60,代码来源:jsb_cocos2dx_nativehelper.cpp


示例7: dummy_constructor

static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    JS::RootedValue initializing(cx);
    bool isNewValid = true;
    if (isNewValid)
    {
        TypeTest<T> t;
        js_type_class_t *typeClass = nullptr;
        std::string typeName = t.s_name();
        auto typeMapIter = _js_global_type_map.find(typeName);
        CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
        typeClass = typeMapIter->second;
        CCASSERT(typeClass, "The value is null.");

#if (COCOS2D_VERSION >= 0x00031000)
        JS::RootedObject proto(cx, typeClass->proto.ref());
        JS::RootedObject parent(cx, typeClass->parentProto.ref());
#else
        JS::RootedObject proto(cx, typeClass->proto.get());
        JS::RootedObject parent(cx, typeClass->parentProto.get());
#endif
        JS::RootedObject _tmp(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
        
        T* cobj = new T();
        js_proxy_t *pp = jsb_new_proxy(cobj, _tmp);
        AddObjectRoot(cx, &pp->obj);
        args.rval().set(OBJECT_TO_JSVAL(_tmp));
        return true;
    }

    return false;
}
开发者ID:tinybearc,项目名称:sdkbox-sample-iap,代码行数:32,代码来源:PluginIAPJS.cpp


示例8: js_cocos2dx_GLNode_constructor

JSBool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
    
  if (argc == 0) {
    GLNode* cobj = new GLNode();
#ifdef COCOS2D_JAVASCRIPT
    cocos2d::Object *_ccobj = dynamic_cast<cocos2d::Object *>(cobj);
    if (_ccobj) {
      _ccobj->autorelease();
    }
#endif
    TypeTest<GLNode> t;
    js_type_class_t *typeClass;
    uint32_t typeId = t.s_id();
    HASH_FIND_INT(_js_global_type_ht, &typeId, typeClass);
    assert(typeClass);
    JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
    // link the native object with the javascript object
    js_proxy_t *p = jsb_new_proxy(cobj, obj);
#ifdef COCOS2D_JAVASCRIPT
    JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode");
#endif
    return JS_TRUE;
  }
  JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
  return JS_FALSE;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:28,代码来源:js_bindings_opengl.cpp


示例9: jsb_Effect3DOutline_constructor

bool jsb_Effect3DOutline_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    bool ok = true;
    Effect3DOutline* cobj = new (std::nothrow) Effect3DOutline();
    cobj->init();
    cobj->autorelease();
    TypeTest<Effect3DOutline> t;
    js_type_class_t *typeClass = nullptr;
    std::string typeName = t.s_name();
    auto typeMapIter = _js_global_type_map.find(typeName);
    CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
    typeClass = typeMapIter->second;
    CCASSERT(typeClass, "The value is null.");
    JS::RootedObject proto(cx, typeClass->proto.ref());
    JS::RootedObject parent(cx, typeClass->parentProto.ref());
    JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
    args.rval().set(OBJECT_TO_JSVAL(obj));
    // link the native object with the javascript object
    js_proxy_t* p = jsb_new_proxy(cobj, obj);
    AddNamedObjectRoot(cx, &p->obj, "cocos2d::Effect3DOutline");
    if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
        ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
    return true;
}
开发者ID:compmix,项目名称:cocos2d-x-3.10,代码行数:25,代码来源:js_Effect3D_bindings.cpp


示例10: js_register_cocos2dx_spine_SkeletonAnimation

void js_register_cocos2dx_spine_SkeletonAnimation(JSContext *cx, JSObject *global) {
	jsb_spine_SkeletonAnimation_class = (JSClass *)calloc(1, sizeof(JSClass));
	jsb_spine_SkeletonAnimation_class->name = "SkeletonAnimation";
	jsb_spine_SkeletonAnimation_class->addProperty = JS_PropertyStub;
	jsb_spine_SkeletonAnimation_class->delProperty = JS_DeletePropertyStub;
	jsb_spine_SkeletonAnimation_class->getProperty = JS_PropertyStub;
	jsb_spine_SkeletonAnimation_class->setProperty = JS_StrictPropertyStub;
	jsb_spine_SkeletonAnimation_class->enumerate = JS_EnumerateStub;
	jsb_spine_SkeletonAnimation_class->resolve = JS_ResolveStub;
	jsb_spine_SkeletonAnimation_class->convert = JS_ConvertStub;
	jsb_spine_SkeletonAnimation_class->finalize = js_spine_SkeletonAnimation_finalize;
	jsb_spine_SkeletonAnimation_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

	static JSPropertySpec properties[] = {
		{"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
		{0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
	};

	static JSFunctionSpec funcs[] = {
		JS_FN("update", js_cocos2dx_spine_SkeletonAnimation_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("setMix", js_cocos2dx_spine_SkeletonAnimation_setMix, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("clearTracks", js_cocos2dx_spine_SkeletonAnimation_clearTracks, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("clearTrack", js_cocos2dx_spine_SkeletonAnimation_clearTrack, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("onAnimationStateEvent", js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
	};

	static JSFunctionSpec st_funcs[] = {
		JS_FN("create", js_cocos2dx_spine_SkeletonAnimation_createWithFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FS_END
	};

	jsb_spine_SkeletonAnimation_prototype = JS_InitClass(
		cx, global,
		jsb_spine_Skeleton_prototype,
		jsb_spine_SkeletonAnimation_class,
		js_cocos2dx_spine_SkeletonAnimation_constructor, 0, // constructor
		properties,
		funcs,
		NULL, // no static properties
		st_funcs);
	// make the class enumerable in the registered namespace
//	bool found;
//FIXME: Removed in Firefox v27	
//	JS_SetPropertyAttributes(cx, global, "SkeletonAnimation", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

	// add the proto and JSClass to the type->js info hash table
	TypeTest<spine::SkeletonAnimation> t;
	js_type_class_t *p;
	std::string typeName = t.s_name();
	if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
	{
		p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
		p->jsclass = jsb_spine_SkeletonAnimation_class;
		p->proto = jsb_spine_SkeletonAnimation_prototype;
		p->parentProto = jsb_spine_Skeleton_prototype;
		_js_global_type_map.insert(std::make_pair(typeName, p));
	}
}
开发者ID:2youyou2,项目名称:cocos2d-js,代码行数:59,代码来源:jsb_cocos2dx_spine_auto.cpp


示例11: js_register_PluginShareJS_PluginShare

void js_register_PluginShareJS_PluginShare(JSContext *cx, JS::HandleObject global) {
    jsb_sdkbox_PluginShare_class = (JSClass *)calloc(1, sizeof(JSClass));
    jsb_sdkbox_PluginShare_class->name = "PluginShare";
    jsb_sdkbox_PluginShare_class->addProperty = JS_PropertyStub;
    jsb_sdkbox_PluginShare_class->delProperty = JS_DeletePropertyStub;
    jsb_sdkbox_PluginShare_class->getProperty = JS_PropertyStub;
    jsb_sdkbox_PluginShare_class->setProperty = JS_StrictPropertyStub;
    jsb_sdkbox_PluginShare_class->enumerate = JS_EnumerateStub;
    jsb_sdkbox_PluginShare_class->resolve = JS_ResolveStub;
    jsb_sdkbox_PluginShare_class->convert = JS_ConvertStub;
    jsb_sdkbox_PluginShare_class->finalize = js_PluginShareJS_PluginShare_finalize;
    jsb_sdkbox_PluginShare_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

    static JSPropertySpec properties[] = {
        JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_PS_END
    };

    static JSFunctionSpec funcs[] = {
        JS_FS_END
    };

    static JSFunctionSpec st_funcs[] = {
        JS_FN("init", js_PluginShareJS_PluginShare_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };

    jsb_sdkbox_PluginShare_prototype = JS_InitClass(
        cx, global,
        JS::NullPtr(), // parent proto
        jsb_sdkbox_PluginShare_class,
        dummy_constructor<sdkbox::PluginShare>, 0, // no constructor
        properties,
        funcs,
        NULL, // no static properties
        st_funcs);
    // make the class enumerable in the registered namespace
//  bool found;
//FIXME: Removed in Firefox v27 
//  JS_SetPropertyAttributes(cx, global, "PluginShare", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

    // add the proto and JSClass to the type->js info hash table
#if (COCOS2D_VERSION >= 0x00031000)
    JS::RootedObject proto(cx, jsb_sdkbox_PluginShare_prototype);
    jsb_register_class<sdkbox::PluginShare>(cx, jsb_sdkbox_PluginShare_class, proto, JS::NullPtr());
#else
    TypeTest<sdkbox::PluginShare> t;
    js_type_class_t *p;
    std::string typeName = t.s_name();
    if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
    {
        p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
        p->jsclass = jsb_sdkbox_PluginShare_class;
        p->proto = jsb_sdkbox_PluginShare_prototype;
        p->parentProto = NULL;
        _js_global_type_map.insert(std::make_pair(typeName, p));
    }
#endif
}
开发者ID:tinybearc,项目名称:sdkbox-share-sample,代码行数:59,代码来源:PluginShareJS.cpp


示例12: js_register_PluginIAPJS_IAP

void js_register_PluginIAPJS_IAP(JSContext *cx, JSObject *global) {
    jsb_sdkbox_IAP_class = (JSClass *)calloc(1, sizeof(JSClass));
    jsb_sdkbox_IAP_class->name = "IAP";
    jsb_sdkbox_IAP_class->addProperty = JS_PropertyStub;
    jsb_sdkbox_IAP_class->delProperty = JS_DeletePropertyStub;
    jsb_sdkbox_IAP_class->getProperty = JS_PropertyStub;
    jsb_sdkbox_IAP_class->setProperty = JS_StrictPropertyStub;
    jsb_sdkbox_IAP_class->enumerate = JS_EnumerateStub;
    jsb_sdkbox_IAP_class->resolve = JS_ResolveStub;
    jsb_sdkbox_IAP_class->convert = JS_ConvertStub;
    jsb_sdkbox_IAP_class->finalize = js_PluginIAPJS_IAP_finalize;
    jsb_sdkbox_IAP_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

    static JSPropertySpec properties[] = {
        {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
        {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
    };

    static JSFunctionSpec funcs[] = {
        JS_FS_END
    };

    static JSFunctionSpec st_funcs[] = {
        JS_FN("purchase", js_PluginIAPJS_IAP_purchase, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("restore", js_PluginIAPJS_IAP_restore, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("refresh", js_PluginIAPJS_IAP_refresh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("init", js_PluginIAPJS_IAP_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setDebug", js_PluginIAPJS_IAP_setDebug, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("removeListener", js_PluginIAPJS_IAP_removeListener, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };

    jsb_sdkbox_IAP_prototype = JS_InitClass(
        cx, global,
        NULL, // parent proto
        jsb_sdkbox_IAP_class,
        dummy_constructor<sdkbox::IAP>, 0, // no constructor
        properties,
        funcs,
        NULL, // no static properties
        st_funcs);
    // make the class enumerable in the registered namespace
//  bool found;
//FIXME: Removed in Firefox v27 
//  JS_SetPropertyAttributes(cx, global, "IAP", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

    // add the proto and JSClass to the type->js info hash table
    TypeTest<sdkbox::IAP> t;
    js_type_class_t *p;
    std::string typeName = t.s_name();
    if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
    {
        p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
        p->jsclass = jsb_sdkbox_IAP_class;
        p->proto = jsb_sdkbox_IAP_prototype;
        p->parentProto = NULL;
        _js_global_type_map.insert(std::make_pair(typeName, p));
    }
}
开发者ID:tinybearc,项目名称:sdkbox-sample-iap,代码行数:59,代码来源:PluginIAPJS.cpp


示例13: js_register_controls_Button

void js_register_controls_Button(JSContext *cx, JSObject *global) {
	jsb_es_Button_class = (JSClass *)calloc(1, sizeof(JSClass));
	jsb_es_Button_class->name = "Button";
	jsb_es_Button_class->addProperty = JS_PropertyStub;
	jsb_es_Button_class->delProperty = JS_DeletePropertyStub;
	jsb_es_Button_class->getProperty = JS_PropertyStub;
	jsb_es_Button_class->setProperty = JS_StrictPropertyStub;
	jsb_es_Button_class->enumerate = JS_EnumerateStub;
	jsb_es_Button_class->resolve = JS_ResolveStub;
	jsb_es_Button_class->convert = JS_ConvertStub;
	jsb_es_Button_class->finalize = js_es_Button_finalize;
	jsb_es_Button_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

	static JSPropertySpec properties[] = {
		{"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
		{0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
	};

	static JSFunctionSpec funcs[] = {
		JS_FN("getNormalTextureScaleInSize", js_controls_Button_getNormalTextureScaleInSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("ctor", js_es_Button_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
	};

	static JSFunctionSpec st_funcs[] = {
		JS_FN("create", js_controls_Button_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("createInstance", js_controls_Button_createInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FS_END
	};

	jsb_es_Button_prototype = JS_InitClass(
		cx, global,
		jsb_cocos2d_ui_Button_prototype,
		jsb_es_Button_class,
		dummy_constructor<es::Button>, 0, // no constructor
		properties,
		funcs,
		NULL, // no static properties
		st_funcs);
	// make the class enumerable in the registered namespace
//	bool found;
//FIXME: Removed in Firefox v27	
//	JS_SetPropertyAttributes(cx, global, "Button", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

	// add the proto and JSClass to the type->js info hash table
	TypeTest<es::Button> t;
	js_type_class_t *p;
	std::string typeName = t.s_name();
	if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
	{
		p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
		p->jsclass = jsb_es_Button_class;
		p->proto = jsb_es_Button_prototype;
		p->parentProto = jsb_cocos2d_ui_Button_prototype;
		_js_global_type_map.insert(std::make_pair(typeName, p));
	}
}
开发者ID:tovchenko,项目名称:espreso,代码行数:57,代码来源:jsb_controls_auto.cpp


示例14: js_register_pluginx_admob_AdsAdmob

void js_register_pluginx_admob_AdsAdmob(JSContext *cx, JSObject *global) {
	jsb_AdsAdmob_class = (JSClass *)calloc(1, sizeof(JSClass));
	jsb_AdsAdmob_class->name = "AdsAdmob";
	jsb_AdsAdmob_class->addProperty = JS_PropertyStub;
	jsb_AdsAdmob_class->delProperty = JS_PropertyStub;
	jsb_AdsAdmob_class->getProperty = JS_PropertyStub;
	jsb_AdsAdmob_class->setProperty = JS_StrictPropertyStub;
	jsb_AdsAdmob_class->enumerate = JS_EnumerateStub;
	jsb_AdsAdmob_class->resolve = JS_ResolveStub;
	jsb_AdsAdmob_class->convert = JS_ConvertStub;
	jsb_AdsAdmob_class->finalize = js_pluginx_admob_AdsAdmob_finalize;
	jsb_AdsAdmob_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

	JSPropertySpec *properties = NULL;

	static JSFunctionSpec funcs[] = {
		JS_FN("showAds", js_pluginx_admob_AdsAdmob_showAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("hideAds", js_pluginx_admob_AdsAdmob_hideAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("addTestDevice", js_pluginx_admob_AdsAdmob_addTestDevice, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("getPluginName", js_pluginx_admob_AdsAdmob_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("getPluginVersion", js_pluginx_admob_AdsAdmob_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("init", js_pluginx_admob_AdsAdmob_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("configDeveloperInfo", js_pluginx_admob_AdsAdmob_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("getSDKVersion", js_pluginx_admob_AdsAdmob_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("setDebugMode", js_pluginx_admob_AdsAdmob_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
	};

	JSFunctionSpec *st_funcs = NULL;

	jsb_AdsAdmob_prototype = JS_InitClass(
		cx, global,
		jsb_ProtocolAds_prototype,
		jsb_AdsAdmob_class,
		empty_constructor, 0,
		properties,
		funcs,
		NULL, // no static properties
		st_funcs);
	// make the class enumerable in the registered namespace
	JSBool found;
	JS_SetPropertyAttributes(cx, global, "AdsAdmob", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

	// add the proto and JSClass to the type->js info hash table
	TypeTest<cocos2d::plugin::AdsAdmob> t;
	js_type_class_t *p;
	uint32_t typeId = t.s_id();
	HASH_FIND_INT(_js_global_type_ht, &typeId, p);
	if (!p) {
		p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
		p->type = typeId;
		p->jsclass = jsb_AdsAdmob_class;
		p->proto = jsb_AdsAdmob_prototype;
		p->parentProto = jsb_ProtocolAds_prototype;
		HASH_ADD_INT(_js_global_type_ht, type, p);
	}
}
开发者ID:ASpade,项目名称:cocos2d-x,代码行数:57,代码来源:jsb_pluginx_admob_auto.cpp


示例15: js_register_skeleton

void js_register_skeleton(JSContext* cx, JSObject* global)
{
    jsb_skeleton_class = (JSClass *)calloc(1, sizeof(JSClass));
    
    jsb_skeleton_class->name = "skeletonAnim";
    jsb_skeleton_class->addProperty = JS_PropertyStub;
    jsb_skeleton_class->delProperty = JS_PropertyStub;
    jsb_skeleton_class->getProperty = JS_PropertyStub;
    jsb_skeleton_class->setProperty = JS_StrictPropertyStub;
    jsb_skeleton_class->enumerate = JS_EnumerateStub;
    jsb_skeleton_class->resolve = JS_ResolveStub;
    jsb_skeleton_class->convert = JS_ConvertStub;
    
    jsb_skeleton_class->finalize = js_skeleton_finalize;
    jsb_skeleton_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
    
    static JSPropertySpec properties[] = {
        {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
    };
    
    static JSFunctionSpec funcs[] = {
        JS_FN("setAnimation", js_skeleton_setAnimation, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };
    
    static JSFunctionSpec st_funcs[] = {
        JS_FN("create", js_skeleton_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };
    
    jsb_skeleton_prototype = JS_InitClass(
                                            cx, global,
                                            NULL, // parent proto
                                            jsb_skeleton_class,
                                            js_skeleton_constructor, 0, // 这里绑定的是构造函数的实现,也就是用 js new 操作符创建的对象
                                            properties,
                                            funcs,      // 函数绑定
                                            NULL, // no static properties
                                            st_funcs);      // 静态函数绑定
    
    JSBool found;
    JS_SetPropertyAttributes(cx, global, "Leafsoar", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
    
    TypeTest<cocos2d::extension::CCSkeletonAnimation> t;
    js_type_class_t *p;
    uint32_t typeId = t.s_id();
    HASH_FIND_INT(_js_global_type_ht, &typeId, p);
    if (!p) {
        p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
        p->type = typeId;
        p->jsclass = jsb_skeleton_class;
        p->proto = jsb_skeleton_prototype;
        p->parentProto = NULL;
        HASH_ADD_INT(_js_global_type_ht, type, p);
    }
    
}
开发者ID:zqlgithub,项目名称:spineBinding,代码行数:57,代码来源:skeleton_js_binding.cpp


示例16: js_register_pluginx_protocols_ProtocolAds

void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global) {
	jsb_ProtocolAds_class = (JSClass *)calloc(1, sizeof(JSClass));
	jsb_ProtocolAds_class->name = "ProtocolAds";
	jsb_ProtocolAds_class->addProperty = JS_PropertyStub;
	jsb_ProtocolAds_class->delProperty = JS_PropertyStub;
	jsb_ProtocolAds_class->getProperty = JS_PropertyStub;
	jsb_ProtocolAds_class->setProperty = JS_StrictPropertyStub;
	jsb_ProtocolAds_class->enumerate = JS_EnumerateStub;
	jsb_ProtocolAds_class->resolve = JS_ResolveStub;
	jsb_ProtocolAds_class->convert = JS_ConvertStub;
	jsb_ProtocolAds_class->finalize = js_pluginx_protocols_ProtocolAds_finalize;
	jsb_ProtocolAds_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

	static JSPropertySpec properties[] = {
		{0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
	};

	static JSFunctionSpec funcs[] = {
		JS_FN("showAds", js_pluginx_protocols_ProtocolAds_showAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("hideAds", js_pluginx_protocols_ProtocolAds_hideAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("queryPoints", js_pluginx_protocols_ProtocolAds_queryPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("onAdsResult", js_pluginx_protocols_ProtocolAds_onAdsResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("spendPoints", js_pluginx_protocols_ProtocolAds_spendPoints, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("configDeveloperInfo", js_pluginx_protocols_ProtocolAds_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("onPlayerGetPoints", js_pluginx_protocols_ProtocolAds_onPlayerGetPoints, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
	};

	JSFunctionSpec *st_funcs = NULL;

	jsb_ProtocolAds_prototype = JS_InitClass(
		cx, global,
		jsb_PluginProtocol_prototype,
		jsb_ProtocolAds_class,
		empty_constructor, 0,
		properties,
		funcs,
		NULL, // no static properties
		st_funcs);
	// make the class enumerable in the registered namespace
	JSBool found;
	JS_SetPropertyAttributes(cx, global, "ProtocolAds", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

	// add the proto and JSClass to the type->js info hash table
	TypeTest<cocos2d::plugin::ProtocolAds> t;
	js_type_class_t *p;
	uint32_t typeId = t.s_id();
	HASH_FIND_INT(_js_global_type_ht, &typeId, p);
	if (!p) {
		p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
		p->type = typeId;
		p->jsclass = jsb_ProtocolAds_class;
		p->proto = jsb_ProtocolAds_prototype;
		p->parentProto = jsb_PluginProtocol_prototype;
		HASH_ADD_INT(_js_global_type_ht, type, p);
	}
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:57,代码来源:jsb_pluginx_protocols_auto.cpp


示例17: js_register_pluginx_protocols_PluginManager

void js_register_pluginx_protocols_PluginManager(JSContext *cx, JSObject *global) {
	jsb_PluginManager_class = (JSClass *)calloc(1, sizeof(JSClass));
	jsb_PluginManager_class->name = "PluginManager";
	jsb_PluginManager_class->addProperty = JS_PropertyStub;
	jsb_PluginManager_class->delProperty = JS_PropertyStub;
	jsb_PluginManager_class->getProperty = JS_PropertyStub;
	jsb_PluginManager_class->setProperty = JS_StrictPropertyStub;
	jsb_PluginManager_class->enumerate = JS_EnumerateStub;
	jsb_PluginManager_class->resolve = JS_ResolveStub;
	jsb_PluginManager_class->convert = JS_ConvertStub;
	jsb_PluginManager_class->finalize = js_pluginx_protocols_PluginManager_finalize;
	jsb_PluginManager_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

	static JSPropertySpec properties[] = {
		{0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
	};

	static JSFunctionSpec funcs[] = {
		JS_FN("unloadPlugin", js_pluginx_protocols_PluginManager_unloadPlugin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("loadPlugin", js_pluginx_protocols_PluginManager_loadPlugin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
	};

	static JSFunctionSpec st_funcs[] = {
		JS_FN("end", js_pluginx_protocols_PluginManager_end, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("getInstance", js_pluginx_protocols_PluginManager_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FS_END
	};

	jsb_PluginManager_prototype = JS_InitClass(
		cx, global,
		NULL, // parent proto
		jsb_PluginManager_class,
		empty_constructor, 0,
		properties,
		funcs,
		NULL, // no static properties
		st_funcs);
	// make the class enumerable in the registered namespace
	JSBool found;
	JS_SetPropertyAttributes(cx, global, "PluginManager", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

	// add the proto and JSClass to the type->js info hash table
	TypeTest<cocos2d::plugin::PluginManager> t;
	js_type_class_t *p;
	uint32_t typeId = t.s_id();
	HASH_FIND_INT(_js_global_type_ht, &typeId, p);
	if (!p) {
		p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
		p->type = typeId;
		p->jsclass = jsb_PluginManager_class;
		p->proto = jsb_PluginManager_prototype;
		p->parentProto = NULL;
		HASH_ADD_INT(_js_global_type_ht, type, p);
	}
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:56,代码来源:jsb_pluginx_protocols_auto.cpp


示例18: js_register_pluginx_protocols_ProtocolAnalytics

void js_register_pluginx_protocols_ProtocolAnalytics(JSContext *cx, JSObject *global) {
	jsb_ProtocolAnalytics_class = (JSClass *)calloc(1, sizeof(JSClass));
	jsb_ProtocolAnalytics_class->name = "ProtocolAnalytics";
	jsb_ProtocolAnalytics_class->addProperty = JS_PropertyStub;
	jsb_ProtocolAnalytics_class->delProperty = JS_PropertyStub;
	jsb_ProtocolAnalytics_class->getProperty = JS_PropertyStub;
	jsb_ProtocolAnalytics_class->setProperty = JS_StrictPropertyStub;
	jsb_ProtocolAnalytics_class->enumerate = JS_EnumerateStub;
	jsb_ProtocolAnalytics_class->resolve = JS_ResolveStub;
	jsb_ProtocolAnalytics_class->convert = JS_ConvertStub;
	jsb_ProtocolAnalytics_class->finalize = js_pluginx_protocols_ProtocolAnalytics_finalize;
	jsb_ProtocolAnalytics_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);

	JSPropertySpec *properties = NULL;

	static JSFunctionSpec funcs[] = {
		JS_FN("logTimedEventBegin", js_pluginx_protocols_ProtocolAnalytics_logTimedEventBegin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("logError", js_pluginx_protocols_ProtocolAnalytics_logError, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("setCaptureUncaughtException", js_pluginx_protocols_ProtocolAnalytics_setCaptureUncaughtException, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("setSessionContinueMillis", js_pluginx_protocols_ProtocolAnalytics_setSessionContinueMillis, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("logEvent", js_pluginx_protocols_ProtocolAnalytics_logEvent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("startSession", js_pluginx_protocols_ProtocolAnalytics_startSession, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("stopSession", js_pluginx_protocols_ProtocolAnalytics_stopSession, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
		JS_FN("logTimedEventEnd", js_pluginx_protocols_ProtocolAnalytics_logTimedEventEnd, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
	};

	JSFunctionSpec *st_funcs = NULL;

	jsb_ProtocolAnalytics_prototype = JS_InitClass(
		cx, global,
		jsb_PluginProtocol_prototype,
		jsb_ProtocolAnalytics_class,
		empty_constructor, 0,
		properties,
		funcs,
		NULL, // no static properties
		st_funcs);
	// make the class enumerable in the registered namespace
	JSBool found;
	JS_SetPropertyAttributes(cx, global, "ProtocolAnalytics", JSPROP_ENUMERATE | JSPROP_READONLY, &found);

	// add the proto and JSClass to the type->js info hash table
	TypeTest<cocos2d::plugin::ProtocolAnalytics> t;
	js_type_class_t *p;
	uint32_t typeId = t.s_id();
	HASH_FIND_INT(_js_global_type_ht, &typeId, p);
	if (!p) {
		p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
		p->type = typeId;
		p->jsclass = jsb_ProtocolAnalytics_class;
		p->proto = jsb_ProtocolAnalytics_prototype;
		p->parentProto = jsb_PluginProtocol_prototype;
		HASH_ADD_INT(_js_global_type_ht, type, p);
	}
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:56,代码来源:jsb_pluginx_protocols_auto.cpp


示例19: js_register_PluginFacebookJS_PluginFacebook

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TypeVector类代码示例发布时间:2022-05-31
下一篇:
C++ TypeSystem类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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