Index: jni/JniJsValue.cpp |
diff --git a/jni/JniJsValue.cpp b/jni/JniJsValue.cpp |
index 0e2eca1ee5af53de6fdfbcc88e76f674b469563e..89876fc18f090fcb7c6ab07a7cc96e3792e10a1a 100644 |
--- a/jni/JniJsValue.cpp |
+++ b/jni/JniJsValue.cpp |
@@ -19,31 +19,31 @@ |
#include "Utils.h" |
#include "JniJsValue.h" |
-jobject AdblockPlus::Android::NewJniJsValue(JNIEnv* env, const AdblockPlus::JsValuePtr& jsValue) |
+jobject NewJniJsValue(JNIEnv* env, const AdblockPlus::JsValuePtr& jsValue) |
{ |
jclass clazz = env->FindClass(PKG("JsValue")); |
jmethodID ctor = env->GetMethodID(clazz, "<init>", "(J)V"); |
- jlong ptr = AdblockPlus::Android::JniPtr2Long(new AdblockPlus::JsValuePtr(jsValue)); |
+ jlong ptr = JniPtrToLong(new AdblockPlus::JsValuePtr(jsValue)); |
return env->NewObject(clazz, ctor, ptr); |
} |
-AdblockPlus::JsValue* AdblockPlus::Android::JniGetJsValue(jlong ptr) |
+AdblockPlus::JsValue* JniGetJsValue(jlong ptr) |
{ |
- return AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::JsValuePtr>(ptr)->get(); |
+ return JniLongToTypePtr<AdblockPlus::JsValuePtr>(ptr)->get(); |
} |
-AdblockPlus::JsValuePtr& AdblockPlus::Android::JniGetJsValuePtr(jlong ptr) |
+AdblockPlus::JsValuePtr& JniGetJsValuePtr(jlong ptr) |
{ |
- return *AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::JsValuePtr>(ptr); |
+ return *JniLongToTypePtr<AdblockPlus::JsValuePtr>(ptr); |
} |
-jobject AdblockPlus::Android::JniJsValueList2ArrayList(JNIEnv* env, AdblockPlus::JsValueList& list) |
+jobject JniJsValueList2ArrayList(JNIEnv* env, AdblockPlus::JsValueList& list) |
{ |
- jobject arrayList = AdblockPlus::Android::NewJniArrayList(env); |
+ jobject arrayList = NewJniArrayList(env); |
for (AdblockPlus::JsValueList::iterator it = list.begin(), end = list.end(); it != end; ++it) |
{ |
- AdblockPlus::Android::JniAddObjectToList(env, arrayList, AdblockPlus::Android::NewJniJsValue(env, *it)); |
+ JniAddObjectToList(env, arrayList, NewJniJsValue(env, *it)); |
} |
return arrayList; |
@@ -53,7 +53,7 @@ static jboolean JNICALL JniIsUndefined(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsUndefined() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsUndefined() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -62,7 +62,7 @@ static jboolean JNICALL JniIsNull(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsNull() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsNull() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -71,7 +71,7 @@ static jboolean JNICALL JniIsString(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsString() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsString() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -80,7 +80,7 @@ static jboolean JNICALL JniIsBoolean(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsBool() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsBool() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -89,7 +89,7 @@ static jboolean JNICALL JniIsObject(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsObject() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsObject() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -98,7 +98,7 @@ static jboolean JNICALL JniIsArray(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsArray() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsArray() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -107,7 +107,7 @@ static jboolean JNICALL JniIsFunction(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->IsFunction() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->IsFunction() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
@@ -116,7 +116,7 @@ static jstring JNICALL JniAsString(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return env->NewStringUTF(AdblockPlus::Android::JniGetJsValue(ptr)->AsString().c_str()); |
+ return env->NewStringUTF(JniGetJsValue(ptr)->AsString().c_str()); |
} |
CATCH_THROW_AND_RETURN(env, 0) |
} |
@@ -125,7 +125,7 @@ static jlong JNICALL JniAsLong(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return static_cast<jlong>(AdblockPlus::Android::JniGetJsValue(ptr)->AsInt()); |
+ return static_cast<jlong>(JniGetJsValue(ptr)->AsInt()); |
} |
CATCH_THROW_AND_RETURN(env, 0) |
} |
@@ -134,30 +134,30 @@ static jboolean JNICALL JniAsBoolean(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr)->AsBool() ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr)->AsBool() ? JNI_TRUE : JNI_FALSE; |
} |
CATCH_THROW_AND_RETURN(env, JNI_FALSE) |
} |
static jboolean JNICALL JniIsValid(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
- return AdblockPlus::Android::JniGetJsValue(ptr) ? JNI_TRUE : JNI_FALSE; |
+ return JniGetJsValue(ptr) ? JNI_TRUE : JNI_FALSE; |
} |
static jobject JNICALL JniAsList(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
TRY |
{ |
- AdblockPlus::JsValueList list = AdblockPlus::Android::JniGetJsValue(ptr)->AsList(); |
+ AdblockPlus::JsValueList list = JniGetJsValue(ptr)->AsList(); |
- return AdblockPlus::Android::JniJsValueList2ArrayList(env, list); |
+ return JniJsValueList2ArrayList(env, list); |
} |
CATCH_THROW_AND_RETURN(env, 0) |
} |
static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
{ |
- delete AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::JsValuePtr>(ptr); |
+ delete JniLongToTypePtr<AdblockPlus::JsValuePtr>(ptr); |
} |
//std::vector<std::string> GetOwnPropertyNames() const; |
@@ -173,19 +173,20 @@ static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
static JNINativeMethod methods[] = |
{ |
-{ (char*)"isUndefined", (char*)"(J)Z", (void*)JniIsUndefined }, |
-{ (char*)"isNull", (char*)"(J)Z", (void*)JniIsNull }, |
-{ (char*)"isString", (char*)"(J)Z", (void*)JniIsString }, |
-{ (char*)"isBoolean", (char*)"(J)Z", (void*)JniIsBoolean }, |
-{ (char*)"isObject", (char*)"(J)Z", (void*)JniIsObject }, |
-{ (char*)"isArray", (char*)"(J)Z", (void*)JniIsArray }, |
-{ (char*)"isFunction", (char*)"(J)Z", (void*)JniIsFunction }, |
-{ (char*)"asString", (char*)"(J)Ljava/lang/String;", (void*)JniAsString }, |
-{ (char*)"asLong", (char*)"(J)J", (void*)JniAsLong }, |
-{ (char*)"asBoolean", (char*)"(J)Z", (void*)JniAsBoolean }, |
-{ (char*)"asList", (char*)"(J)Ljava/util/List;", (void*)JniAsList }, |
-{ (char*)"isValid", (char*)"(J)Z", (void*)JniIsValid }, |
-{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, }; |
+ { (char*)"isUndefined", (char*)"(J)Z", (void*)JniIsUndefined }, |
+ { (char*)"isNull", (char*)"(J)Z", (void*)JniIsNull }, |
+ { (char*)"isString", (char*)"(J)Z", (void*)JniIsString }, |
+ { (char*)"isBoolean", (char*)"(J)Z", (void*)JniIsBoolean }, |
+ { (char*)"isObject", (char*)"(J)Z", (void*)JniIsObject }, |
+ { (char*)"isArray", (char*)"(J)Z", (void*)JniIsArray }, |
+ { (char*)"isFunction", (char*)"(J)Z", (void*)JniIsFunction }, |
+ { (char*)"asString", (char*)"(J)Ljava/lang/String;", (void*)JniAsString }, |
+ { (char*)"asLong", (char*)"(J)J", (void*)JniAsLong }, |
+ { (char*)"asBoolean", (char*)"(J)Z", (void*)JniAsBoolean }, |
+ { (char*)"asList", (char*)"(J)Ljava/util/List;", (void*)JniAsList }, |
+ { (char*)"isValid", (char*)"(J)Z", (void*)JniIsValid }, |
+ { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
+}; |
extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_android_api_JsValue_registerNatives(JNIEnv *env, jclass clazz) |
{ |