| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return env->NewObject(clazz, method, JniPtrToLong(new AdblockPlus::FilterPtr(f
ilter))); | 145 return env->NewObject(clazz, method, JniPtrToLong(new AdblockPlus::FilterPtr(f
ilter))); |
| 146 } | 146 } |
| 147 | 147 |
| 148 inline jobject NewJniSubscription(JNIEnv* env, const AdblockPlus::SubscriptionPt
r& subscription) | 148 inline jobject NewJniSubscription(JNIEnv* env, const AdblockPlus::SubscriptionPt
r& subscription) |
| 149 { | 149 { |
| 150 jclass clazz = env->FindClass(PKG("Subscription")); | 150 jclass clazz = env->FindClass(PKG("Subscription")); |
| 151 jmethodID method = env->GetMethodID(clazz, "<init>", "(J)V"); | 151 jmethodID method = env->GetMethodID(clazz, "<init>", "(J)V"); |
| 152 return env->NewObject(clazz, method, JniPtrToLong(new AdblockPlus::Subscriptio
nPtr(subscription))); | 152 return env->NewObject(clazz, method, JniPtrToLong(new AdblockPlus::Subscriptio
nPtr(subscription))); |
| 153 } | 153 } |
| 154 | 154 |
| 155 #define TRY try | |
| 156 | |
| 157 #define CATCH_AND_THROW(jEnv) \ | 155 #define CATCH_AND_THROW(jEnv) \ |
| 158 catch (const std::exception& except) \ | 156 catch (const std::exception& except) \ |
| 159 { \ | 157 { \ |
| 160 JniThrowException(jEnv, except); \ | 158 JniThrowException(jEnv, except); \ |
| 161 } \ | 159 } \ |
| 162 catch (...) \ | 160 catch (...) \ |
| 163 { \ | 161 { \ |
| 164 JniThrowException(jEnv); \ | 162 JniThrowException(jEnv); \ |
| 165 } | 163 } |
| 166 | 164 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 182 T TrimString(T text) | 180 T TrimString(T text) |
| 183 { | 181 { |
| 184 // Via http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-st
dstring | 182 // Via http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-st
dstring |
| 185 T trimmed(text); | 183 T trimmed(text); |
| 186 trimmed.erase(trimmed.begin(), std::find_if(trimmed.begin(), trimmed.end(), st
d::not1(std::ptr_fun<int, int>(std::isspace)))); | 184 trimmed.erase(trimmed.begin(), std::find_if(trimmed.begin(), trimmed.end(), st
d::not1(std::ptr_fun<int, int>(std::isspace)))); |
| 187 trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(std::pt
r_fun<int, int>(std::isspace))).base(), trimmed.end()); | 185 trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(std::pt
r_fun<int, int>(std::isspace))).base(), trimmed.end()); |
| 188 return trimmed; | 186 return trimmed; |
| 189 } | 187 } |
| 190 | 188 |
| 191 #endif | 189 #endif |
| LEFT | RIGHT |