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 #library('dart:uri'); | 5 #library('dart:uri'); |
6 | 6 |
7 #import('dart:math'); | 7 #import('dart:math'); |
8 #import('dart:utf'); | 8 #import('dart:utf'); |
9 | 9 |
10 #source('encode_decode.dart'); | 10 #source('encode_decode.dart'); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 this.path: "", | 42 this.path: "", |
43 this.query: "", | 43 this.query: "", |
44 this.fragment: ""}); | 44 this.fragment: ""}); |
45 | 45 |
46 Uri(String uri) : this.fromString(uri); | 46 Uri(String uri) : this.fromString(uri); |
47 | 47 |
48 static String _emptyIfNull(String val) => val != null ? val : ''; | 48 static String _emptyIfNull(String val) => val != null ? val : ''; |
49 | 49 |
50 static int _parseIntOrZero(String val) { | 50 static int _parseIntOrZero(String val) { |
51 if (val !== null && val != '') { | 51 if (val !== null && val != '') { |
52 return parseInt(val); | 52 return int.parse(val); |
53 } else { | 53 } else { |
54 return 0; | 54 return 0; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 // NOTE: This code was ported from: closure-library/closure/goog/uri/utils.js | 58 // NOTE: This code was ported from: closure-library/closure/goog/uri/utils.js |
59 static const RegExp _splitRe = const RegExp( | 59 static const RegExp _splitRe = const RegExp( |
60 '^' | 60 '^' |
61 '(?:' | 61 '(?:' |
62 '([^:/?#.]+)' // scheme - ignore special characters | 62 '([^:/?#.]+)' // scheme - ignore special characters |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 static void _addIfNonEmpty(StringBuffer sb, String test, | 232 static void _addIfNonEmpty(StringBuffer sb, String test, |
233 String first, String second) { | 233 String first, String second) { |
234 if ("" != test) { | 234 if ("" != test) { |
235 sb.add(first === null ? "null" : first); | 235 sb.add(first === null ? "null" : first); |
236 sb.add(second === null ? "null" : second); | 236 sb.add(second === null ? "null" : second); |
237 } | 237 } |
238 } | 238 } |
239 } | 239 } |
OLD | NEW |