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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 str.mBuf = nullptr; | 317 str.mBuf = nullptr; |
318 str.mLen = READ_WRITE | 0; | 318 str.mLen = READ_WRITE | 0; |
319 } | 319 } |
320 | 320 |
321 ~OwnedString() | 321 ~OwnedString() |
322 { | 322 { |
323 if (mBuf) | 323 if (mBuf) |
324 delete[] mBuf; | 324 delete[] mBuf; |
325 } | 325 } |
326 | 326 |
| 327 void reset(const String& str) |
| 328 { |
| 329 *this = str; |
| 330 } |
| 331 |
327 OwnedString& operator=(const String& str) | 332 OwnedString& operator=(const String& str) |
328 { | 333 { |
329 *this = OwnedString(str); | 334 *this = OwnedString(str); |
330 return *this; | 335 return *this; |
331 } | 336 } |
332 | 337 |
333 OwnedString& operator=(const OwnedString& str) | 338 OwnedString& operator=(const OwnedString& str) |
334 { | 339 { |
335 *this = OwnedString(str); | 340 *this = OwnedString(str); |
336 return *this; | 341 return *this; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (negative) | 403 if (negative) |
399 mBuf[pos++] = '-'; | 404 mBuf[pos++] = '-'; |
400 | 405 |
401 for (int i = size - 1; i >= 0; i--) | 406 for (int i = size - 1; i >= 0; i--) |
402 { | 407 { |
403 mBuf[pos + i] = '0' + (num % 10); | 408 mBuf[pos + i] = '0' + (num % 10); |
404 num /= 10; | 409 num /= 10; |
405 } | 410 } |
406 } | 411 } |
407 }; | 412 }; |
OLD | NEW |