| LEFT | RIGHT |
| (no file at all) | |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (!str) | 24 if (!str) |
| 25 { | 25 { |
| 26 return std::string(); | 26 return std::string(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 const char* cStr = env->GetStringUTFChars(str, 0); | 29 const char* cStr = env->GetStringUTFChars(str, 0); |
| 30 std::string ret(cStr); | 30 std::string ret(cStr); |
| 31 env->ReleaseStringUTFChars(str, cStr); | 31 env->ReleaseStringUTFChars(str, cStr); |
| 32 | 32 |
| 33 return ret; | 33 return ret; |
| 34 } |
| 35 |
| 36 jstring JniStdStringToJava(JNIEnv* env, std::string str) |
| 37 { |
| 38 return env->NewStringUTF(str.c_str()); |
| 34 } | 39 } |
| 35 | 40 |
| 36 jobject NewJniArrayList(JNIEnv* env) | 41 jobject NewJniArrayList(JNIEnv* env) |
| 37 { | 42 { |
| 38 JniLocalReference<jclass> clazz(env, env->FindClass("java/util/ArrayList")); | 43 JniLocalReference<jclass> clazz(env, env->FindClass("java/util/ArrayList")); |
| 39 jmethodID ctor = env->GetMethodID(*clazz, "<init>", "()V"); | 44 jmethodID ctor = env->GetMethodID(*clazz, "<init>", "()V"); |
| 40 return env->NewObject(*clazz, ctor); | 45 return env->NewObject(*clazz, ctor); |
| 41 } | 46 } |
| 42 | 47 |
| 43 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value) | 48 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const AdblockPlus::SubscriptionPtr& subscription) | 120 const AdblockPlus::SubscriptionPtr& subscription) |
| 116 { | 121 { |
| 117 return NewJniObject(env, subscription, PKG("Subscription")); | 122 return NewJniObject(env, subscription, PKG("Subscription")); |
| 118 } | 123 } |
| 119 | 124 |
| 120 jobject NewJniNotification(JNIEnv* env, | 125 jobject NewJniNotification(JNIEnv* env, |
| 121 const AdblockPlus::NotificationPtr& notification) | 126 const AdblockPlus::NotificationPtr& notification) |
| 122 { | 127 { |
| 123 return NewJniObject(env, notification, PKG("Notification")); | 128 return NewJniObject(env, notification, PKG("Notification")); |
| 124 } | 129 } |
| LEFT | RIGHT |