OLD | NEW |
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // This should be more efficient with a lookup table but I couldn't measur
e | 184 // This should be more efficient with a lookup table but I couldn't measur
e |
185 // any performance difference. | 185 // any performance difference. |
186 if (currChar >= u'A' && currChar <= u'Z') | 186 if (currChar >= u'A' && currChar <= u'Z') |
187 mBuf[i] = currChar + u'a' - u'A'; | 187 mBuf[i] = currChar + u'a' - u'A'; |
188 else if (currChar >= 128) | 188 else if (currChar >= 128) |
189 { | 189 { |
190 mBuf[i] = CharToLower(currChar); | 190 mBuf[i] = CharToLower(currChar); |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
| 194 |
| 195 void toUpper() |
| 196 { |
| 197 size_type len = length(); |
| 198 for (size_type i = 0; i < len; ++i) |
| 199 { |
| 200 value_type currChar = mBuf[i]; |
| 201 |
| 202 // This should be more efficient with a lookup table but I couldn't measur
e |
| 203 // any performance difference. |
| 204 if (currChar >= u'a' && currChar <= u'z') |
| 205 mBuf[i] = currChar - (u'a' - u'A'); |
| 206 else if (currChar >= 128) |
| 207 { |
| 208 mBuf[i] = CharToUpper(currChar); |
| 209 } |
| 210 } |
| 211 } |
194 }; | 212 }; |
195 | 213 |
196 class DependentString : public String | 214 class DependentString : public String |
197 { | 215 { |
198 public: | 216 public: |
199 explicit DependentString() | 217 explicit DependentString() |
200 : String(nullptr, 0, INVALID) | 218 : String(nullptr, 0, INVALID) |
201 { | 219 { |
202 } | 220 } |
203 | 221 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (negative) | 416 if (negative) |
399 mBuf[pos++] = '-'; | 417 mBuf[pos++] = '-'; |
400 | 418 |
401 for (int i = size - 1; i >= 0; i--) | 419 for (int i = size - 1; i >= 0; i--) |
402 { | 420 { |
403 mBuf[pos + i] = '0' + (num % 10); | 421 mBuf[pos + i] = '0' + (num % 10); |
404 num /= 10; | 422 num /= 10; |
405 } | 423 } |
406 } | 424 } |
407 }; | 425 }; |
OLD | NEW |