Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: jni/Utils.h

Issue 6606493159784448: New JNI bindings (Closed)
Left Patch Set: Bug fix for global references (shadowing) Created March 31, 2014, 2:43 p.m.
Right Patch Set: Removed TODO from AppInfo. Created April 11, 2014, 1:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « jni/JniWebRequest.cpp ('k') | jni/Utils.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
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
LEFTRIGHT

Powered by Google App Engine
This is Rietveld