Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: lib/utf/utf16.dart

Issue 11263040: Make String.charCodes a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/core/string.dart ('k') | lib/utf/utf_core.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 6 /**
7 * Decodes the UTF-16 bytes as an iterable. Thus, the consumer can only convert 7 * Decodes the UTF-16 bytes as an iterable. Thus, the consumer can only convert
8 * as much of the input as needed. Determines the byte order from the BOM, 8 * as much of the input as needed. Determines the byte order from the BOM,
9 * or uses big-endian as a default. This method always strips a leading BOM. 9 * or uses big-endian as a default. This method always strips a leading BOM.
10 * Set the [replacementCodepoint] to null to throw an ArgumentError 10 * Set the [replacementCodepoint] to null to throw an ArgumentError
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return (offset + 2) <= end && 195 return (offset + 2) <= end &&
196 utf16EncodedBytes[offset] == UNICODE_UTF_BOM_LO && 196 utf16EncodedBytes[offset] == UNICODE_UTF_BOM_LO &&
197 utf16EncodedBytes[offset + 1] == UNICODE_UTF_BOM_HI; 197 utf16EncodedBytes[offset + 1] == UNICODE_UTF_BOM_HI;
198 } 198 }
199 199
200 List<int> _stringToUtf16CodeUnits(String str) { 200 List<int> _stringToUtf16CodeUnits(String str) {
201 // TODO is16BitCodeUnit() is used to work around a bug with dart2js 201 // TODO is16BitCodeUnit() is used to work around a bug with dart2js
202 // (http://code.google.com/p/dart/issues/detail?id=1357). Consider 202 // (http://code.google.com/p/dart/issues/detail?id=1357). Consider
203 // removing after this issue is resolved. 203 // removing after this issue is resolved.
204 if (_is16BitCodeUnit()) { 204 if (_is16BitCodeUnit()) {
205 return str.charCodes(); 205 return str.charCodes;
206 } else { 206 } else {
207 return _codepointsToUtf16CodeUnits(str.charCodes()); 207 return _codepointsToUtf16CodeUnits(str.charCodes);
208 } 208 }
209 } 209 }
210 210
211 typedef _ListRangeIterator _CodeUnitsProvider(); 211 typedef _ListRangeIterator _CodeUnitsProvider();
212 212
213 /** 213 /**
214 * Return type of [decodeUtf16AsIterable] and variants. The Iterable type 214 * Return type of [decodeUtf16AsIterable] and variants. The Iterable type
215 * provides an iterator on demand and the iterator will only translate bytes 215 * provides an iterator on demand and the iterator will only translate bytes
216 * as requested by the user of the iterator. (Note: results are not cached.) 216 * as requested by the user of the iterator. (Note: results are not cached.)
217 */ 217 */
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 skip(); 343 skip();
344 } 344 }
345 } 345 }
346 346
347 int decode() { 347 int decode() {
348 int lo = utf16EncodedBytesIterator.next(); 348 int lo = utf16EncodedBytesIterator.next();
349 int hi = utf16EncodedBytesIterator.next(); 349 int hi = utf16EncodedBytesIterator.next();
350 return (hi << 8) + lo; 350 return (hi << 8) + lo;
351 } 351 }
352 } 352 }
OLDNEW
« no previous file with comments | « lib/core/string.dart ('k') | lib/utf/utf_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698