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

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

Issue 9861011: - Remove type arguments from internal classes and interfaces. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | « no previous file | 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 /** 211 /**
212 * Return type of [decodeUtf16AsIterable] and variants. The Iterable type 212 * Return type of [decodeUtf16AsIterable] and variants. The Iterable type
213 * provides an iterator on demand and the iterator will only translate bytes 213 * provides an iterator on demand and the iterator will only translate bytes
214 * as requested by the user of the iterator. (Note: results are not cached.) 214 * as requested by the user of the iterator. (Note: results are not cached.)
215 */ 215 */
216 class IterableUtf16Decoder implements Iterable<int> { 216 class IterableUtf16Decoder implements Iterable<int> {
217 final Function codeunitsProvider; 217 final Function codeunitsProvider;
218 final int replacementCodepoint; 218 final int replacementCodepoint;
219 219
220 IterableUtf16Decoder._(_ListRangeIterator<int> this.codeunitsProvider(), 220 IterableUtf16Decoder._(_ListRangeIterator this.codeunitsProvider(),
221 int this.replacementCodepoint); 221 int this.replacementCodepoint);
222 222
223 Utf16CodeUnitDecoder iterator() => 223 Utf16CodeUnitDecoder iterator() =>
224 new Utf16CodeUnitDecoder.fromListRangeIterator(codeunitsProvider(), 224 new Utf16CodeUnitDecoder.fromListRangeIterator(codeunitsProvider(),
225 replacementCodepoint); 225 replacementCodepoint);
226 } 226 }
227 227
228 /** 228 /**
229 * Convert UTF-16 encoded bytes to UTF-16 code units by grouping 1-2 bytes 229 * Convert UTF-16 encoded bytes to UTF-16 code units by grouping 1-2 bytes
230 * to produce the code unit (0-(2^16)-1). Relies on BOM to determine 230 * to produce the code unit (0-(2^16)-1). Relies on BOM to determine
231 * endian-ness, and defaults to BE. 231 * endian-ness, and defaults to BE.
232 */ 232 */
233 class Utf16BytesToCodeUnitsDecoder implements _ListRangeIterator<int> { 233 class Utf16BytesToCodeUnitsDecoder implements _ListRangeIterator {
234 final _ListRangeIterator<int> utf16EncodedBytesIterator; 234 final _ListRangeIterator utf16EncodedBytesIterator;
235 final int replacementCodepoint; 235 final int replacementCodepoint;
236 236
237 Utf16BytesToCodeUnitsDecoder._fromListRangeIterator( 237 Utf16BytesToCodeUnitsDecoder._fromListRangeIterator(
238 _ListRangeIterator<int> this.utf16EncodedBytesIterator, 238 _ListRangeIterator this.utf16EncodedBytesIterator,
239 int this.replacementCodepoint); 239 int this.replacementCodepoint);
240 240
241 factory Utf16BytesToCodeUnitsDecoder(List<int> utf16EncodedBytes, [ 241 factory Utf16BytesToCodeUnitsDecoder(List<int> utf16EncodedBytes, [
242 int offset = 0, int length, 242 int offset = 0, int length,
243 int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT]) { 243 int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT]) {
244 if (length == null) { 244 if (length == null) {
245 length = utf16EncodedBytes.length - offset; 245 length = utf16EncodedBytes.length - offset;
246 } 246 }
247 if (hasUtf16beBom(utf16EncodedBytes, offset, length)) { 247 if (hasUtf16beBom(utf16EncodedBytes, offset, length)) {
248 return new Utf16beBytesToCodeUnitsDecoder(utf16EncodedBytes, offset + 2, 248 return new Utf16beBytesToCodeUnitsDecoder(utf16EncodedBytes, offset + 2,
(...skipping 94 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 | « no previous file | lib/utf/utf32.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698