LEFT | RIGHT |
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 void append(T num) | 376 void append(T num) |
377 { | 377 { |
378 bool negative = false; | 378 bool negative = false; |
379 if (num < 0) | 379 if (num < 0) |
380 { | 380 { |
381 negative = true; | 381 negative = true; |
382 num = -num; | 382 num = -num; |
383 } | 383 } |
384 | 384 |
385 size_type size = 0; | 385 size_type size = 0; |
386 for (int i = num; i; i /= 10) | 386 for (T i = num; i; i /= 10) |
387 size++; | 387 size++; |
388 size = (size ? size : 1); | 388 size = (size ? size : 1); |
389 | 389 |
390 size_type pos = length(); | 390 size_type pos = length(); |
391 grow((negative ? 1 : 0) + size); | 391 grow((negative ? 1 : 0) + size); |
392 | 392 |
393 if (negative) | 393 if (negative) |
394 mBuf[pos++] = '-'; | 394 mBuf[pos++] = '-'; |
395 | 395 |
396 for (int i = size - 1; i >= 0; i--) | 396 for (int i = size - 1; i >= 0; i--) |
397 { | 397 { |
398 mBuf[pos + i] = '0' + (num % 10); | 398 mBuf[pos + i] = '0' + (num % 10); |
399 num /= 10; | 399 num /= 10; |
400 } | 400 } |
401 } | 401 } |
402 }; | 402 }; |
LEFT | RIGHT |