| 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 /** | 5 /** |
| 6 * Support for encoding and decoding Unicode characters in UTF-8, UTF-16, and | 6 * Support for encoding and decoding Unicode characters in UTF-8, UTF-16, and |
| 7 * UTF-32. | 7 * UTF-32. |
| 8 */ | 8 */ |
| 9 @deprecated | 9 @deprecated |
| 10 library dart.utf; | 10 library dart.utf; |
| 11 import "dart:_collection-dev" show deprecated; | 11 import "dart:_collection-dev" show deprecated, EfficientLength; |
| 12 import "dart:async"; | 12 import "dart:async"; |
| 13 import "dart:collection"; | 13 import "dart:collection"; |
| 14 part "utf_stream.dart"; | 14 part "utf_stream.dart"; |
| 15 part "utf8.dart"; | 15 part "utf8.dart"; |
| 16 part "utf16.dart"; | 16 part "utf16.dart"; |
| 17 part "utf32.dart"; | 17 part "utf32.dart"; |
| 18 | 18 |
| 19 // TODO(jmesserly): would be nice to have this on String (dartbug.com/6501). | 19 // TODO(jmesserly): would be nice to have this on String (dartbug.com/6501). |
| 20 /** | 20 /** |
| 21 * *DEPRECATED*: Use `dart:convert` or `package:utf/utf.dart` instead. | 21 * *DEPRECATED*: Use `dart:convert` or `package:utf/utf.dart` instead. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 /** | 218 /** |
| 219 * _ListRange in an internal type used to create a lightweight Interable on a | 219 * _ListRange in an internal type used to create a lightweight Interable on a |
| 220 * range within a source list. DO NOT MODIFY the underlying list while | 220 * range within a source list. DO NOT MODIFY the underlying list while |
| 221 * iterating over it. The results of doing so are undefined. | 221 * iterating over it. The results of doing so are undefined. |
| 222 */ | 222 */ |
| 223 // TODO(floitsch): Consider removing the extend and switch to implements since | 223 // TODO(floitsch): Consider removing the extend and switch to implements since |
| 224 // that's cheaper to allocate. | 224 // that's cheaper to allocate. |
| 225 class _ListRange extends IterableBase { | 225 class _ListRange extends IterableBase implements EfficientLength { |
| 226 final List _source; | 226 final List _source; |
| 227 final int _offset; | 227 final int _offset; |
| 228 final int _length; | 228 final int _length; |
| 229 | 229 |
| 230 _ListRange(source, [offset = 0, length]) : | 230 _ListRange(source, [offset = 0, length]) : |
| 231 this._source = source, | 231 this._source = source, |
| 232 this._offset = offset, | 232 this._offset = offset, |
| 233 this._length = (length == null ? source.length - offset : length) { | 233 this._length = (length == null ? source.length - offset : length) { |
| 234 if (_offset < 0 || _offset > _source.length) { | 234 if (_offset < 0 || _offset > _source.length) { |
| 235 throw new RangeError.value(_offset); | 235 throw new RangeError.value(_offset); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 _offset -= by; | 280 _offset -= by; |
| 281 } | 281 } |
| 282 | 282 |
| 283 int get remaining => _end - _offset - 1; | 283 int get remaining => _end - _offset - 1; |
| 284 | 284 |
| 285 void skip([int count = 1]) { | 285 void skip([int count = 1]) { |
| 286 _offset += count; | 286 _offset += count; |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| OLD | NEW |