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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // implement a special cast functions that first reinterpret_casts to shared_ptr
<JsValue> and then | 141 // implement a special cast functions that first reinterpret_casts to shared_ptr
<JsValue> and then |
142 // dynamic_casts to shared_ptr<T: JsValue> ... also as the same inheritance is m
irrored on the Java | 142 // dynamic_casts to shared_ptr<T: JsValue> ... also as the same inheritance is m
irrored on the Java |
143 // side (and Java will throw a class cast exception on error) this shouldn't be
an issue (TM) | 143 // side (and Java will throw a class cast exception on error) this shouldn't be
an issue (TM) |
144 template<typename T> | 144 template<typename T> |
145 inline T* JniLongToTypePtr(jlong value) | 145 inline T* JniLongToTypePtr(jlong value) |
146 { | 146 { |
147 return reinterpret_cast<T*>((size_t)value); | 147 return reinterpret_cast<T*>((size_t)value); |
148 } | 148 } |
149 | 149 |
150 std::string JniJavaToStdString(JNIEnv* env, jstring str); | 150 std::string JniJavaToStdString(JNIEnv* env, jstring str); |
| 151 jstring JniStdStringToJava(JNIEnv* env, std::string str); |
151 | 152 |
152 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value); | 153 void JniAddObjectToList(JNIEnv* env, jobject list, jobject value); |
153 | 154 |
154 inline std::string JniGetStringField(JNIEnv* env, jclass clazz, jobject jObj, co
nst char* name) | 155 inline std::string JniGetStringField(JNIEnv* env, jclass clazz, jobject jObj, co
nst char* name) |
155 { | 156 { |
156 return JniJavaToStdString(env, reinterpret_cast<jstring>(env->GetObjectField(j
Obj, env->GetFieldID(clazz, name, "Ljava/lang/String;")))); | 157 return JniJavaToStdString(env, reinterpret_cast<jstring>(env->GetObjectField(j
Obj, env->GetFieldID(clazz, name, "Ljava/lang/String;")))); |
157 } | 158 } |
158 | 159 |
159 inline bool JniGetBooleanField(JNIEnv* env, jclass clazz, jobject jObj, const ch
ar* name) | 160 inline bool JniGetBooleanField(JNIEnv* env, jclass clazz, jobject jObj, const ch
ar* name) |
160 { | 161 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 JniThrowException(jEnv, except); \ | 198 JniThrowException(jEnv, except); \ |
198 return retVal; \ | 199 return retVal; \ |
199 } \ | 200 } \ |
200 catch (...) \ | 201 catch (...) \ |
201 { \ | 202 { \ |
202 JniThrowException(jEnv); \ | 203 JniThrowException(jEnv); \ |
203 return retVal; \ | 204 return retVal; \ |
204 } | 205 } |
205 | 206 |
206 #endif | 207 #endif |
LEFT | RIGHT |