axmol/plugin/jsbindings/auto/jsb_pluginx_umeng_auto.cpp

675 lines
26 KiB
C++
Raw Normal View History

2013-04-07 16:58:26 +08:00
#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);
2013-04-07 16:58:26 +08:00
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),
2013-04-24 09:43:40 +08:00
JS_FS_END
2013-04-07 16:58:26 +08:00
};
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);
}