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

Side by Side Diff: sdk/lib/core/uri.dart

Issue 2655883002: fix spelling in core libraries (Closed)
Patch Set: while I’m at it… Created 3 years, 10 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/core/symbol.dart ('k') | sdk/lib/html/html_common/conversions.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 part of dart.core; 5 part of dart.core;
6 6
7 // Frequently used character codes. 7 // Frequently used character codes.
8 const int _SPACE = 0x20; 8 const int _SPACE = 0x20;
9 const int _PERCENT = 0x25; 9 const int _PERCENT = 0x25;
10 const int _PLUS = 0x2B; 10 const int _PLUS = 0x2B;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 * 68 *
69 * The port part of the authority component is set through 69 * The port part of the authority component is set through
70 * [port]. 70 * [port].
71 * If [port] is omitted or `null`, it implies the default port for 71 * If [port] is omitted or `null`, it implies the default port for
72 * the URI's scheme, and is equivalent to passing that port explicitly. 72 * the URI's scheme, and is equivalent to passing that port explicitly.
73 * The recognized schemes, and their default ports, are "http" (80) and 73 * The recognized schemes, and their default ports, are "http" (80) and
74 * "https" (443). All other schemes are considered as having zero as the 74 * "https" (443). All other schemes are considered as having zero as the
75 * default port. 75 * default port.
76 * 76 *
77 * If any of `userInfo`, `host` or `port` are provided, 77 * If any of `userInfo`, `host` or `port` are provided,
78 * the URI has an autority according to [hasAuthority]. 78 * the URI has an authority according to [hasAuthority].
79 * 79 *
80 * The path component is set through either [path] or 80 * The path component is set through either [path] or
81 * [pathSegments]. 81 * [pathSegments].
82 * When [path] is used, it should be a valid URI path, 82 * When [path] is used, it should be a valid URI path,
83 * but invalid characters, except the general delimiters ':/@[]?#', 83 * but invalid characters, except the general delimiters ':/@[]?#',
84 * will be escaped if necessary. 84 * will be escaped if necessary.
85 * When [pathSegments] is used, each of the provided segments 85 * When [pathSegments] is used, each of the provided segments
86 * is first percent-encoded and then joined using the forward slash 86 * is first percent-encoded and then joined using the forward slash
87 * separator. 87 * separator.
88 * 88 *
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 * This method takes the same parameters as the [new Uri] constructor, 606 * This method takes the same parameters as the [new Uri] constructor,
607 * and they have the same meaning. 607 * and they have the same meaning.
608 * 608 *
609 * At most one of [path] and [pathSegments] must be provided. 609 * At most one of [path] and [pathSegments] must be provided.
610 * Likewise, at most one of [query] and [queryParameters] must be provided. 610 * Likewise, at most one of [query] and [queryParameters] must be provided.
611 * 611 *
612 * Each part that is not provided will default to the corresponding 612 * Each part that is not provided will default to the corresponding
613 * value from this `Uri` instead. 613 * value from this `Uri` instead.
614 * 614 *
615 * This method is different from [Uri.resolve] which overrides in a 615 * This method is different from [Uri.resolve] which overrides in a
616 * hierarchial manner, 616 * hierarchical manner,
617 * and can instead replace each part of a `Uri` individually. 617 * and can instead replace each part of a `Uri` individually.
618 * 618 *
619 * Example: 619 * Example:
620 * 620 *
621 * Uri uri1 = Uri.parse("a://b@c:4/d/e?f#g"); 621 * Uri uri1 = Uri.parse("a://b@c:4/d/e?f#g");
622 * Uri uri2 = uri1.replace(scheme: "A", path: "D/E/E", fragment: "G"); 622 * Uri uri2 = uri1.replace(scheme: "A", path: "D/E/E", fragment: "G");
623 * print(uri2); // prints "A://b@c:4/D/E/E/?f#G" 623 * print(uri2); // prints "A://b@c:4/D/E/E/?f#G"
624 * 624 *
625 * This method acts similarly to using the `new Uri` constructor with 625 * This method acts similarly to using the `new Uri` constructor with
626 * some of the arguments taken from this `Uri` . Example: 626 * some of the arguments taken from this `Uri` . Example:
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 static String encodeQueryComponent(String component, 1053 static String encodeQueryComponent(String component,
1054 {Encoding encoding: UTF8}) { 1054 {Encoding encoding: UTF8}) {
1055 return _Uri._uriEncode(_Uri._unreservedTable, component, encoding, true); 1055 return _Uri._uriEncode(_Uri._unreservedTable, component, encoding, true);
1056 } 1056 }
1057 1057
1058 /** 1058 /**
1059 * Decodes the percent-encoding in [encodedComponent]. 1059 * Decodes the percent-encoding in [encodedComponent].
1060 * 1060 *
1061 * Note that decoding a URI component might change its meaning as 1061 * Note that decoding a URI component might change its meaning as
1062 * some of the decoded characters could be characters with are 1062 * some of the decoded characters could be characters with are
1063 * delimiters for a given URI componene type. Always split a URI 1063 * delimiters for a given URI component type. Always split a URI
1064 * component using the delimiters for the component before decoding 1064 * component using the delimiters for the component before decoding
1065 * the individual parts. 1065 * the individual parts.
1066 * 1066 *
1067 * For handling the [path] and [query] components consider using 1067 * For handling the [path] and [query] components consider using
1068 * [pathSegments] and [queryParameters] to get the separated and 1068 * [pathSegments] and [queryParameters] to get the separated and
1069 * decoded component. 1069 * decoded component.
1070 */ 1070 */
1071 static String decodeComponent(String encodedComponent) { 1071 static String decodeComponent(String encodedComponent) {
1072 return _Uri._uriDecode(encodedComponent, 0, encodedComponent.length, 1072 return _Uri._uriDecode(encodedComponent, 0, encodedComponent.length,
1073 UTF8, false); 1073 UTF8, false);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 */ 1354 */
1355 String _path; 1355 String _path;
1356 1356
1357 // The query content, or null if there is no query. 1357 // The query content, or null if there is no query.
1358 final String _query; 1358 final String _query;
1359 1359
1360 // The fragment content, or null if there is no fragment. 1360 // The fragment content, or null if there is no fragment.
1361 final String _fragment; 1361 final String _fragment;
1362 1362
1363 /** 1363 /**
1364 * Cache the computed return value of [pathSegements]. 1364 * Cache the computed return value of [pathSegments].
1365 */ 1365 */
1366 List<String> _pathSegments; 1366 List<String> _pathSegments;
1367 1367
1368 /** 1368 /**
1369 * Cache of the full normalized text representation of the URI. 1369 * Cache of the full normalized text representation of the URI.
1370 */ 1370 */
1371 String _text; 1371 String _text;
1372 1372
1373 /** 1373 /**
1374 * Cache of the hashCode of [_text]. 1374 * Cache of the hashCode of [_text].
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 /** 2735 /**
2736 * Uri-decode a percent-encoded string. 2736 * Uri-decode a percent-encoded string.
2737 * 2737 *
2738 * It unescapes the string [text] and returns the unescaped string. 2738 * It unescapes the string [text] and returns the unescaped string.
2739 * 2739 *
2740 * This function is similar to the JavaScript-function `decodeURI`. 2740 * This function is similar to the JavaScript-function `decodeURI`.
2741 * 2741 *
2742 * If [plusToSpace] is `true`, plus characters will be converted to spaces. 2742 * If [plusToSpace] is `true`, plus characters will be converted to spaces.
2743 * 2743 *
2744 * The decoder will create a byte-list of the percent-encoded parts, and then 2744 * The decoder will create a byte-list of the percent-encoded parts, and then
2745 * decode the byte-list using [encoding]. The default encodingis UTF-8. 2745 * decode the byte-list using [encoding]. The default encodings UTF-8.
2746 */ 2746 */
2747 static String _uriDecode(String text, 2747 static String _uriDecode(String text,
2748 int start, 2748 int start,
2749 int end, 2749 int end,
2750 Encoding encoding, 2750 Encoding encoding,
2751 bool plusToSpace) { 2751 bool plusToSpace) {
2752 assert(0 <= start); 2752 assert(0 <= start);
2753 assert(start <= end); 2753 assert(start <= end);
2754 assert(end <= text.length); 2754 assert(end <= text.length);
2755 assert(encoding != null); 2755 assert(encoding != null);
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
4506 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; 4506 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3;
4507 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; 4507 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/;
4508 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; 4508 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/;
4509 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; 4509 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/;
4510 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; 4510 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/;
4511 return delta; 4511 return delta;
4512 } 4512 }
4513 4513
4514 /// Helper function returning the length of a string, or `0` for `null`. 4514 /// Helper function returning the length of a string, or `0` for `null`.
4515 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; 4515 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length;
OLDNEW
« no previous file with comments | « sdk/lib/core/symbol.dart ('k') | sdk/lib/html/html_common/conversions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698