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

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

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months 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/uri/uri.dart ('k') | lib/utf/utf32.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 IllegalArgumentException 10 * Set the [replacementCodepoint] to null to throw an IllegalArgumentException
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 return replacementCodepoint; 285 return replacementCodepoint;
286 } else { 286 } else {
287 throw new IllegalArgumentException( 287 throw new IllegalArgumentException(
288 "Invalid UTF16 at ${utf16EncodedBytesIterator.position}"); 288 "Invalid UTF16 at ${utf16EncodedBytesIterator.position}");
289 } 289 }
290 } else { 290 } else {
291 return decode(); 291 return decode();
292 } 292 }
293 } 293 }
294 294
295 int get position() => utf16EncodedBytesIterator.position ~/ 2; 295 int get position => utf16EncodedBytesIterator.position ~/ 2;
296 296
297 void backup([int by = 1]) { 297 void backup([int by = 1]) {
298 utf16EncodedBytesIterator.backup(2 * by); 298 utf16EncodedBytesIterator.backup(2 * by);
299 } 299 }
300 300
301 int get remaining() => (utf16EncodedBytesIterator.remaining + 1) ~/ 2; 301 int get remaining => (utf16EncodedBytesIterator.remaining + 1) ~/ 2;
302 302
303 void skip([int count = 1]) { 303 void skip([int count = 1]) {
304 utf16EncodedBytesIterator.skip(2 * count); 304 utf16EncodedBytesIterator.skip(2 * count);
305 } 305 }
306 306
307 abstract int decode(); 307 abstract int decode();
308 } 308 }
309 309
310 /** 310 /**
311 * Convert UTF-16BE encoded bytes to utf16 code units by grouping 1-2 bytes 311 * Convert UTF-16BE encoded bytes to utf16 code units by grouping 1-2 bytes
(...skipping 31 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/uri/uri.dart ('k') | lib/utf/utf32.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698