| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 patch class String { | 5 patch class String { |
| 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { | 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { |
| 7 return _StringBase.createFromCharCodes(charCodes); | 7 return _StringBase.createFromCharCodes(charCodes); |
| 8 } | 8 } |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid | 572 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid |
| 573 // whitespaces. Add checking for multi-byte whitespace codepoints. | 573 // whitespaces. Add checking for multi-byte whitespace codepoints. |
| 574 bool _isWhitespace(int codePoint) { | 574 bool _isWhitespace(int codePoint) { |
| 575 return | 575 return |
| 576 (codePoint == 32) || // Space. | 576 (codePoint == 32) || // Space. |
| 577 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. | 577 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. |
| 578 } | 578 } |
| 579 } | 579 } |
| 580 | 580 |
| 581 | 581 |
| 582 class _FourByteString extends _StringBase implements String { | |
| 583 factory _FourByteString._uninstantiable() { | |
| 584 throw new UnsupportedError( | |
| 585 "_FourByteString can only be allocated by the VM"); | |
| 586 } | |
| 587 | |
| 588 // Checks for one-byte whitespaces only. | |
| 589 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid | |
| 590 // whitespaces. Add checking for multi-byte whitespace codepoints. | |
| 591 bool _isWhitespace(int codePoint) { | |
| 592 return | |
| 593 (codePoint == 32) || // Space. | |
| 594 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. | |
| 595 } | |
| 596 } | |
| 597 | |
| 598 | |
| 599 class _ExternalOneByteString extends _StringBase implements String { | 582 class _ExternalOneByteString extends _StringBase implements String { |
| 600 factory _ExternalOneByteString._uninstantiable() { | 583 factory _ExternalOneByteString._uninstantiable() { |
| 601 throw new UnsupportedError( | 584 throw new UnsupportedError( |
| 602 "_ExternalOneByteString can only be allocated by the VM"); | 585 "_ExternalOneByteString can only be allocated by the VM"); |
| 603 } | 586 } |
| 604 | 587 |
| 605 // Checks for one-byte whitespaces only. | 588 // Checks for one-byte whitespaces only. |
| 606 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid | 589 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid |
| 607 // whitespaces for one byte strings. | 590 // whitespaces for one byte strings. |
| 608 bool _isWhitespace(int codePoint) { | 591 bool _isWhitespace(int codePoint) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 class _CodeUnits extends Object with ListMixin<int>, | 648 class _CodeUnits extends Object with ListMixin<int>, |
| 666 UnmodifiableListMixin<int> { | 649 UnmodifiableListMixin<int> { |
| 667 /** The string that this is the code units of. */ | 650 /** The string that this is the code units of. */ |
| 668 String _string; | 651 String _string; |
| 669 | 652 |
| 670 _CodeUnits(this._string); | 653 _CodeUnits(this._string); |
| 671 | 654 |
| 672 int get length => _string.length; | 655 int get length => _string.length; |
| 673 int operator[](int i) => _string.codeUnitAt(i); | 656 int operator[](int i) => _string.codeUnitAt(i); |
| 674 } | 657 } |
| OLD | NEW |