Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 /** | 7 /** |
| 8 * A parsed URI, such as a URL. | 8 * A parsed URI, such as a URL. |
| 9 * | 9 * |
| 10 * **See also:** | 10 * **See also:** |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 * | 481 * |
| 482 * The query component is set through either [query] or | 482 * The query component is set through either [query] or |
| 483 * [queryParameters]. When [query] is used the provided string should | 483 * [queryParameters]. When [query] is used the provided string should |
| 484 * be a valid URI query, but invalid characters other than general delimiters, | 484 * be a valid URI query, but invalid characters other than general delimiters, |
| 485 * will be escaped if necessary. | 485 * will be escaped if necessary. |
| 486 * When [queryParameters] is used the query is built from the | 486 * When [queryParameters] is used the query is built from the |
| 487 * provided map. Each key and value in the map is percent-encoded | 487 * provided map. Each key and value in the map is percent-encoded |
| 488 * and joined using equal and ampersand characters. The | 488 * and joined using equal and ampersand characters. The |
| 489 * percent-encoding of the keys and values encodes all characters | 489 * percent-encoding of the keys and values encodes all characters |
| 490 * except for the unreserved characters. | 490 * except for the unreserved characters. |
| 491 * If `query` is the empty string, it is equivalent to omitting it. | |
| 492 * To have an actual empty query part, | |
| 493 * use an empty list for `queryParameters`. | |
| 491 * If both `query` and `queryParameters` are omitted or `null`, the | 494 * If both `query` and `queryParameters` are omitted or `null`, the |
| 492 * URI will have no query part. | 495 * URI will have no query part. |
| 493 * | 496 * |
| 494 * The fragment component is set through [fragment]. | 497 * The fragment component is set through [fragment]. |
| 495 * It should be a valid URI fragment, but invalid characters other than | 498 * It should be a valid URI fragment, but invalid characters other than |
| 496 * general delimiters, will be escaped if necessary. | 499 * general delimiters, will be escaped if necessary. |
| 497 * If `fragment` is omitted or `null`, the URI will have no fragment part. | 500 * If `fragment` is omitted or `null`, the URI will have no fragment part. |
| 498 */ | 501 */ |
| 499 factory Uri({String scheme : "", | 502 factory Uri({String scheme : "", |
| 500 String userInfo : "", | 503 String userInfo : "", |
| 501 String host, | 504 String host, |
| 502 int port, | 505 int port, |
| 503 String path, | 506 String path, |
| 504 Iterable<String> pathSegments, | 507 Iterable<String> pathSegments, |
| 505 String query, | 508 String query, |
| 506 Map<String, String> queryParameters, | 509 Map<String, String> queryParameters, |
| 507 fragment}) { | 510 fragment}) { |
| 508 scheme = _makeScheme(scheme, _stringOrNullLength(scheme)); | 511 scheme = _makeScheme(scheme, _stringOrNullLength(scheme)); |
| 509 userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo)); | 512 userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo)); |
| 510 host = _makeHost(host, 0, _stringOrNullLength(host), false); | 513 host = _makeHost(host, 0, _stringOrNullLength(host), false); |
| 514 // Special case this constructor for backwards compatibility. | |
|
Anders Johnsen
2014/06/26 11:04:32
TODO for deprecating this behavior in 2.0?
Lasse Reichstein Nielsen
2014/06/26 11:14:04
I'll put it on my list, but we are not putting 2.0
| |
| 515 if (query == "") query = null; | |
| 511 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters); | 516 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters); |
| 512 fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment)); | 517 fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment)); |
| 513 port = _makePort(port, scheme); | 518 port = _makePort(port, scheme); |
| 514 bool isFile = (scheme == "file"); | 519 bool isFile = (scheme == "file"); |
| 515 if (host == null && | 520 if (host == null && |
| 516 (userInfo.isNotEmpty || port != null || isFile)) { | 521 (userInfo.isNotEmpty || port != null || isFile)) { |
| 517 host = ""; | 522 host = ""; |
| 518 } | 523 } |
| 519 bool ensureLeadingSlash = (host != null || isFile); | 524 bool ensureLeadingSlash = (host != null || isFile); |
| 520 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, | 525 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2274 0xafff, // 0x30 - 0x3f 1111111111110101 | 2279 0xafff, // 0x30 - 0x3f 1111111111110101 |
| 2275 // @ABCDEFGHIJKLMNO | 2280 // @ABCDEFGHIJKLMNO |
| 2276 0xffff, // 0x40 - 0x4f 1111111111111111 | 2281 0xffff, // 0x40 - 0x4f 1111111111111111 |
| 2277 // PQRSTUVWXYZ _ | 2282 // PQRSTUVWXYZ _ |
| 2278 0x87ff, // 0x50 - 0x5f 1111111111100001 | 2283 0x87ff, // 0x50 - 0x5f 1111111111100001 |
| 2279 // abcdefghijklmno | 2284 // abcdefghijklmno |
| 2280 0xfffe, // 0x60 - 0x6f 0111111111111111 | 2285 0xfffe, // 0x60 - 0x6f 0111111111111111 |
| 2281 // pqrstuvwxyz ~ | 2286 // pqrstuvwxyz ~ |
| 2282 0x47ff]; // 0x70 - 0x7f 1111111111100010 | 2287 0x47ff]; // 0x70 - 0x7f 1111111111100010 |
| 2283 } | 2288 } |
| OLD | NEW |