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

Side by Side Diff: sdk/lib/convert/utf.dart

Issue 2767943002: Revert "Fix some strong mode issues in the core libraries." (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « sdk/lib/convert/line_splitter.dart ('k') | sdk/lib/io/data_transformer.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.convert; 5 part of dart.convert;
6 6
7 /** The Unicode Replacement character `U+FFFD` (�). */ 7 /** The Unicode Replacement character `U+FFFD` (�). */
8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; 8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD;
9 9
10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */ 10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 Utf8Encoder get encoder => const Utf8Encoder(); 69 Utf8Encoder get encoder => const Utf8Encoder();
70 Utf8Decoder get decoder { 70 Utf8Decoder get decoder {
71 return new Utf8Decoder(allowMalformed: _allowMalformed); 71 return new Utf8Decoder(allowMalformed: _allowMalformed);
72 } 72 }
73 } 73 }
74 74
75 /** 75 /**
76 * This class converts strings to their UTF-8 code units (a list of 76 * This class converts strings to their UTF-8 code units (a list of
77 * unsigned 8-bit integers). 77 * unsigned 8-bit integers).
78 */ 78 */
79 class Utf8Encoder extends Converter<String, List<int>> { 79 class Utf8Encoder extends Converter<String, List<int>>
80 implements ChunkedConverter<String, List<int>, String, List<int>> {
80 const Utf8Encoder(); 81 const Utf8Encoder();
81 82
82 /** 83 /**
83 * Converts [string] to its UTF-8 code units (a list of 84 * Converts [string] to its UTF-8 code units (a list of
84 * unsigned 8-bit integers). 85 * unsigned 8-bit integers).
85 * 86 *
86 * If [start] and [end] are provided, only the substring 87 * If [start] and [end] are provided, only the substring
87 * `string.substring(start, end)` is converted. 88 * `string.substring(start, end)` is converted.
88 */ 89 */
89 List<int> convert(String string, [int start = 0, int end]) { 90 List<int> convert(String string, [int start = 0, int end]) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 296 }
296 297
297 // TODO(floitsch): implement asUtf8Sink. Sligthly complicated because it 298 // TODO(floitsch): implement asUtf8Sink. Sligthly complicated because it
298 // needs to deal with malformed input. 299 // needs to deal with malformed input.
299 } 300 }
300 301
301 /** 302 /**
302 * This class converts UTF-8 code units (lists of unsigned 8-bit integers) 303 * This class converts UTF-8 code units (lists of unsigned 8-bit integers)
303 * to a string. 304 * to a string.
304 */ 305 */
305 class Utf8Decoder extends Converter<List<int>, String> { 306 class Utf8Decoder extends Converter<List<int>, String>
307 implements ChunkedConverter<List<int>, String, List<int>, String> {
306 final bool _allowMalformed; 308 final bool _allowMalformed;
307 309
308 /** 310 /**
309 * Instantiates a new [Utf8Decoder]. 311 * Instantiates a new [Utf8Decoder].
310 * 312 *
311 * The optional [allowMalformed] argument defines how [convert] deals 313 * The optional [allowMalformed] argument defines how [convert] deals
312 * with invalid or unterminated character sequences. 314 * with invalid or unterminated character sequences.
313 * 315 *
314 * If it is `true` [convert] replaces invalid (or unterminated) character 316 * If it is `true` [convert] replaces invalid (or unterminated) character
315 * sequences with the Unicode Replacement character `U+FFFD` (�). Otherwise 317 * sequences with the Unicode Replacement character `U+FFFD` (�). Otherwise
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 580 }
579 break loop; 581 break loop;
580 } 582 }
581 if (expectedUnits > 0) { 583 if (expectedUnits > 0) {
582 _value = value; 584 _value = value;
583 _expectedUnits = expectedUnits; 585 _expectedUnits = expectedUnits;
584 _extraUnits = extraUnits; 586 _extraUnits = extraUnits;
585 } 587 }
586 } 588 }
587 } 589 }
OLDNEW
« no previous file with comments | « sdk/lib/convert/line_splitter.dart ('k') | sdk/lib/io/data_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698