Merge branch 'ForReflection'

Conflicts:
	plugin/protocols/platform/ios/PluginUtilsIOS.mm
This commit is contained in:
zhangbin 2013-06-04 10:12:41 +08:00
commit d83c9b58a5
52 changed files with 814 additions and 4207 deletions

View File

@ -1,315 +0,0 @@
#include "jsb_pluginx_admob_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "AdsAdmob.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_AdsAdmob_class;
JSObject *jsb_AdsAdmob_prototype;
JSBool js_pluginx_admob_AdsAdmob_showAds(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
cocos2d::plugin::ProtocolAds::AdsType arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->showAds(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
if (argc == 2) {
cocos2d::plugin::ProtocolAds::AdsType arg0;
int arg1;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->showAds(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
if (argc == 3) {
cocos2d::plugin::ProtocolAds::AdsType arg0;
int arg1;
cocos2d::plugin::ProtocolAds::AdsPos arg2;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
ok &= jsval_to_int32(cx, argv[2], (int32_t *)&arg2);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->showAds(arg0, arg1, arg2);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_hideAds(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
cocos2d::plugin::ProtocolAds::AdsType arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->hideAds(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_addTestDevice(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->addTestDevice(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TAdsDeveloperInfo arg0;
ok &= jsval_to_TAdsDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_admob_AdsAdmob_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AdsAdmob* cobj = (cocos2d::plugin::AdsAdmob *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolAds_prototype;
void js_pluginx_admob_AdsAdmob_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (AdsAdmob)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::AdsAdmob *nobj = static_cast<cocos2d::plugin::AdsAdmob *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
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);
}
}
void register_all_pluginx_admob(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_admob_AdsAdmob(cx, obj);
}

View File

@ -1,25 +0,0 @@
#ifndef __pluginx_admob_h__
#define __pluginx_admob_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_AdsAdmob_class;
extern JSObject *jsb_AdsAdmob_prototype;
JSBool js_pluginx_admob_AdsAdmob_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_admob_AdsAdmob_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_admob_AdsAdmob(JSContext *cx, JSObject *global);
void register_all_pluginx_admob(JSContext* cx, JSObject* obj);
JSBool js_pluginx_admob_AdsAdmob_showAds(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_hideAds(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_addTestDevice(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_admob_AdsAdmob_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,67 +0,0 @@
/**
* @module pluginx_admob
*/
var plugin = plugin || {};
/**
* @class AdsAdmob
*/
plugin.AdsAdmob = {
/**
* @method showAds
* @param {cocos2d::plugin::ProtocolAds::AdsType}
* @param {int}
* @param {cocos2d::plugin::ProtocolAds::AdsPos}
*/
showAds : function () {},
/**
* @method hideAds
* @param {cocos2d::plugin::ProtocolAds::AdsType}
*/
hideAds : function () {},
/**
* @method addTestDevice
* @param {const char*}
*/
addTestDevice : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method configDeveloperInfo
* @param {TAdsDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -1,251 +0,0 @@
#include "jsb_pluginx_alipay_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "IAPAlipay.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_IAPAlipay_class;
JSObject *jsb_IAPAlipay_prototype;
JSBool js_pluginx_alipay_IAPAlipay_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TIAPDeveloperInfo arg0;
ok &= jsval_to_TIAPDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_alipay_IAPAlipay_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_alipay_IAPAlipay_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_alipay_IAPAlipay_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_alipay_IAPAlipay_payForProduct(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TProductInfo arg0;
ok &= jsval_to_TProductInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->payForProduct(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_alipay_IAPAlipay_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_alipay_IAPAlipay_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPAlipay* cobj = (cocos2d::plugin::IAPAlipay *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolIAP_prototype;
void js_pluginx_alipay_IAPAlipay_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (IAPAlipay)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::IAPAlipay *nobj = static_cast<cocos2d::plugin::IAPAlipay *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
void js_register_pluginx_alipay_IAPAlipay(JSContext *cx, JSObject *global) {
jsb_IAPAlipay_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_IAPAlipay_class->name = "IAPAlipay";
jsb_IAPAlipay_class->addProperty = JS_PropertyStub;
jsb_IAPAlipay_class->delProperty = JS_PropertyStub;
jsb_IAPAlipay_class->getProperty = JS_PropertyStub;
jsb_IAPAlipay_class->setProperty = JS_StrictPropertyStub;
jsb_IAPAlipay_class->enumerate = JS_EnumerateStub;
jsb_IAPAlipay_class->resolve = JS_ResolveStub;
jsb_IAPAlipay_class->convert = JS_ConvertStub;
jsb_IAPAlipay_class->finalize = js_pluginx_alipay_IAPAlipay_finalize;
jsb_IAPAlipay_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
static JSFunctionSpec funcs[] = {
JS_FN("configDeveloperInfo", js_pluginx_alipay_IAPAlipay_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_alipay_IAPAlipay_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_alipay_IAPAlipay_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_alipay_IAPAlipay_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("payForProduct", js_pluginx_alipay_IAPAlipay_payForProduct, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_alipay_IAPAlipay_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_alipay_IAPAlipay_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_IAPAlipay_prototype = JS_InitClass(
cx, global,
jsb_ProtocolIAP_prototype,
jsb_IAPAlipay_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, "IAPAlipay", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::IAPAlipay> 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_IAPAlipay_class;
p->proto = jsb_IAPAlipay_prototype;
p->parentProto = jsb_ProtocolIAP_prototype;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
void register_all_pluginx_alipay(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_alipay_IAPAlipay(cx, obj);
}

View File

@ -1,23 +0,0 @@
#ifndef __pluginx_alipay_h__
#define __pluginx_alipay_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_IAPAlipay_class;
extern JSObject *jsb_IAPAlipay_prototype;
JSBool js_pluginx_alipay_IAPAlipay_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_alipay_IAPAlipay_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_alipay_IAPAlipay(JSContext *cx, JSObject *global);
void register_all_pluginx_alipay(JSContext* cx, JSObject* obj);
JSBool js_pluginx_alipay_IAPAlipay_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_alipay_IAPAlipay_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_alipay_IAPAlipay_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_alipay_IAPAlipay_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_alipay_IAPAlipay_payForProduct(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_alipay_IAPAlipay_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_alipay_IAPAlipay_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,53 +0,0 @@
/**
* @module pluginx_alipay
*/
var plugin = plugin || {};
/**
* @class IAPAlipay
*/
plugin.IAPAlipay = {
/**
* @method configDeveloperInfo
* @param {TIAPDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method payForProduct
* @param {TProductInfo}
*/
payForProduct : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -1,576 +0,0 @@
#include "jsb_pluginx_flurry_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "AnalyticsFlurry.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_AnalyticsFlurry_class;
JSObject *jsb_AnalyticsFlurry_prototype;
JSBool js_pluginx_flurry_AnalyticsFlurry_logTimedEventBegin(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = NULL;
cocos2d::plugin::AnalyticsFlurry* cobj = NULL;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
do {
if (argc == 2) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
LogEventParamMap* arg1;
LogEventParamMap arg1_tmp;
do {
ok &= jsval_to_LogEventParamMap(cx, argv[1], &arg1);
if (ok) { arg1_tmp = *arg1; delete arg1; arg1 = &arg1_tmp; } else { arg1 = NULL; }
} while(0);
if (!ok) { ok = JS_TRUE; break; }
cobj->logTimedEventBegin(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
do {
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
cobj->logTimedEventBegin(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setUserId(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setUserId(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_logError(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 2) {
const char* arg0;
const char* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logError(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setCaptureUncaughtException(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setCaptureUncaughtException(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setGender(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
cocos2d::plugin::AnalyticsFlurry::Gender arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setGender(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_logPageView(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
cobj->logPageView();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setReportLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setReportLocation(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_logEvent(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logEvent(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
if (argc == 2) {
const char* arg0;
LogEventParamMap* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
LogEventParamMap arg1_tmp;
do {
ok &= jsval_to_LogEventParamMap(cx, argv[1], &arg1);
if (ok) { arg1_tmp = *arg1; delete arg1; arg1 = &arg1_tmp; } else { arg1 = NULL; }
} while(0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logEvent(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
long arg0;
ok &= jsval_to_long(cx, argv[0], (long *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setSessionContinueMillis(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setAge(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
int arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setAge(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setVersionName(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setVersionName(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_startSession(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->startSession(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_stopSession(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
cobj->stopSession();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setUseHttps(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setUseHttps(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_logTimedEventEnd(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = NULL;
cocos2d::plugin::AnalyticsFlurry* cobj = NULL;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
do {
if (argc == 2) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
LogEventParamMap* arg1;
LogEventParamMap arg1_tmp;
do {
ok &= jsval_to_LogEventParamMap(cx, argv[1], &arg1);
if (ok) { arg1_tmp = *arg1; delete arg1; arg1 = &arg1_tmp; } else { arg1 = NULL; }
} while(0);
if (!ok) { ok = JS_TRUE; break; }
cobj->logTimedEventEnd(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
do {
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
cobj->logTimedEventEnd(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_flurry_AnalyticsFlurry_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsFlurry* cobj = (cocos2d::plugin::AnalyticsFlurry *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolAnalytics_prototype;
void js_pluginx_flurry_AnalyticsFlurry_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (AnalyticsFlurry)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::AnalyticsFlurry *nobj = static_cast<cocos2d::plugin::AnalyticsFlurry *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
void js_register_pluginx_flurry_AnalyticsFlurry(JSContext *cx, JSObject *global) {
jsb_AnalyticsFlurry_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_AnalyticsFlurry_class->name = "AnalyticsFlurry";
jsb_AnalyticsFlurry_class->addProperty = JS_PropertyStub;
jsb_AnalyticsFlurry_class->delProperty = JS_PropertyStub;
jsb_AnalyticsFlurry_class->getProperty = JS_PropertyStub;
jsb_AnalyticsFlurry_class->setProperty = JS_StrictPropertyStub;
jsb_AnalyticsFlurry_class->enumerate = JS_EnumerateStub;
jsb_AnalyticsFlurry_class->resolve = JS_ResolveStub;
jsb_AnalyticsFlurry_class->convert = JS_ConvertStub;
jsb_AnalyticsFlurry_class->finalize = js_pluginx_flurry_AnalyticsFlurry_finalize;
jsb_AnalyticsFlurry_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
static JSFunctionSpec funcs[] = {
JS_FN("logTimedEventBegin", js_pluginx_flurry_AnalyticsFlurry_logTimedEventBegin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setUserId", js_pluginx_flurry_AnalyticsFlurry_setUserId, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logError", js_pluginx_flurry_AnalyticsFlurry_logError, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCaptureUncaughtException", js_pluginx_flurry_AnalyticsFlurry_setCaptureUncaughtException, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setGender", js_pluginx_flurry_AnalyticsFlurry_setGender, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logPageView", js_pluginx_flurry_AnalyticsFlurry_logPageView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_flurry_AnalyticsFlurry_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setReportLocation", js_pluginx_flurry_AnalyticsFlurry_setReportLocation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_flurry_AnalyticsFlurry_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logEvent", js_pluginx_flurry_AnalyticsFlurry_logEvent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setSessionContinueMillis", js_pluginx_flurry_AnalyticsFlurry_setSessionContinueMillis, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setAge", js_pluginx_flurry_AnalyticsFlurry_setAge, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_flurry_AnalyticsFlurry_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setVersionName", js_pluginx_flurry_AnalyticsFlurry_setVersionName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("startSession", js_pluginx_flurry_AnalyticsFlurry_startSession, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("stopSession", js_pluginx_flurry_AnalyticsFlurry_stopSession, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setUseHttps", js_pluginx_flurry_AnalyticsFlurry_setUseHttps, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedEventEnd", js_pluginx_flurry_AnalyticsFlurry_logTimedEventEnd, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_flurry_AnalyticsFlurry_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_flurry_AnalyticsFlurry_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_AnalyticsFlurry_prototype = JS_InitClass(
cx, global,
jsb_ProtocolAnalytics_prototype,
jsb_AnalyticsFlurry_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, "AnalyticsFlurry", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::AnalyticsFlurry> 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_AnalyticsFlurry_class;
p->proto = jsb_AnalyticsFlurry_prototype;
p->parentProto = jsb_ProtocolAnalytics_prototype;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
void register_all_pluginx_flurry(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_flurry_AnalyticsFlurry(cx, obj);
}

View File

@ -1,36 +0,0 @@
#ifndef __pluginx_flurry_h__
#define __pluginx_flurry_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_AnalyticsFlurry_class;
extern JSObject *jsb_AnalyticsFlurry_prototype;
JSBool js_pluginx_flurry_AnalyticsFlurry_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_flurry_AnalyticsFlurry_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_flurry_AnalyticsFlurry(JSContext *cx, JSObject *global);
void register_all_pluginx_flurry(JSContext* cx, JSObject* obj);
JSBool js_pluginx_flurry_AnalyticsFlurry_logTimedEventBegin(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setUserId(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_logError(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setCaptureUncaughtException(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setGender(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_logPageView(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setReportLocation(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_logEvent(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setAge(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setVersionName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_startSession(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_stopSession(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setUseHttps(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_logTimedEventEnd(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_flurry_AnalyticsFlurry_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,119 +0,0 @@
/**
* @module pluginx_flurry
*/
var plugin = plugin || {};
/**
* @class AnalyticsFlurry
*/
plugin.AnalyticsFlurry = {
/**
* @method setUserId
* @param {const char*}
*/
setUserId : function () {},
/**
* @method logError
* @param {const char*}
* @param {const char*}
*/
logError : function () {},
/**
* @method setCaptureUncaughtException
* @param {bool}
*/
setCaptureUncaughtException : function () {},
/**
* @method setGender
* @param {cocos2d::plugin::AnalyticsFlurry::Gender}
*/
setGender : function () {},
/**
* @method logPageView
*/
logPageView : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method setReportLocation
* @param {bool}
*/
setReportLocation : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method logEvent
* @param {const char*}
* @param {LogEventParamMap*}
*/
logEvent : function () {},
/**
* @method setSessionContinueMillis
* @param {long}
*/
setSessionContinueMillis : function () {},
/**
* @method setAge
* @param {int}
*/
setAge : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method setVersionName
* @param {const char*}
*/
setVersionName : function () {},
/**
* @method startSession
* @param {const char*}
*/
startSession : function () {},
/**
* @method stopSession
*/
stopSession : function () {},
/**
* @method setUseHttps
* @param {bool}
*/
setUseHttps : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -1,251 +0,0 @@
#include "jsb_pluginx_nd91_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "IAPNd91.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_IAPNd91_class;
JSObject *jsb_IAPNd91_prototype;
JSBool js_pluginx_nd91_IAPNd91_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TIAPDeveloperInfo arg0;
ok &= jsval_to_TIAPDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_nd91_IAPNd91_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_nd91_IAPNd91_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_nd91_IAPNd91_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_nd91_IAPNd91_payForProduct(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TProductInfo arg0;
ok &= jsval_to_TProductInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->payForProduct(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_nd91_IAPNd91_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_nd91_IAPNd91_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::IAPNd91* cobj = (cocos2d::plugin::IAPNd91 *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolIAP_prototype;
void js_pluginx_nd91_IAPNd91_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (IAPNd91)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::IAPNd91 *nobj = static_cast<cocos2d::plugin::IAPNd91 *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
void js_register_pluginx_nd91_IAPNd91(JSContext *cx, JSObject *global) {
jsb_IAPNd91_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_IAPNd91_class->name = "IAPNd91";
jsb_IAPNd91_class->addProperty = JS_PropertyStub;
jsb_IAPNd91_class->delProperty = JS_PropertyStub;
jsb_IAPNd91_class->getProperty = JS_PropertyStub;
jsb_IAPNd91_class->setProperty = JS_StrictPropertyStub;
jsb_IAPNd91_class->enumerate = JS_EnumerateStub;
jsb_IAPNd91_class->resolve = JS_ResolveStub;
jsb_IAPNd91_class->convert = JS_ConvertStub;
jsb_IAPNd91_class->finalize = js_pluginx_nd91_IAPNd91_finalize;
jsb_IAPNd91_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
static JSFunctionSpec funcs[] = {
JS_FN("configDeveloperInfo", js_pluginx_nd91_IAPNd91_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_nd91_IAPNd91_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_nd91_IAPNd91_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_nd91_IAPNd91_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("payForProduct", js_pluginx_nd91_IAPNd91_payForProduct, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_nd91_IAPNd91_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_nd91_IAPNd91_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_IAPNd91_prototype = JS_InitClass(
cx, global,
jsb_ProtocolIAP_prototype,
jsb_IAPNd91_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, "IAPNd91", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::IAPNd91> 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_IAPNd91_class;
p->proto = jsb_IAPNd91_prototype;
p->parentProto = jsb_ProtocolIAP_prototype;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
void register_all_pluginx_nd91(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_nd91_IAPNd91(cx, obj);
}

View File

@ -1,23 +0,0 @@
#ifndef __pluginx_nd91_h__
#define __pluginx_nd91_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_IAPNd91_class;
extern JSObject *jsb_IAPNd91_prototype;
JSBool js_pluginx_nd91_IAPNd91_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_nd91_IAPNd91_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_nd91_IAPNd91(JSContext *cx, JSObject *global);
void register_all_pluginx_nd91(JSContext* cx, JSObject* obj);
JSBool js_pluginx_nd91_IAPNd91_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_nd91_IAPNd91_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_nd91_IAPNd91_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_nd91_IAPNd91_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_nd91_IAPNd91_payForProduct(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_nd91_IAPNd91_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_nd91_IAPNd91_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,53 +0,0 @@
/**
* @module pluginx_nd91
*/
var plugin = plugin || {};
/**
* @class IAPNd91
*/
plugin.IAPNd91 = {
/**
* @method configDeveloperInfo
* @param {TIAPDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method payForProduct
* @param {TProductInfo}
*/
payForProduct : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -32,43 +32,6 @@ static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
JSClass *jsb_PluginProtocol_class;
JSObject *jsb_PluginProtocol_prototype;
JSBool js_pluginx_protocols_PluginProtocol_setUserData(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
void* arg0;
#pragma warning NO CONVERSION TO NATIVE FOR void*;
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setUserData(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_PluginProtocol_getUserData(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
void* ret = cobj->getUserData();
jsval jsret;
#pragma warning NO CONVERSION FROM NATIVE FOR void*;
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_PluginProtocol_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
@ -103,16 +66,16 @@ JSBool js_pluginx_protocols_PluginProtocol_getPluginVersion(JSContext *cx, uint3
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_PluginProtocol_init(JSContext *cx, uint32_t argc, jsval *vp)
JSBool js_pluginx_protocols_PluginProtocol_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
@ -177,11 +140,9 @@ void js_register_pluginx_protocols_PluginProtocol(JSContext *cx, JSObject *globa
};
static JSFunctionSpec funcs[] = {
JS_FN("setUserData", js_pluginx_protocols_PluginProtocol_setUserData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getUserData", js_pluginx_protocols_PluginProtocol_getUserData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_protocols_PluginProtocol_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_protocols_PluginProtocol_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_protocols_PluginProtocol_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_protocols_PluginProtocol_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_protocols_PluginProtocol_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@ -332,7 +293,9 @@ void js_register_pluginx_protocols_PluginManager(JSContext *cx, JSObject *global
jsb_PluginManager_class->finalize = js_pluginx_protocols_PluginManager_finalize;
jsb_PluginManager_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
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),
@ -440,38 +403,24 @@ JSBool js_pluginx_protocols_ProtocolAnalytics_setCaptureUncaughtException(JSCont
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
JSBool js_pluginx_protocols_ProtocolAnalytics_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAnalytics* cobj = (cocos2d::plugin::ProtocolAnalytics *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
if (argc == 1) {
long arg0;
ok &= jsval_to_long(cx, argv[0], (long *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setSessionContinueMillis(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAnalytics* cobj = (cocos2d::plugin::ProtocolAnalytics *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_logEvent(JSContext *cx, uint32_t argc, jsval *vp)
@ -508,43 +457,6 @@ JSBool js_pluginx_protocols_ProtocolAnalytics_logEvent(JSContext *cx, uint32_t a
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAnalytics* cobj = (cocos2d::plugin::ProtocolAnalytics *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
long arg0;
ok &= jsval_to_long(cx, argv[0], (long *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setSessionContinueMillis(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAnalytics* cobj = (cocos2d::plugin::ProtocolAnalytics *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_startSession(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -600,43 +512,6 @@ JSBool js_pluginx_protocols_ProtocolAnalytics_logTimedEventEnd(JSContext *cx, ui
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAnalytics* cobj = (cocos2d::plugin::ProtocolAnalytics *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAnalytics_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAnalytics* cobj = (cocos2d::plugin::ProtocolAnalytics *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_PluginProtocol_prototype;
@ -676,16 +551,11 @@ void js_register_pluginx_protocols_ProtocolAnalytics(JSContext *cx, JSObject *gl
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("getPluginName", js_pluginx_protocols_ProtocolAnalytics_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_protocols_ProtocolAnalytics_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logEvent", js_pluginx_protocols_ProtocolAnalytics_logEvent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setSessionContinueMillis", js_pluginx_protocols_ProtocolAnalytics_setSessionContinueMillis, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_protocols_ProtocolAnalytics_init, 0, 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_FN("getSDKVersion", js_pluginx_protocols_ProtocolAnalytics_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_protocols_ProtocolAnalytics_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@ -723,23 +593,6 @@ void js_register_pluginx_protocols_ProtocolAnalytics(JSContext *cx, JSObject *gl
JSClass *jsb_ProtocolIAP_class;
JSObject *jsb_ProtocolIAP_prototype;
JSBool js_pluginx_protocols_ProtocolIAP_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolIAP* cobj = (cocos2d::plugin::ProtocolIAP *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_payForProduct(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -760,60 +613,6 @@ JSBool js_pluginx_protocols_ProtocolIAP_payForProduct(JSContext *cx, uint32_t ar
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolIAP* cobj = (cocos2d::plugin::ProtocolIAP *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TIAPDeveloperInfo arg0;
ok &= jsval_to_TIAPDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolIAP* cobj = (cocos2d::plugin::ProtocolIAP *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolIAP* cobj = (cocos2d::plugin::ProtocolIAP *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_onPayResult(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -836,24 +635,7 @@ JSBool js_pluginx_protocols_ProtocolIAP_onPayResult(JSContext *cx, uint32_t argc
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolIAP* cobj = (cocos2d::plugin::ProtocolIAP *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolIAP_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
JSBool js_pluginx_protocols_ProtocolIAP_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
@ -862,10 +644,10 @@ JSBool js_pluginx_protocols_ProtocolIAP_setDebugMode(JSContext *cx, uint32_t arg
cocos2d::plugin::ProtocolIAP* cobj = (cocos2d::plugin::ProtocolIAP *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
TIAPDeveloperInfo arg0;
ok &= jsval_to_TIAPDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
@ -911,14 +693,9 @@ void js_register_pluginx_protocols_ProtocolIAP(JSContext *cx, JSObject *global)
};
static JSFunctionSpec funcs[] = {
JS_FN("getPluginVersion", js_pluginx_protocols_ProtocolIAP_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("payForProduct", js_pluginx_protocols_ProtocolIAP_payForProduct, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("configDeveloperInfo", js_pluginx_protocols_ProtocolIAP_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_protocols_ProtocolIAP_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_protocols_ProtocolIAP_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("onPayResult", js_pluginx_protocols_ProtocolIAP_onPayResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_protocols_ProtocolIAP_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_protocols_ProtocolIAP_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("configDeveloperInfo", js_pluginx_protocols_ProtocolIAP_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@ -1018,38 +795,44 @@ JSBool js_pluginx_protocols_ProtocolAds_hideAds(JSContext *cx, uint32_t argc, js
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
JSBool js_pluginx_protocols_ProtocolAds_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
if (argc == 1) {
TAdsDeveloperInfo arg0;
ok &= jsval_to_TAdsDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
JSBool js_pluginx_protocols_ProtocolAds_spendPoints(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
if (argc == 1) {
int arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->spendPoints(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_onAdsResult(JSContext *cx, uint32_t argc, jsval *vp)
@ -1074,63 +857,6 @@ JSBool js_pluginx_protocols_ProtocolAds_onAdsResult(JSContext *cx, uint32_t argc
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_spendPoints(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
int arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->spendPoints(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TAdsDeveloperInfo arg0;
ok &= jsval_to_TAdsDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_onPlayerGetPoints(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -1151,43 +877,6 @@ JSBool js_pluginx_protocols_ProtocolAds_onPlayerGetPoints(JSContext *cx, uint32_
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_PluginProtocol_prototype;
@ -1228,15 +917,10 @@ void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global)
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("getPluginVersion", js_pluginx_protocols_ProtocolAds_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_protocols_ProtocolAds_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("onAdsResult", js_pluginx_protocols_ProtocolAds_onAdsResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_protocols_ProtocolAds_init, 0, 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("spendPoints", js_pluginx_protocols_ProtocolAds_spendPoints, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("onAdsResult", js_pluginx_protocols_ProtocolAds_onAdsResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("onPlayerGetPoints", js_pluginx_protocols_ProtocolAds_onPlayerGetPoints, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_protocols_ProtocolAds_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_protocols_ProtocolAds_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@ -1274,23 +958,6 @@ void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global)
JSClass *jsb_ProtocolSocial_class;
JSObject *jsb_ProtocolSocial_prototype;
JSBool js_pluginx_protocols_ProtocolSocial_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_onShareResult(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -1313,23 +980,6 @@ JSBool js_pluginx_protocols_ProtocolSocial_onShareResult(JSContext *cx, uint32_t
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_share(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -1350,23 +1000,6 @@ JSBool js_pluginx_protocols_ProtocolSocial_share(JSContext *cx, uint32_t argc, j
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
@ -1387,69 +1020,6 @@ JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, ui
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolSocial_setResultListener(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::ProtocolSocial* cobj = (cocos2d::plugin::ProtocolSocial *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
cocos2d::plugin::ShareResultListener* arg0;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
JS_GET_NATIVE_PROXY(proxy, tmpObj);
arg0 = (cocos2d::plugin::ShareResultListener*)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, JS_FALSE, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setResultListener(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_PluginProtocol_prototype;
@ -1488,15 +1058,9 @@ void js_register_pluginx_protocols_ProtocolSocial(JSContext *cx, JSObject *globa
};
static JSFunctionSpec funcs[] = {
JS_FN("getPluginName", js_pluginx_protocols_ProtocolSocial_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("onShareResult", js_pluginx_protocols_ProtocolSocial_onShareResult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_protocols_ProtocolSocial_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("share", js_pluginx_protocols_ProtocolSocial_share, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_protocols_ProtocolSocial_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("configDeveloperInfo", js_pluginx_protocols_ProtocolSocial_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_protocols_ProtocolSocial_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_protocols_ProtocolSocial_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setResultListener", js_pluginx_protocols_ProtocolSocial_setResultListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};

View File

@ -12,11 +12,9 @@ JSBool js_pluginx_protocols_PluginProtocol_constructor(JSContext *cx, uint32_t a
void js_pluginx_protocols_PluginProtocol_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_protocols_PluginProtocol(JSContext *cx, JSObject *global);
void register_all_pluginx_protocols(JSContext* cx, JSObject* obj);
JSBool js_pluginx_protocols_PluginProtocol_setUserData(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_PluginProtocol_getUserData(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_PluginProtocol_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_PluginProtocol_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_PluginProtocol_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_PluginProtocol_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_PluginProtocol_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
extern JSClass *jsb_PluginManager_class;
@ -41,16 +39,11 @@ void register_all_pluginx_protocols(JSContext* cx, JSObject* obj);
JSBool js_pluginx_protocols_ProtocolAnalytics_logTimedEventBegin(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_logError(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_setCaptureUncaughtException(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_logEvent(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_logEvent(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_startSession(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_stopSession(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_logTimedEventEnd(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAnalytics_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
extern JSClass *jsb_ProtocolIAP_class;
extern JSObject *jsb_ProtocolIAP_prototype;
@ -59,14 +52,9 @@ JSBool js_pluginx_protocols_ProtocolIAP_constructor(JSContext *cx, uint32_t argc
void js_pluginx_protocols_ProtocolIAP_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_protocols_ProtocolIAP(JSContext *cx, JSObject *global);
void register_all_pluginx_protocols(JSContext* cx, JSObject* obj);
JSBool js_pluginx_protocols_ProtocolIAP_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_payForProduct(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_onPayResult(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolIAP_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
extern JSClass *jsb_ProtocolAds_class;
extern JSObject *jsb_ProtocolAds_prototype;
@ -77,15 +65,10 @@ void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global);
void register_all_pluginx_protocols(JSContext* cx, JSObject* obj);
JSBool js_pluginx_protocols_ProtocolAds_showAds(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_hideAds(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_onAdsResult(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_spendPoints(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_spendPoints(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_onAdsResult(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_onPlayerGetPoints(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolAds_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
extern JSClass *jsb_ProtocolSocial_class;
extern JSObject *jsb_ProtocolSocial_prototype;
@ -94,14 +77,8 @@ JSBool js_pluginx_protocols_ProtocolSocial_constructor(JSContext *cx, uint32_t a
void js_pluginx_protocols_ProtocolSocial_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_protocols_ProtocolSocial(JSContext *cx, JSObject *global);
void register_all_pluginx_protocols(JSContext* cx, JSObject* obj);
JSBool js_pluginx_protocols_ProtocolSocial_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_onShareResult(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_share(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_protocols_ProtocolSocial_setResultListener(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -8,18 +8,6 @@ var plugin = plugin || {};
*/
plugin.PluginProtocol = {
/**
* @method setUserData
* @param {void*}
*/
setUserData : function () {},
/**
* @method getUserData
* @return A value converted from C/C++ "void*"
*/
getUserData : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
@ -33,10 +21,10 @@ getPluginName : function () {},
getPluginVersion : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
init : function () {},
getSDKVersion : function () {},
/**
* @method setDebugMode
@ -102,16 +90,10 @@ logError : function () {},
setCaptureUncaughtException : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
* @method setSessionContinueMillis
* @param {long}
*/
getPluginName : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
setSessionContinueMillis : function () {},
/**
* @method logEvent
@ -120,18 +102,6 @@ getPluginVersion : function () {},
*/
logEvent : function () {},
/**
* @method setSessionContinueMillis
* @param {long}
*/
setSessionContinueMillis : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method startSession
* @param {const char*}
@ -149,18 +119,6 @@ stopSession : function () {},
*/
logTimedEventEnd : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};
/**
@ -168,36 +126,12 @@ setDebugMode : function () {},
*/
plugin.ProtocolIAP = {
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method payForProduct
* @param {TProductInfo}
*/
payForProduct : function () {},
/**
* @method configDeveloperInfo
* @param {TIAPDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method onPayResult
* @param {cocos2d::plugin::PayResultCode}
@ -206,16 +140,10 @@ getPluginName : function () {},
onPayResult : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
* @method configDeveloperInfo
* @param {TIAPDeveloperInfo}
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
configDeveloperInfo : function () {},
};
@ -239,16 +167,16 @@ showAds : function () {},
hideAds : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
* @method configDeveloperInfo
* @param {TAdsDeveloperInfo}
*/
getPluginVersion : function () {},
configDeveloperInfo : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
* @method spendPoints
* @param {int}
*/
getPluginName : function () {},
spendPoints : function () {},
/**
* @method onAdsResult
@ -257,42 +185,12 @@ getPluginName : function () {},
*/
onAdsResult : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method spendPoints
* @param {int}
*/
spendPoints : function () {},
/**
* @method configDeveloperInfo
* @param {TAdsDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method onPlayerGetPoints
* @param {int}
*/
onPlayerGetPoints : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};
/**
@ -300,12 +198,6 @@ setDebugMode : function () {},
*/
plugin.ProtocolSocial = {
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method onShareResult
* @param {cocos2d::plugin::ShareResultCode}
@ -313,46 +205,16 @@ getPluginName : function () {},
*/
onShareResult : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method share
* @param {TShareInfo}
*/
share : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method configDeveloperInfo
* @param {TSocialDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
/**
* @method setResultListener
* @param {cocos2d::plugin::ShareResultListener*}
*/
setResultListener : function () {},
};

View File

@ -1,251 +0,0 @@
#include "jsb_pluginx_twitter_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "SocialTwitter.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_SocialTwitter_class;
JSObject *jsb_SocialTwitter_prototype;
JSBool js_pluginx_twitter_SocialTwitter_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_twitter_SocialTwitter_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_twitter_SocialTwitter_share(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TShareInfo arg0;
ok &= jsval_to_TShareInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->share(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_twitter_SocialTwitter_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_twitter_SocialTwitter_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TSocialDeveloperInfo arg0;
ok &= jsval_to_TSocialDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_twitter_SocialTwitter_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_twitter_SocialTwitter_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialTwitter* cobj = (cocos2d::plugin::SocialTwitter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolSocial_prototype;
void js_pluginx_twitter_SocialTwitter_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (SocialTwitter)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::SocialTwitter *nobj = static_cast<cocos2d::plugin::SocialTwitter *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
void js_register_pluginx_twitter_SocialTwitter(JSContext *cx, JSObject *global) {
jsb_SocialTwitter_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_SocialTwitter_class->name = "SocialTwitter";
jsb_SocialTwitter_class->addProperty = JS_PropertyStub;
jsb_SocialTwitter_class->delProperty = JS_PropertyStub;
jsb_SocialTwitter_class->getProperty = JS_PropertyStub;
jsb_SocialTwitter_class->setProperty = JS_StrictPropertyStub;
jsb_SocialTwitter_class->enumerate = JS_EnumerateStub;
jsb_SocialTwitter_class->resolve = JS_ResolveStub;
jsb_SocialTwitter_class->convert = JS_ConvertStub;
jsb_SocialTwitter_class->finalize = js_pluginx_twitter_SocialTwitter_finalize;
jsb_SocialTwitter_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
static JSFunctionSpec funcs[] = {
JS_FN("getPluginName", js_pluginx_twitter_SocialTwitter_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_twitter_SocialTwitter_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("share", js_pluginx_twitter_SocialTwitter_share, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_twitter_SocialTwitter_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("configDeveloperInfo", js_pluginx_twitter_SocialTwitter_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_twitter_SocialTwitter_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_twitter_SocialTwitter_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_SocialTwitter_prototype = JS_InitClass(
cx, global,
jsb_ProtocolSocial_prototype,
jsb_SocialTwitter_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, "SocialTwitter", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::SocialTwitter> 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_SocialTwitter_class;
p->proto = jsb_SocialTwitter_prototype;
p->parentProto = jsb_ProtocolSocial_prototype;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
void register_all_pluginx_twitter(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_twitter_SocialTwitter(cx, obj);
}

View File

@ -1,23 +0,0 @@
#ifndef __pluginx_twitter_h__
#define __pluginx_twitter_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_SocialTwitter_class;
extern JSObject *jsb_SocialTwitter_prototype;
JSBool js_pluginx_twitter_SocialTwitter_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_twitter_SocialTwitter_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_twitter_SocialTwitter(JSContext *cx, JSObject *global);
void register_all_pluginx_twitter(JSContext* cx, JSObject* obj);
JSBool js_pluginx_twitter_SocialTwitter_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_twitter_SocialTwitter_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_twitter_SocialTwitter_share(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_twitter_SocialTwitter_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_twitter_SocialTwitter_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_twitter_SocialTwitter_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_twitter_SocialTwitter_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,53 +0,0 @@
/**
* @module pluginx_twitter
*/
var plugin = plugin || {};
/**
* @class SocialTwitter
*/
plugin.SocialTwitter = {
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method share
* @param {TShareInfo}
*/
share : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method configDeveloperInfo
* @param {TSocialDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -1,674 +0,0 @@
#include "jsb_pluginx_umeng_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "AnalyticsUmeng.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_AnalyticsUmeng_class;
JSObject *jsb_AnalyticsUmeng_prototype;
JSBool js_pluginx_umeng_AnalyticsUmeng_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
long arg0;
ok &= jsval_to_long(cx, argv[0], (long *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setSessionContinueMillis(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_startSession(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = NULL;
cocos2d::plugin::AnalyticsUmeng* cobj = NULL;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
do {
if (argc == 3) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
cocos2d::plugin::AnalyticsUmeng::UmengReportPolicy arg1;
ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
if (!ok) { ok = JS_TRUE; break; }
const char* arg2;
std::string arg2_tmp; ok &= jsval_to_std_string(cx, argv[2], &arg2_tmp); arg2 = arg2_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
cobj->startSession(arg0, arg1, arg2);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
do {
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
cobj->startSession(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_stopSession(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
cobj->stopSession();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_updateOnlineConfig(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
cobj->updateOnlineConfig();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventBegin(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logTimedEventBegin(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logError(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 2) {
const char* arg0;
const char* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logError(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logEventWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = NULL;
cocos2d::plugin::AnalyticsUmeng* cobj = NULL;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
do {
if (argc == 2) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
long arg1;
ok &= jsval_to_long(cx, argv[1], (long *)&arg1);
if (!ok) { ok = JS_TRUE; break; }
cobj->logEventWithDuration(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
do {
if (argc == 3) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
long arg1;
ok &= jsval_to_long(cx, argv[1], (long *)&arg1);
if (!ok) { ok = JS_TRUE; break; }
LogEventParamMap* arg2;
LogEventParamMap arg2_tmp;
do {
ok &= jsval_to_LogEventParamMap(cx, argv[2], &arg2);
if (ok) { arg2_tmp = *arg2; delete arg2; arg2 = &arg2_tmp; } else { arg2 = NULL; }
} while(0);
if (!ok) { ok = JS_TRUE; break; }
cobj->logEventWithDuration(arg0, arg1, arg2);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
do {
if (argc == 3) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
long arg1;
ok &= jsval_to_long(cx, argv[1], (long *)&arg1);
if (!ok) { ok = JS_TRUE; break; }
const char* arg2;
std::string arg2_tmp; ok &= jsval_to_std_string(cx, argv[2], &arg2_tmp); arg2 = arg2_tmp.c_str();
if (!ok) { ok = JS_TRUE; break; }
cobj->logEventWithDuration(arg0, arg1, arg2);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
} while(0);
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_checkUpdate(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
cobj->checkUpdate();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_setDefaultReportPolicy(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
cocos2d::plugin::AnalyticsUmeng::UmengReportPolicy arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDefaultReportPolicy(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedKVEventEnd(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 2) {
const char* arg0;
const char* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logTimedKVEventEnd(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedKVEventBegin(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 3) {
const char* arg0;
const char* arg1;
LogEventParamMap* arg2;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
LogEventParamMap arg2_tmp;
do {
ok &= jsval_to_LogEventParamMap(cx, argv[2], &arg2);
if (ok) { arg2_tmp = *arg2; delete arg2; arg2 = &arg2_tmp; } else { arg2 = NULL; }
} while(0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logTimedKVEventBegin(arg0, arg1, arg2);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 3);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_setCaptureUncaughtException(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setCaptureUncaughtException(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_getConfigParams(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
const char* ret = cobj->getConfigParams(arg0);
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventWithLabelBegin(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 2) {
const char* arg0;
const char* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logTimedEventWithLabelBegin(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventWithLabelEnd(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 2) {
const char* arg0;
const char* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logTimedEventWithLabelEnd(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logEvent(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logEvent(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
if (argc == 2) {
const char* arg0;
LogEventParamMap* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
LogEventParamMap arg1_tmp;
do {
ok &= jsval_to_LogEventParamMap(cx, argv[1], &arg1);
if (ok) { arg1_tmp = *arg1; delete arg1; arg1 = &arg1_tmp; } else { arg1 = NULL; }
} while(0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logEvent(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventEnd(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logTimedEventEnd(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_logEventWithLabel(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 2) {
const char* arg0;
const char* arg1;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->logEventWithLabel(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_pluginx_umeng_AnalyticsUmeng_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::AnalyticsUmeng* cobj = (cocos2d::plugin::AnalyticsUmeng *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolAnalytics_prototype;
void js_pluginx_umeng_AnalyticsUmeng_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (AnalyticsUmeng)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::AnalyticsUmeng *nobj = static_cast<cocos2d::plugin::AnalyticsUmeng *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
void js_register_pluginx_umeng_AnalyticsUmeng(JSContext *cx, JSObject *global) {
jsb_AnalyticsUmeng_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_AnalyticsUmeng_class->name = "AnalyticsUmeng";
jsb_AnalyticsUmeng_class->addProperty = JS_PropertyStub;
jsb_AnalyticsUmeng_class->delProperty = JS_PropertyStub;
jsb_AnalyticsUmeng_class->getProperty = JS_PropertyStub;
jsb_AnalyticsUmeng_class->setProperty = JS_StrictPropertyStub;
jsb_AnalyticsUmeng_class->enumerate = JS_EnumerateStub;
jsb_AnalyticsUmeng_class->resolve = JS_ResolveStub;
jsb_AnalyticsUmeng_class->convert = JS_ConvertStub;
jsb_AnalyticsUmeng_class->finalize = js_pluginx_umeng_AnalyticsUmeng_finalize;
jsb_AnalyticsUmeng_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
static JSFunctionSpec funcs[] = {
JS_FN("setSessionContinueMillis", js_pluginx_umeng_AnalyticsUmeng_setSessionContinueMillis, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("startSession", js_pluginx_umeng_AnalyticsUmeng_startSession, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("stopSession", js_pluginx_umeng_AnalyticsUmeng_stopSession, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_umeng_AnalyticsUmeng_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("updateOnlineConfig", js_pluginx_umeng_AnalyticsUmeng_updateOnlineConfig, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedEventBegin", js_pluginx_umeng_AnalyticsUmeng_logTimedEventBegin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logError", js_pluginx_umeng_AnalyticsUmeng_logError, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logEventWithDuration", js_pluginx_umeng_AnalyticsUmeng_logEventWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("checkUpdate", js_pluginx_umeng_AnalyticsUmeng_checkUpdate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_umeng_AnalyticsUmeng_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDefaultReportPolicy", js_pluginx_umeng_AnalyticsUmeng_setDefaultReportPolicy, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_umeng_AnalyticsUmeng_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedKVEventEnd", js_pluginx_umeng_AnalyticsUmeng_logTimedKVEventEnd, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedKVEventBegin", js_pluginx_umeng_AnalyticsUmeng_logTimedKVEventBegin, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCaptureUncaughtException", js_pluginx_umeng_AnalyticsUmeng_setCaptureUncaughtException, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getConfigParams", js_pluginx_umeng_AnalyticsUmeng_getConfigParams, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginName", js_pluginx_umeng_AnalyticsUmeng_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedEventWithLabelBegin", js_pluginx_umeng_AnalyticsUmeng_logTimedEventWithLabelBegin, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedEventWithLabelEnd", js_pluginx_umeng_AnalyticsUmeng_logTimedEventWithLabelEnd, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logEvent", js_pluginx_umeng_AnalyticsUmeng_logEvent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logTimedEventEnd", js_pluginx_umeng_AnalyticsUmeng_logTimedEventEnd, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("logEventWithLabel", js_pluginx_umeng_AnalyticsUmeng_logEventWithLabel, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_umeng_AnalyticsUmeng_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_AnalyticsUmeng_prototype = JS_InitClass(
cx, global,
jsb_ProtocolAnalytics_prototype,
jsb_AnalyticsUmeng_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, "AnalyticsUmeng", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::AnalyticsUmeng> 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_AnalyticsUmeng_class;
p->proto = jsb_AnalyticsUmeng_prototype;
p->parentProto = jsb_ProtocolAnalytics_prototype;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
void register_all_pluginx_umeng(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_umeng_AnalyticsUmeng(cx, obj);
}

View File

@ -1,39 +0,0 @@
#ifndef __pluginx_umeng_h__
#define __pluginx_umeng_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_AnalyticsUmeng_class;
extern JSObject *jsb_AnalyticsUmeng_prototype;
JSBool js_pluginx_umeng_AnalyticsUmeng_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_umeng_AnalyticsUmeng_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_umeng_AnalyticsUmeng(JSContext *cx, JSObject *global);
void register_all_pluginx_umeng(JSContext* cx, JSObject* obj);
JSBool js_pluginx_umeng_AnalyticsUmeng_setSessionContinueMillis(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_startSession(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_stopSession(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_updateOnlineConfig(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventBegin(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logError(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logEventWithDuration(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_checkUpdate(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_setDefaultReportPolicy(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedKVEventEnd(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedKVEventBegin(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_setCaptureUncaughtException(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_getConfigParams(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventWithLabelBegin(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventWithLabelEnd(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logEvent(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logTimedEventEnd(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_logEventWithLabel(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_umeng_AnalyticsUmeng_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,143 +0,0 @@
/**
* @module pluginx_umeng
*/
var plugin = plugin || {};
/**
* @class AnalyticsUmeng
*/
plugin.AnalyticsUmeng = {
/**
* @method setSessionContinueMillis
* @param {long}
*/
setSessionContinueMillis : function () {},
/**
* @method stopSession
*/
stopSession : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method updateOnlineConfig
*/
updateOnlineConfig : function () {},
/**
* @method logTimedEventBegin
* @param {const char*}
*/
logTimedEventBegin : function () {},
/**
* @method logError
* @param {const char*}
* @param {const char*}
*/
logError : function () {},
/**
* @method checkUpdate
*/
checkUpdate : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method setDefaultReportPolicy
* @param {cocos2d::plugin::AnalyticsUmeng::UmengReportPolicy}
*/
setDefaultReportPolicy : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method logTimedKVEventEnd
* @param {const char*}
* @param {const char*}
*/
logTimedKVEventEnd : function () {},
/**
* @method logTimedKVEventBegin
* @param {const char*}
* @param {const char*}
* @param {LogEventParamMap*}
*/
logTimedKVEventBegin : function () {},
/**
* @method setCaptureUncaughtException
* @param {bool}
*/
setCaptureUncaughtException : function () {},
/**
* @method getConfigParams
* @return A value converted from C/C++ "const char*"
* @param {const char*}
*/
getConfigParams : function () {},
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method logTimedEventWithLabelBegin
* @param {const char*}
* @param {const char*}
*/
logTimedEventWithLabelBegin : function () {},
/**
* @method logTimedEventWithLabelEnd
* @param {const char*}
* @param {const char*}
*/
logTimedEventWithLabelEnd : function () {},
/**
* @method logEvent
* @param {const char*}
* @param {LogEventParamMap*}
*/
logEvent : function () {},
/**
* @method logTimedEventEnd
* @param {const char*}
*/
logTimedEventEnd : function () {},
/**
* @method logEventWithLabel
* @param {const char*}
* @param {const char*}
*/
logEventWithLabel : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -1,251 +0,0 @@
#include "jsb_pluginx_weibo_auto.hpp"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "jsb_pluginx_basic_conversions.h"
using namespace pluginx;
#include "SocialWeibo.h"
template<class T>
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
TypeTest<T> t;
T* cobj = new T();
js_type_class_t *p;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
assert(p);
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
js_proxy_t *pp;
JS_NEW_PROXY(pp, cobj, _tmp);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
return JS_TRUE;
}
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return JS_FALSE;
}
JSClass *jsb_SocialWeibo_class;
JSObject *jsb_SocialWeibo_prototype;
JSBool js_pluginx_weibo_SocialWeibo_getPluginName(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginName();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_weibo_SocialWeibo_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getPluginVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_weibo_SocialWeibo_share(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TShareInfo arg0;
ok &= jsval_to_TShareInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->share(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_weibo_SocialWeibo_init(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
bool ret = cobj->init();
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_weibo_SocialWeibo_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TSocialDeveloperInfo arg0;
ok &= jsval_to_TSocialDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_weibo_SocialWeibo_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 0) {
const char* ret = cobj->getSDKVersion();
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return JS_FALSE;
}
JSBool js_pluginx_weibo_SocialWeibo_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::SocialWeibo* cobj = (cocos2d::plugin::SocialWeibo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
JSBool arg0;
ok &= JS_ValueToBoolean(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->setDebugMode(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
extern JSObject *jsb_ProtocolSocial_prototype;
void js_pluginx_weibo_SocialWeibo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (SocialWeibo)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
// cocos2d::plugin::SocialWeibo *nobj = static_cast<cocos2d::plugin::SocialWeibo *>(nproxy->ptr);
// if (nobj)
// delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
void js_register_pluginx_weibo_SocialWeibo(JSContext *cx, JSObject *global) {
jsb_SocialWeibo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_SocialWeibo_class->name = "SocialWeibo";
jsb_SocialWeibo_class->addProperty = JS_PropertyStub;
jsb_SocialWeibo_class->delProperty = JS_PropertyStub;
jsb_SocialWeibo_class->getProperty = JS_PropertyStub;
jsb_SocialWeibo_class->setProperty = JS_StrictPropertyStub;
jsb_SocialWeibo_class->enumerate = JS_EnumerateStub;
jsb_SocialWeibo_class->resolve = JS_ResolveStub;
jsb_SocialWeibo_class->convert = JS_ConvertStub;
jsb_SocialWeibo_class->finalize = js_pluginx_weibo_SocialWeibo_finalize;
jsb_SocialWeibo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
JSPropertySpec *properties = NULL;
static JSFunctionSpec funcs[] = {
JS_FN("getPluginName", js_pluginx_weibo_SocialWeibo_getPluginName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPluginVersion", js_pluginx_weibo_SocialWeibo_getPluginVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("share", js_pluginx_weibo_SocialWeibo_share, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("init", js_pluginx_weibo_SocialWeibo_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("configDeveloperInfo", js_pluginx_weibo_SocialWeibo_configDeveloperInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSDKVersion", js_pluginx_weibo_SocialWeibo_getSDKVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setDebugMode", js_pluginx_weibo_SocialWeibo_setDebugMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_SocialWeibo_prototype = JS_InitClass(
cx, global,
jsb_ProtocolSocial_prototype,
jsb_SocialWeibo_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, "SocialWeibo", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::SocialWeibo> 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_SocialWeibo_class;
p->proto = jsb_SocialWeibo_prototype;
p->parentProto = jsb_ProtocolSocial_prototype;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
void register_all_pluginx_weibo(JSContext* cx, JSObject* obj) {
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, obj, "plugin", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "plugin", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
js_register_pluginx_weibo_SocialWeibo(cx, obj);
}

View File

@ -1,23 +0,0 @@
#ifndef __pluginx_weibo_h__
#define __pluginx_weibo_h__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_SocialWeibo_class;
extern JSObject *jsb_SocialWeibo_prototype;
JSBool js_pluginx_weibo_SocialWeibo_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_weibo_SocialWeibo_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_weibo_SocialWeibo(JSContext *cx, JSObject *global);
void register_all_pluginx_weibo(JSContext* cx, JSObject* obj);
JSBool js_pluginx_weibo_SocialWeibo_getPluginName(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_weibo_SocialWeibo_getPluginVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_weibo_SocialWeibo_share(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_weibo_SocialWeibo_init(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_weibo_SocialWeibo_configDeveloperInfo(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_weibo_SocialWeibo_getSDKVersion(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_weibo_SocialWeibo_setDebugMode(JSContext *cx, uint32_t argc, jsval *vp);
#endif

View File

@ -1,53 +0,0 @@
/**
* @module pluginx_weibo
*/
var plugin = plugin || {};
/**
* @class SocialWeibo
*/
plugin.SocialWeibo = {
/**
* @method getPluginName
* @return A value converted from C/C++ "const char*"
*/
getPluginName : function () {},
/**
* @method getPluginVersion
* @return A value converted from C/C++ "const char*"
*/
getPluginVersion : function () {},
/**
* @method share
* @param {TShareInfo}
*/
share : function () {},
/**
* @method init
* @return A value converted from C/C++ "bool"
*/
init : function () {},
/**
* @method configDeveloperInfo
* @param {TSocialDeveloperInfo}
*/
configDeveloperInfo : function () {},
/**
* @method getSDKVersion
* @return A value converted from C/C++ "const char*"
*/
getSDKVersion : function () {},
/**
* @method setDebugMode
* @param {bool}
*/
setDebugMode : function () {},
};

View File

@ -1 +1,30 @@
require('jsb_pluginx_analytics.js');
plugin = plugin || {};
plugin.PluginParam.ParamType = {};
plugin.PluginParam.ParamType.TypeInt = 1;
plugin.PluginParam.ParamType.TypeFloat = 2;
plugin.PluginParam.ParamType.TypeBool = 3;
plugin.PluginParam.ParamType.TypeString = 4;
plugin.PluginParam.ParamType.TypeStringMap = 5;
plugin.ProtocolAds.AdsResultCode = {};
plugin.ProtocolAds.AdsResultCode.AdsReceived = 0;
plugin.ProtocolAds.AdsResultCode.FullScreenViewShown = 1;
plugin.ProtocolAds.AdsResultCode.FullScreenViewDismissed = 2;
plugin.ProtocolAds.AdsResultCode.PointsSpendSucceed = 3;
plugin.ProtocolAds.AdsResultCode.PointsSpendFailed = 4;
plugin.ProtocolAds.AdsResultCode.NetworkError = 5;
plugin.ProtocolAds.AdsResultCode.UnknownError = 6;
plugin.ProtocolIAP.PayResultCode = {};
plugin.ProtocolIAP.PayResultCode.PaySuccess = 0;
plugin.ProtocolIAP.PayResultCode.PayFail = 1;
plugin.ProtocolIAP.PayResultCode.PayCancel = 2;
plugin.ProtocolIAP.PayResultCode.PayTimeOut = 3;
plugin.ProtocolSocial.ShareResultCode = {};
plugin.ProtocolSocial.ShareResultCode.ShareSuccess = 0;
plugin.ProtocolSocial.ShareResultCode.ShareFail = 1;
plugin.ProtocolSocial.ShareResultCode.ShareCancel = 2;
plugin.ProtocolSocial.ShareResultCode.ShareTimeOut = 3;

View File

@ -1,12 +0,0 @@
plugin = plugin || {};
plugin.AnalyticsFlurry.Gender = {};
plugin.AnalyticsFlurry.Gender.FEMALE = 0;
plugin.AnalyticsFlurry.Gender.MALE = 1;
plugin.AnalyticsUmeng.UmengReportPolicy = {};
plugin.AnalyticsUmeng.UmengReportPolicy.REALTIME = 0;
plugin.AnalyticsUmeng.UmengReportPolicy.BATCH_AT_LAUNCH = 1;
plugin.AnalyticsUmeng.UmengReportPolicy.DAILY= 4;
plugin.AnalyticsUmeng.UmengReportPolicy.WIFIONLY = 5;

View File

@ -236,6 +236,11 @@ JSBool jsval_to_LogEventParamMap(JSContext *cx, jsval v, LogEventParamMap** ret)
return jsret;
}
JSBool jsval_to_StringMap(JSContext *cx, jsval v, StringMap* ret)
{
return jsval_to_TProductInfo(cx, v, ret);
}
// From native type to jsval
jsval int32_to_jsval( JSContext *cx, int32_t number )
{

View File

@ -9,6 +9,10 @@
#include "ProtocolAds.h"
#include "ProtocolSocial.h"
#ifndef CCLOGINFO
#define CCLOGINFO(...)
#endif
using namespace cocos2d::plugin;
namespace pluginx {
@ -27,6 +31,7 @@ JSBool jsval_to_TSocialDeveloperInfo(JSContext *cx, jsval v, TSocialDeveloperInf
JSBool jsval_to_TShareInfo(JSContext *cx, jsval v, TShareInfo* ret);
JSBool jsval_to_TPaymentInfo(JSContext *cx, jsval v, std::map<std::string, std::string>* ret);
JSBool jsval_to_LogEventParamMap(JSContext *cx, jsval v, LogEventParamMap** ret);
JSBool jsval_to_StringMap(JSContext *cx, jsval v, StringMap* ret);
// from native
jsval int32_to_jsval( JSContext *cx, int32_t l);

View File

@ -1,5 +1,6 @@
#include "jsb_pluginx_extension_registration.h"
#include "jsb_pluginx_manual_iap.h"
#include "jsb_pluginx_manual_callback.h"
#include "jsb_pluginx_manual_protocols.h"
static jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string) {
jsval out;
@ -12,6 +13,7 @@ static jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string)
extern JSObject *jsb_ProtocolIAP_prototype;
extern JSObject *jsb_ProtocolAds_prototype;
extern JSObject *jsb_ProtocolSocial_prototype;
extern JSObject *jsb_PluginProtocol_prototype;
void register_pluginx_js_extensions(JSContext* cx, JSObject* global)
{
@ -30,4 +32,12 @@ void register_pluginx_js_extensions(JSContext* cx, JSObject* global)
JS_DefineFunction(cx, jsb_ProtocolIAP_prototype, "setResultListener", js_pluginx_ProtocolIAP_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_ProtocolAds_prototype, "setAdsListener", js_pluginx_ProtocolAds_setAdsListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_ProtocolSocial_prototype, "setResultListener", js_pluginx_ProtocolSocial_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callFuncWithParam", js_pluginx_PluginProtocol_callFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callStringFuncWithParam", js_pluginx_PluginProtocol_callStringFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callIntFuncWithParam", js_pluginx_PluginProtocol_callIntFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callFloatFuncWithParam", js_pluginx_PluginProtocol_callFloatFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_PluginProtocol_prototype, "callBoolFuncWithParam", js_pluginx_PluginProtocol_callBoolFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
global = ns;
js_register_pluginx_protocols_PluginParam(cx, global);
}

View File

@ -1,4 +1,4 @@
#include "jsb_pluginx_manual_iap.h"
#include "jsb_pluginx_manual_callback.h"
#include "jsb_pluginx_basic_conversions.h"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include "ProtocolAds.h"

View File

@ -1,5 +1,5 @@
#ifndef __JS_MANUAL_IAP_H__
#define __JS_MANUAL_IAP_H__
#ifndef __JS_MANUAL_CALLBACK_H__
#define __JS_MANUAL_CALLBACK_H__
#include "jsapi.h"
#include "jsfriendapi.h"
@ -8,4 +8,4 @@ JSBool js_pluginx_ProtocolIAP_setResultListener(JSContext *cx, uint32_t argc, js
JSBool js_pluginx_ProtocolAds_setAdsListener(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_ProtocolSocial_setResultListener(JSContext *cx, uint32_t argc, jsval *vp);
#endif /* __JS_MANUAL_IAP_H__ */
#endif /* __JS_MANUAL_CALLBACK_H__ */

View File

@ -0,0 +1,343 @@
#include "jsb_pluginx_manual_protocols.h"
#include "jsb_pluginx_basic_conversions.h"
#include "jsb_pluginx_spidermonkey_specifics.h"
#include <string>
#include <vector>
#include "PluginProtocol.h"
using namespace pluginx;
JSClass *jsb_PluginParam_class;
JSObject *jsb_PluginParam_prototype;
JSBool js_pluginx_protocols_PluginParam_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = NULL;
cocos2d::plugin::PluginParam* cobj = NULL;
do {
if (argc == 2) {
int arg0;
ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
if (!ok) { ok = JS_TRUE; break; }
switch (arg0)
{
case cocos2d::plugin::PluginParam::kParamTypeInt:
{
int arg1;
ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
if (ok) { cobj = new cocos2d::plugin::PluginParam(arg1); }
}
break;
case cocos2d::plugin::PluginParam::kParamTypeFloat:
{
double arg1;
ok &= JS_ValueToNumber(cx, argv[1], &arg1);
if (ok) {
float tempArg = arg1;
cobj = new cocos2d::plugin::PluginParam(tempArg);
}
}
break;
case cocos2d::plugin::PluginParam::kParamTypeBool:
{
JSBool arg1;
ok &= JS_ValueToBoolean(cx, argv[1], &arg1);
if (ok) { cobj = new cocos2d::plugin::PluginParam(arg1); }
}
break;
case cocos2d::plugin::PluginParam::kParamTypeString:
{
const char* arg1;
std::string arg1_tmp; ok &= jsval_to_std_string(cx, argv[1], &arg1_tmp); arg1 = arg1_tmp.c_str();
if (ok) { cobj = new cocos2d::plugin::PluginParam(arg1); }
}
break;
case cocos2d::plugin::PluginParam::kParamTypeStringMap:
{
StringMap arg1;
ok &= jsval_to_StringMap(cx, argv[1], &arg1);
if (ok) { cobj = new cocos2d::plugin::PluginParam(arg1); }
}
break;
default:
break;
}
if (!ok || NULL == cobj) { ok = JS_TRUE; break; }
TypeTest<cocos2d::plugin::PluginParam> t;
js_type_class_t *typeClass;
uint32_t typeId = t.s_id();
HASH_FIND_INT(_js_global_type_ht, &typeId, typeClass);
assert(typeClass);
obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
js_proxy_t *proxy;
JS_NEW_PROXY(proxy, cobj, obj);
}
} while (0);
if (cobj) {
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
void js_pluginx_protocols_PluginParam_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (PluginParam)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
JS_GET_NATIVE_PROXY(jsproxy, obj);
if (jsproxy) {
JS_GET_PROXY(nproxy, jsproxy->ptr);
cocos2d::plugin::PluginParam *nobj = static_cast<cocos2d::plugin::PluginParam *>(nproxy->ptr);
if (nobj)
delete nobj;
JS_REMOVE_PROXY(nproxy, jsproxy);
}
}
static JSBool js_pluginx_protocols_PluginParam_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
cocos2d::plugin::PluginParam *nobj = new cocos2d::plugin::PluginParam();
js_proxy_t* p;
JS_NEW_PROXY(p, nobj, obj);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
void js_register_pluginx_protocols_PluginParam(JSContext *cx, JSObject *global) {
jsb_PluginParam_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_PluginParam_class->name = "PluginParam";
jsb_PluginParam_class->addProperty = JS_PropertyStub;
jsb_PluginParam_class->delProperty = JS_PropertyStub;
jsb_PluginParam_class->getProperty = JS_PropertyStub;
jsb_PluginParam_class->setProperty = JS_StrictPropertyStub;
jsb_PluginParam_class->enumerate = JS_EnumerateStub;
jsb_PluginParam_class->resolve = JS_ResolveStub;
jsb_PluginParam_class->convert = JS_ConvertStub;
jsb_PluginParam_class->finalize = js_pluginx_protocols_PluginParam_finalize;
jsb_PluginParam_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
{0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
};
JSFunctionSpec *funcs = NULL;
JSFunctionSpec *st_funcs = NULL;
jsb_PluginParam_prototype = JS_InitClass(
cx, global,
NULL, // parent proto
jsb_PluginParam_class,
js_pluginx_protocols_PluginParam_constructor, 0, // constructor
properties,
funcs,
NULL, // no static properties
st_funcs);
// make the class enumerable in the registered namespace
JSBool found;
JS_SetPropertyAttributes(cx, global, "PluginParam", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::plugin::PluginParam> 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_PluginParam_class;
p->proto = jsb_PluginParam_prototype;
p->parentProto = NULL;
HASH_ADD_INT(_js_global_type_ht, type, p);
}
}
JSBool js_pluginx_PluginProtocol_callFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp)
{
JSBool ok = JS_TRUE;
jsval *argv = JS_ARGV(cx, vp);
if (argc > 0) {
std::string strName;
ok &= jsval_to_std_string(cx, argv[0], &strName);
std::vector<cocos2d::plugin::PluginParam*> params;
uint32_t i = 1;
while (i < argc) {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[i]);
if (tmpObj == NULL)
break;
JS_GET_NATIVE_PROXY(proxy, tmpObj);
cocos2d::plugin::PluginParam* item = (cocos2d::plugin::PluginParam*)(proxy ? proxy->ptr : NULL);
JS_TEST_NATIVE_OBJECT(cx, item)
params.push_back(item);
i++;
}
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
cobj->callFuncWithParam(strName.c_str(), params);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_PluginProtocol_callStringFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp)
{
JSBool ok = JS_TRUE;
jsval *argv = JS_ARGV(cx, vp);
if (argc > 0) {
std::string strName;
ok &= jsval_to_std_string(cx, argv[0], &strName);
std::vector<cocos2d::plugin::PluginParam*> params;
uint32_t i = 1;
while (i < argc) {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[i]);
if (tmpObj == NULL)
break;
JS_GET_NATIVE_PROXY(proxy, tmpObj);
cocos2d::plugin::PluginParam* item = (cocos2d::plugin::PluginParam*)(proxy ? proxy->ptr : NULL);
JS_TEST_NATIVE_OBJECT(cx, item)
params.push_back(item);
i++;
}
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
const char* ret = cobj->callStringFuncWithParam(strName.c_str(), params);
jsval jsret;
jsret = c_string_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_PluginProtocol_callIntFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp)
{
JSBool ok = JS_TRUE;
jsval *argv = JS_ARGV(cx, vp);
if (argc > 0) {
std::string strName;
ok &= jsval_to_std_string(cx, argv[0], &strName);
std::vector<cocos2d::plugin::PluginParam*> params;
uint32_t i = 1;
while (i < argc) {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[i]);
if (tmpObj == NULL)
break;
JS_GET_NATIVE_PROXY(proxy, tmpObj);
cocos2d::plugin::PluginParam* item = (cocos2d::plugin::PluginParam*)(proxy ? proxy->ptr : NULL);
JS_TEST_NATIVE_OBJECT(cx, item)
params.push_back(item);
i++;
}
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
int ret = cobj->callIntFuncWithParam(strName.c_str(), params);
jsval jsret;
jsret = int32_to_jsval(cx, ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_PluginProtocol_callFloatFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp)
{
JSBool ok = JS_TRUE;
jsval *argv = JS_ARGV(cx, vp);
if (argc > 0) {
std::string strName;
ok &= jsval_to_std_string(cx, argv[0], &strName);
std::vector<cocos2d::plugin::PluginParam*> params;
uint32_t i = 1;
while (i < argc) {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[i]);
if (tmpObj == NULL)
break;
JS_GET_NATIVE_PROXY(proxy, tmpObj);
cocos2d::plugin::PluginParam* item = (cocos2d::plugin::PluginParam*)(proxy ? proxy->ptr : NULL);
JS_TEST_NATIVE_OBJECT(cx, item)
params.push_back(item);
i++;
}
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
float ret = cobj->callFloatFuncWithParam(strName.c_str(), params);
jsval jsret;
jsret = DOUBLE_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}
JSBool js_pluginx_PluginProtocol_callBoolFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp)
{
JSBool ok = JS_TRUE;
jsval *argv = JS_ARGV(cx, vp);
if (argc > 0) {
std::string strName;
ok &= jsval_to_std_string(cx, argv[0], &strName);
std::vector<cocos2d::plugin::PluginParam*> params;
uint32_t i = 1;
while (i < argc) {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[i]);
if (tmpObj == NULL)
break;
JS_GET_NATIVE_PROXY(proxy, tmpObj);
cocos2d::plugin::PluginParam* item = (cocos2d::plugin::PluginParam*)(proxy ? proxy->ptr : NULL);
JS_TEST_NATIVE_OBJECT(cx, item)
params.push_back(item);
i++;
}
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::plugin::PluginProtocol* cobj = (cocos2d::plugin::PluginProtocol *)(proxy ? proxy->ptr : NULL);
bool ret = cobj->callBoolFuncWithParam(strName.c_str(), params);
jsval jsret;
jsret = BOOLEAN_TO_JSVAL(ret);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments");
return JS_FALSE;
}

View File

@ -0,0 +1,22 @@
#ifndef __JS_MANUAL_PROTOCOLS_H__
#define __JS_MANUAL_PROTOCOLS_H__
#include "jsapi.h"
#include "jsfriendapi.h"
extern JSClass *jsb_PluginParam_class;
extern JSObject *jsb_PluginParam_prototype;
JSBool js_pluginx_protocols_PluginParam_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void js_pluginx_protocols_PluginParam_finalize(JSContext *cx, JSObject *obj);
void js_register_pluginx_protocols_PluginParam(JSContext *cx, JSObject *global);
void register_all_pluginx_protocols(JSContext* cx, JSObject* obj);
JSBool js_pluginx_protocols_PluginParam_PluginParam(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_PluginProtocol_callFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_PluginProtocol_callStringFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_PluginProtocol_callIntFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_PluginProtocol_callFloatFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp);
JSBool js_pluginx_PluginProtocol_callBoolFuncWithParam(JSContext *cx, uint32_t argc, jsval *vp);
#endif /* __JS_MANUAL_PROTOCOLS_H__ */

View File

@ -100,26 +100,26 @@ public class AnalyticsUmeng implements InterfaceAnalytics{
@Override
public void logEvent(String eventId) {
LogD("logEvent(eventId) invoked!");
LogD("logEvent(" + eventId + ") invoked!");
MobclickAgent.onEvent(mContext, eventId);
}
@Override
public void logEvent(String eventId, Hashtable<String, String> paramMap) {
LogD("logEvent(eventId, paramMap) invoked!");
LogD("logEvent(" + eventId + "," + paramMap.toString() + ") invoked!");
HashMap<String, String> curParam = changeTableToMap(paramMap);
MobclickAgent.onEvent(mContext, eventId, curParam);
}
@Override
public void logTimedEventBegin(String eventId) {
LogD("logTimedEventBegin invoked!");
LogD("logTimedEventBegin(" + eventId + ") invoked!");
MobclickAgent.onEventBegin(mContext, eventId);
}
@Override
public void logTimedEventEnd(String eventId) {
LogD("logTimedEventEnd invoked!");
LogD("logTimedEventEnd(" + eventId + ") invoked!");
MobclickAgent.onEventEnd(mContext, eventId);
}

View File

@ -26,6 +26,11 @@ THE SOFTWARE.
namespace cocos2d { namespace plugin {
PluginParam::PluginParam()
{
m_type = kParamTypeNull;
}
PluginParam::PluginParam(int nValue)
: m_nValue(nValue)
{
@ -56,7 +61,7 @@ PluginParam::PluginParam(std::map<std::string, PluginParam*> mapValue)
m_type = kParamTypeMap;
}
PluginParam::PluginParam(std::map<std::string, std::string> strMapValue)
PluginParam::PluginParam(StringMap strMapValue)
: m_strMapValue(strMapValue)
{
m_type = kParamTypeStringMap;

View File

@ -27,17 +27,20 @@ THE SOFTWARE.
#include <map>
#include <string>
typedef std::map<std::string, std::string> StringMap;
namespace cocos2d { namespace plugin {
class PluginProtocol;
class PluginParam
{
public:
PluginParam();
PluginParam(int nValue);
PluginParam(float fValue);
PluginParam(bool bValue);
PluginParam(const char* strValue);
PluginParam(std::map<std::string, PluginParam*> mapValue);
PluginParam(std::map<std::string, std::string> strMapValue);
PluginParam(StringMap strMapValue);
typedef enum{
kParamTypeNull = 0,
@ -45,8 +48,8 @@ public:
kParamTypeFloat,
kParamTypeBool,
kParamTypeString,
kParamTypeStringMap,
kParamTypeMap,
kParamTypeStringMap,
} ParamType;
inline ParamType getCurrentType() {
@ -73,12 +76,13 @@ public:
return m_mapValue;
}
inline std::map<std::string, std::string> getStrMapValue() {
inline StringMap getStrMapValue() {
return m_strMapValue;
}
private:
PluginParam();
friend class PluginProtocol;
PluginParam(std::map<std::string, PluginParam*> mapValue);
private:
ParamType m_type;
@ -88,7 +92,7 @@ private:
bool m_bValue;
std::string m_strValue;
std::map<std::string, PluginParam*> m_mapValue;
std::map<std::string, std::string> m_strMapValue;
StringMap m_strMapValue;
};
}} //namespace cocos2d { namespace plugin {

View File

@ -25,6 +25,7 @@ THE SOFTWARE.
#define __CCX_IPLUGIN_H__
#include "PluginParam.h"
#include <vector>
namespace cocos2d { namespace plugin {
@ -40,7 +41,7 @@ public:
/**
@brief plug-in info methods(name, version, SDK version)
*/
inline const char* getPluginName() { return m_pPluginName; }
inline const char* getPluginName() { return m_pPluginName.c_str(); }
const char* getPluginVersion();
const char* getSDKVersion();
@ -53,10 +54,19 @@ public:
* @brief methods for reflections
*/
void callFuncWithParam(const char* funcName, PluginParam* param, ...);
void callFuncWithParam(const char* funcName, std::vector<PluginParam*> params);
const char* callStringFuncWithParam(const char* funcName, PluginParam* param, ...);
const char* callStringFuncWithParam(const char* funcName, std::vector<PluginParam*> params);
int callIntFuncWithParam(const char* funcName, PluginParam* param, ...);
int callIntFuncWithParam(const char* funcName, std::vector<PluginParam*> params);
bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...);
bool callBoolFuncWithParam(const char* funcName, std::vector<PluginParam*> params);
float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...);
float callFloatFuncWithParam(const char* funcName, std::vector<PluginParam*> params);
protected:
PluginProtocol() {}
@ -66,7 +76,7 @@ private:
inline void setPluginName(const char* name) {
m_pPluginName = name;
}
const char* m_pPluginName;
std::string m_pPluginName;
};
}} //namespace cocos2d { namespace plugin {

View File

@ -84,9 +84,6 @@ public:
*/
void onShareResult(ShareResultCode ret, const char* msg);
const char* getPluginVersion() { return "ProtocolSocial, v0.1.0, subclass should override this interface!"; };
const char* getSDKVersion();
protected:
ShareResultListener* m_pListener;
};

View File

@ -38,7 +38,8 @@ classes = PluginProtocol PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds
skip = ProtocolIAP::[setResultListener],
ProtocolAds::[setAdsListener],
ProtocolSocial::[setResultListener]
ProtocolSocial::[setResultListener],
PluginProtocol::[callFuncWithParam callStringFuncWithParam callIntFuncWithParam callBoolFuncWithParam callFloatFuncWithParam]
rename_functions =

View File

@ -106,6 +106,8 @@ extern "C"
}
jclass classID = getClassID_(className, pEnv);
if(pEnv->ExceptionCheck()) pEnv->ExceptionClear();
methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
if (! methodID)
{
@ -141,6 +143,7 @@ extern "C"
jclass classID = getClassID_(className, pEnv);
if(pEnv->ExceptionCheck()) pEnv->ExceptionClear();
methodID = pEnv->GetMethodID(classID, methodName, paramCode);
if (! methodID)
{

View File

@ -32,7 +32,7 @@ retType ret = defaultRet; \
return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \
return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); \
PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \
return_val_if_fails(pData != NULL, ret); \
return_val_if_fails(pData != NULL, ret); \
\
PluginJniMethodInfo t; \
if (PluginJniHelper::getMethodInfo(t \
@ -51,6 +51,28 @@ if (PluginJniHelper::getMethodInfo(t \
return ret; \
#define CALL_JAVA_FUNC_WITH_VALIST(retCode) \
std::vector<PluginParam*> allParams; \
if (NULL != param) \
{ \
allParams.push_back(param); \
\
va_list argp; \
PluginParam* pArg = NULL; \
va_start( argp, param ); \
while (1) \
{ \
pArg = va_arg(argp, PluginParam*); \
if (pArg == NULL) \
break; \
\
allParams.push_back(pArg); \
} \
va_end(argp); \
} \
\
return call##retCode##FuncWithParam(funcName, allParams); \
#define CALL_JAVA_FUNC(retType, retCode, defaultRet, jRetCode) \
retType ret = defaultRet; \
@ -61,44 +83,37 @@ if (NULL == pData) {
} \
\
std::string paramCode; \
if (NULL == param) \
int nParamNum = params.size(); \
if (0 == nParamNum) \
{ \
paramCode = "()"; \
paramCode.append(jRetCode); \
paramCode.append(jRetCode); \
ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), NULL); \
} else \
{ \
PluginParam* pRetParam = NULL; \
std::map<std::string, PluginParam*> allParams; \
va_list argp; \
int argno = 0; \
PluginParam* pArg = NULL; \
\
allParams["Param1"] = param; \
va_start( argp, param ); \
while (1) \
{ \
pArg = va_arg(argp, PluginParam*); \
if (pArg == NULL) \
bool needDel = false; \
if (nParamNum == 1) { \
pRetParam = params[0]; \
} else { \
std::map<std::string, PluginParam*> allParams; \
for (int i = 0; i < nParamNum; i++) \
{ \
break; \
} \
argno++; \
char strKey[8] = { 0 }; \
sprintf(strKey, "Param%d", argno + 1); \
allParams[strKey] = pArg; \
} \
va_end(argp); \
PluginParam* pArg = params[i]; \
if (pArg == NULL) \
{ \
break; \
} \
\
PluginParam tempParam(allParams); \
if (argno == 0) \
{ \
pRetParam = param; \
} \
else \
{ \
pRetParam = &tempParam; \
char strKey[8] = { 0 }; \
sprintf(strKey, "Param%d", i + 1); \
allParams[strKey] = pArg; \
} \
\
pRetParam = new PluginParam(allParams); \
needDel = true; \
} \
\
switch(pRetParam->getCurrentType()) \
{ \
case PluginParam::kParamTypeInt: \
@ -137,6 +152,12 @@ if (NULL == param)
break; \
default: \
break; \
} \
\
if (needDel && pRetParam != NULL) \
{ \
delete pRetParam; \
pRetParam = NULL; \
} \
} \
return ret; \

View File

@ -73,6 +73,30 @@ void PluginProtocol::setDebugMode(bool isDebugMode)
}
void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param, ...)
{
std::vector<PluginParam*> allParams;
if (NULL != param)
{
allParams.push_back(param);
va_list argp;
PluginParam* pArg = NULL;
va_start( argp, param );
while (1)
{
pArg = va_arg(argp, PluginParam*);
if (pArg == NULL)
break;
allParams.push_back(pArg);
}
va_end(argp);
}
callFuncWithParam(funcName, allParams);
}
void PluginProtocol::callFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
if (NULL == pData) {
@ -80,41 +104,33 @@ void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param,
return;
}
if (NULL == param)
int nParamNum = params.size();
if (nParamNum == 0)
{
PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "()V", NULL);
} else
{
PluginParam* pRetParam = NULL;
std::map<std::string, PluginParam*> allParams;
va_list argp;
int argno = 0;
PluginParam* pArg = NULL;
allParams["Param1"] = param;
va_start( argp, param );
while (1)
{
pArg = va_arg(argp, PluginParam*);
if (pArg == NULL)
bool needDel = false;
if (nParamNum == 1) {
pRetParam = params[0];
} else {
std::map<std::string, PluginParam*> allParams;
for (int i = 0; i < nParamNum; i++)
{
break;
}
argno++;
char strKey[8] = { 0 };
sprintf(strKey, "Param%d", argno + 1);
allParams[strKey] = pArg;
}
va_end(argp);
PluginParam* pArg = params[i];
if (pArg == NULL)
{
break;
}
PluginParam tempParam(allParams);
if (argno == 0)
{
pRetParam = param;
}
else
{
pRetParam = &tempParam;
char strKey[8] = { 0 };
sprintf(strKey, "Param%d", i + 1);
allParams[strKey] = pArg;
}
pRetParam = new PluginParam(allParams);
needDel = true;
}
switch(pRetParam->getCurrentType())
@ -146,25 +162,51 @@ void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param,
default:
break;
}
if (needDel && pRetParam != NULL)
{
delete pRetParam;
pRetParam = NULL;
}
}
}
const char* PluginProtocol::callStringFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_JAVA_FUNC_WITH_VALIST(String)
}
const char* PluginProtocol::callStringFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_JAVA_FUNC(const char*, String, "", "Ljava/lang/String;")
}
int PluginProtocol::callIntFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_JAVA_FUNC_WITH_VALIST(Int)
}
int PluginProtocol::callIntFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_JAVA_FUNC(int, Int, 0, "I")
}
bool PluginProtocol::callBoolFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_JAVA_FUNC_WITH_VALIST(Bool)
}
bool PluginProtocol::callBoolFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_JAVA_FUNC(bool, Bool, false, "Z")
}
float PluginProtocol::callFloatFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_JAVA_FUNC_WITH_VALIST(Float)
}
float PluginProtocol::callFloatFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_JAVA_FUNC(float, Float, 0.0f, "F")
}

View File

@ -26,13 +26,13 @@ THE SOFTWARE.
#include "PluginJniHelper.h"
#include "PluginJavaData.h"
#include "PluginProtocol.h"
#include <map>
#include "PluginParam.h"
#include "PluginJniMacros.h"
namespace cocos2d { namespace plugin {
class PluginProtocol;
class PluginUtils
{
public:

View File

@ -27,6 +27,28 @@ THE SOFTWARE.
#define return_if_fails(cond) if (!(cond)) return;
#define return_val_if_fails(cond, ret) if(!(cond)) return (ret);
#define CALL_OC_FUNC_WITH_VALIST(retCode) \
std::vector<PluginParam*> allParams; \
if (NULL != param) \
{ \
allParams.push_back(param); \
\
va_list argp; \
PluginParam* pArg = NULL; \
va_start( argp, param ); \
while (1) \
{ \
pArg = va_arg(argp, PluginParam*); \
if (pArg == NULL) \
break; \
\
allParams.push_back(pArg); \
} \
va_end(argp); \
} \
\
return call##retCode##FuncWithParam(funcName, allParams); \
#define CALL_OC_FUNC(retType, defaultRet, retCode) \
retType ret = defaultRet; \
@ -36,45 +58,42 @@ if (NULL == pData) {
return ret; \
} \
\
if (NULL == param) \
int nParamNum = params.size(); \
if (0 == nParamNum) \
{ \
ret = PluginUtilsIOS::callOC##retCode##FunctionWithName_oneParam(this, funcName, NULL); \
} else \
{ \
PluginParam* pRetParam = NULL; \
std::map<std::string, PluginParam*> allParams; \
va_list argp; \
int argno = 0; \
PluginParam* pArg = NULL; \
\
allParams["Param1"] = param; \
va_start( argp, param ); \
while (1) \
{ \
pArg = va_arg(argp, PluginParam*); \
if (pArg == NULL) \
bool needDel = false; \
if (nParamNum == 1) { \
pRetParam = params[0]; \
} else { \
std::map<std::string, PluginParam*> allParams; \
for (int i = 0; i < nParamNum; i++) \
{ \
break; \
} \
argno++; \
char strKey[8] = { 0 }; \
sprintf(strKey, "Param%d", argno + 1); \
allParams[strKey] = pArg; \
} \
va_end(argp); \
PluginParam* pArg = params[i]; \
if (pArg == NULL) \
{ \
break; \
} \
\
PluginParam tempParam(allParams); \
if (argno == 0) \
{ \
pRetParam = param; \
} \
else \
{ \
pRetParam = &tempParam; \
char strKey[8] = { 0 }; \
sprintf(strKey, "Param%d", i + 1); \
allParams[strKey] = pArg; \
} \
\
pRetParam = new PluginParam(allParams); \
needDel = true; \
} \
\
id ocParam = PluginUtilsIOS::getOCObjFromParam(pRetParam); \
ret = PluginUtilsIOS::callOC##retCode##FunctionWithName_oneParam(this, funcName, ocParam); \
\
if (needDel && NULL != pRetParam) { \
delete pRetParam; \
pRetParam = NULL; \
} \
} \
return ret; \

View File

@ -83,6 +83,30 @@ void PluginProtocol::setDebugMode(bool isDebugMode)
}
void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param, ...)
{
std::vector<PluginParam*> allParams;
if (NULL != param)
{
allParams.push_back(param);
va_list argp;
PluginParam* pArg = NULL;
va_start( argp, param );
while (1)
{
pArg = va_arg(argp, PluginParam*);
if (pArg == NULL)
break;
allParams.push_back(pArg);
}
va_end(argp);
}
callFuncWithParam(funcName, allParams);
}
void PluginProtocol::callFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this);
if (NULL == pData) {
@ -90,64 +114,81 @@ void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param,
return;
}
if (NULL == param)
int nParamNum = params.size();
if (0 == nParamNum)
{
PluginUtilsIOS::callOCFunctionWithName_oneParam(this, funcName, NULL);
} else
{
PluginParam* pRetParam = NULL;
std::map<std::string, PluginParam*> allParams;
va_list argp;
int argno = 0;
PluginParam* pArg = NULL;
allParams["Param1"] = param;
va_start( argp, param );
while (1)
{
pArg = va_arg(argp, PluginParam*);
if (pArg == NULL)
bool needDel = false;
if (nParamNum == 1) {
pRetParam = params[0];
} else {
std::map<std::string, PluginParam*> allParams;
for (int i = 0; i < nParamNum; i++)
{
break;
PluginParam* pArg = params[i];
if (pArg == NULL)
{
break;
}
char strKey[8] = { 0 };
sprintf(strKey, "Param%d", i + 1);
allParams[strKey] = pArg;
}
argno++;
char strKey[8] = { 0 };
sprintf(strKey, "Param%d", argno + 1);
allParams[strKey] = pArg;
}
va_end(argp);
PluginParam tempParam(allParams);
if (argno == 0)
{
pRetParam = param;
}
else
{
pRetParam = &tempParam;
pRetParam = new PluginParam(allParams);
needDel = true;
}
id ocParam = PluginUtilsIOS::getOCObjFromParam(pRetParam);
PluginUtilsIOS::callOCFunctionWithName_oneParam(this, funcName, ocParam);
if (needDel && NULL != pRetParam) {
delete pRetParam;
pRetParam = NULL;
}
}
}
const char* PluginProtocol::callStringFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_OC_FUNC_WITH_VALIST(String)
}
const char* PluginProtocol::callStringFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_OC_FUNC(const char*, "", String)
}
int PluginProtocol::callIntFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_OC_FUNC_WITH_VALIST(Int)
}
int PluginProtocol::callIntFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_OC_FUNC(int, 0, Int)
}
bool PluginProtocol::callBoolFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_OC_FUNC_WITH_VALIST(Bool)
}
bool PluginProtocol::callBoolFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_OC_FUNC(bool, false, Bool)
}
float PluginProtocol::callFloatFuncWithParam(const char* funcName, PluginParam* param, ...)
{
CALL_OC_FUNC_WITH_VALIST(Float)
}
float PluginProtocol::callFloatFuncWithParam(const char* funcName, std::vector<PluginParam*> params)
{
CALL_OC_FUNC(float, 0.0f, Float)
}

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
namespace cocos2d { namespace plugin {
void PluginUtilsIOS::initOCPlugin(PluginProtocol* pPlugin, id ocObj, const char* className)
void PluginUtilsIOS::initOCPlugin(PluginProtocol* pPlugin, id ocObj, const char* className)
{
PluginOCData* pData = new PluginOCData();
pData->obj = ocObj;

View File

@ -12,8 +12,6 @@
#include "jsb_opengl_registration.h"
#include "jsb_pluginx_protocols_auto.hpp"
#include "jsb_pluginx_flurry_auto.hpp"
#include "jsb_pluginx_umeng_auto.hpp"
#include "jsb_pluginx_extension_registration.h"
USING_NS_CC;
@ -49,8 +47,6 @@ bool AppDelegate::applicationDidFinishLaunching()
sc->addRegisterCallback(JSB_register_opengl);
sc->addRegisterCallback(register_all_pluginx_protocols);
sc->addRegisterCallback(register_all_pluginx_umeng);
sc->addRegisterCallback(register_all_pluginx_flurry);
sc->addRegisterCallback(register_pluginx_js_extensions);
sc->start();
CCLOG("applicationDidFinishLaunching 02");

View File

@ -57,12 +57,12 @@ var loadAnalyticsPlugin = function() {
var flurryKey = "";
var targetDevice = cc.Application.getInstance().getTargetPlatform();
if (targetDevice == cc.kTargetIphone || targetDevice == cc.kTargetIpad)
if (targetDevice == 1)
{
umengKey = UMENG_KEY_IOS;
flurryKey = FLURRY_KEY_IOS;
}
else if (targetDevice == cc.kTargetAndroid)
else if (targetDevice == 2)
{
umengKey = UMENG_KEY_ANDROID;
flurryKey = FLURRY_KEY_ANDROID;
@ -84,23 +84,15 @@ var loadAnalyticsPlugin = function() {
g_pAnalytics.startSession(s_strAppKey);
g_pAnalytics.setCaptureUncaughtException(true);
if (g_pAnalytics instanceof plugin.AnalyticsUmeng)
{
g_pAnalytics.updateOnlineConfig();
g_pAnalytics.setDefaultReportPolicy(plugin.AnalyticsUmeng.UmengReportPolicy.REALTIME);
}
g_pAnalytics.callFuncWithParam("updateOnlineConfig", null);
if (g_pAnalytics instanceof plugin.AnalyticsFlurry)
{
g_pAnalytics.setReportLocation(true);
g_pAnalytics.logPageView();
// const char* sdkVersion = pFlurry.getSDKVersion();
g_pAnalytics.setVersionName("1.1");
g_pAnalytics.setAge(20);
g_pAnalytics.setGender(plugin.AnalyticsFlurry.Gender.MALE);
g_pAnalytics.setUserId("123456");
g_pAnalytics.setUseHttps(false);
}
g_pAnalytics.callFuncWithParam("setReportLocation", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeBool, true));
g_pAnalytics.callFuncWithParam("logPageView", null);
g_pAnalytics.callFuncWithParam("setVersionName", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "1.1"));
g_pAnalytics.callFuncWithParam("setAge", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 20));
g_pAnalytics.callFuncWithParam("setGender", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 1));
g_pAnalytics.callFuncWithParam("setUserId", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "123456"));
g_pAnalytics.callFuncWithParam("setUseHttps", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeBool, false));
}
@ -181,9 +173,6 @@ var HelloWorld = cc.Layer.extend({
},
eventMenuCallback: function(pSender) {
var isUmeng = g_pAnalytics instanceof plugin.AnalyticsUmeng;
var isFlurry = g_pAnalytics instanceof plugin.AnalyticsFlurry;
switch (pSender.getTag())
{
case TAG_LOG_EVENT_ID:
@ -202,31 +191,25 @@ var HelloWorld = cc.Layer.extend({
break;
case TAG_LOG_ONLINE_CONFIG:
{
if (isUmeng)
{
cc.log("Online config = %s", g_pAnalytics.getConfigParams("abc"));
}
else
{
cc.log("Now is not using umeng!");
}
cc.log("Online config = " + g_pAnalytics.callStringFuncWithParam("getConfigParams", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "abc")));
}
break;
case TAG_LOG_EVENT_ID_DURATION:
{
if (isUmeng)
{
g_pAnalytics.logEventWithDuration("book", 12000);
g_pAnalytics.logEventWithDuration("book", 23000, "chapter1");
var paramMap = {};
paramMap["type"] = "popular";
paramMap["artist"] = "JJLin";
g_pAnalytics.logEventWithDuration("music", 2330000, paramMap);
}
else
{
cc.log("Now is not using umeng!");
}
g_pAnalytics.callFuncWithParam("logEventWithDuration",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "book"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 12000));
g_pAnalytics.callFuncWithParam("logEventWithDurationLabel",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "book"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 23000),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "chapter1"));
var paramMap = {};
paramMap["type"] = "popular";
paramMap["artist"] = "JJLin";
g_pAnalytics.callFuncWithParam("logEventWithDurationParams",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 2330000),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeStringMap, paramMap));
}
break;
case TAG_LOG_EVENT_BEGIN:
@ -237,29 +220,31 @@ var HelloWorld = cc.Layer.extend({
paramMap["type"] = "popular";
paramMap["artist"] = "JJLin";
if (isUmeng)
{
g_pAnalytics.logTimedEventWithLabelBegin("music", "one");
g_pAnalytics.logTimedKVEventBegin("music", "flag0", paramMap);
}
else if (isFlurry)
{
g_pAnalytics.logTimedEventBegin("music-kv", paramMap);
}
g_pAnalytics.callFuncWithParam("logTimedEventWithLabelBegin",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "one"));
g_pAnalytics.callFuncWithParam("logTimedKVEventBegin",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "flag0"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeStringMap, paramMap));
g_pAnalytics.callFuncWithParam("logTimedEventBeginWithParams",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music-kv"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeStringMap, paramMap));
}
break;
case TAG_LOG_EVENT_END:
{
g_pAnalytics.logTimedEventEnd("music");
if (isUmeng)
{
g_pAnalytics.logTimedEventWithLabelEnd("music", "one");
g_pAnalytics.logTimedKVEventEnd("music", "flag0");
}
else if (isFlurry)
{
g_pAnalytics.logTimedEventEnd("music-kv");
}
g_pAnalytics.callFuncWithParam("logTimedEventWithLabelEnd",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "one"));
g_pAnalytics.callFuncWithParam("logTimedKVEventEnd",
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"),
new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "flag0"));
g_pAnalytics.callFuncWithParam("logTimedEventEnd", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music-kv"));
}
break;
case TAG_MAKE_ME_CRASH:
@ -293,3 +278,4 @@ var MyScene = cc.Scene.extend({
this.addChild(layer);
}
});

View File

@ -8,12 +8,11 @@ LOCAL_MODULE_FILENAME := libgame
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../../../jsbindings/auto/jsb_pluginx_umeng_auto.cpp \
../../../../jsbindings/auto/jsb_pluginx_flurry_auto.cpp \
../../../../jsbindings/auto/jsb_pluginx_protocols_auto.cpp \
../../../../jsbindings/manual/pluginxUTF8.cpp \
../../../../jsbindings/manual/jsb_pluginx_basic_conversions.cpp \
../../../../jsbindings/manual/jsb_pluginx_manual_iap.cpp \
../../../../jsbindings/manual/jsb_pluginx_manual_protocols.cpp \
../../../../jsbindings/manual/jsb_pluginx_manual_callback.cpp \
../../../../jsbindings/manual/jsb_pluginx_extension_registration.cpp \
../../../../jsbindings/manual/jsb_pluginx_spidermonkey_specifics.cpp
@ -23,7 +22,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../../jsbindings/manual
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \
PluginFlurryStatic PluginUmengStatic PluginProtocolStatic
PluginProtocolStatic
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
@ -37,6 +36,4 @@ $(call import-module,CocosDenshion/android)
$(call import-module,external/chipmunk)
$(call import-module,scripting/javascript/spidermonkey-android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,plugins/flurry/android)
$(call import-module,plugins/umeng/android)
$(call import-module,protocols/android)

View File

@ -12,8 +12,6 @@
#include "jsb_opengl_registration.h"
#include "jsb_pluginx_protocols_auto.hpp"
#include "jsb_pluginx_alipay_auto.hpp"
#include "jsb_pluginx_nd91_auto.hpp"
#include "jsb_pluginx_extension_registration.h"
USING_NS_CC;
@ -50,8 +48,6 @@ bool AppDelegate::applicationDidFinishLaunching()
sc->addRegisterCallback(JSB_register_opengl);
sc->addRegisterCallback(register_all_pluginx_protocols);
sc->addRegisterCallback(register_all_pluginx_alipay);
sc->addRegisterCallback(register_all_pluginx_nd91);
sc->addRegisterCallback(register_pluginx_js_extensions);
sc->start();

View File

@ -8,14 +8,13 @@ LOCAL_MODULE_FILENAME := libgame
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../../../jsbindings/auto/jsb_pluginx_alipay_auto.cpp \
../../../../jsbindings/auto/jsb_pluginx_nd91_auto.cpp \
../../../../jsbindings/auto/jsb_pluginx_protocols_auto.cpp \
../../../../jsbindings/manual/pluginxUTF8.cpp \
../../../../jsbindings/manual/jsb_pluginx_basic_conversions.cpp \
../../../../jsbindings/manual/jsb_pluginx_manual_iap.cpp \
../../../../jsbindings/manual/jsb_pluginx_manual_protocols.cpp \
../../../../jsbindings/manual/jsb_pluginx_manual_callback.cpp \
../../../../jsbindings/manual/jsb_pluginx_extension_registration.cpp \
../../../../jsbindings/manual/jsb_pluginx_spidermonkey_specifics.cpp
../../../../jsbindings/manual/jsb_pluginx_spidermonkey_specifics.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../../jsbindings \
@ -23,8 +22,6 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../../jsbindings/manual
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \
PluginAlipayStatic \
PluginNd91Static \
PluginProtocolStatic
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
@ -34,11 +31,9 @@ LOCAL_WHOLE_STATIC_LIBRARIES += scriptingcore-spidermonkey
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx) \
$(call import-module,cocos2dx)
$(call import-module,CocosDenshion/android)
$(call import-module,external/chipmunk)
$(call import-module,scripting/javascript/spidermonkey-android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,plugins/alipay/android) \
$(call import-module,plugins/nd91/android) \
$(call import-module,protocols/android)

View File

@ -1,7 +1,5 @@
#!/bin/bash
PLUGIN_NAME=("alipay" "flurry" "nd91" "umeng" "admob" "twitter" "weibo")
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
PLUGIN_ROOT="$DIR/../.."
@ -31,11 +29,4 @@ check_return_value()
./genbindings.sh "protocols"
check_return_value "protocols"
for i in "${PLUGIN_NAME[@]}"
do
echo $i
./genbindings.sh $i "plugins/"
check_return_value $i
done
echo "--- Generating all jsbindings glue codes for pluginx succeed. :) --- "