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

Side by Side Diff: sdk/lib/io/platform_impl.dart

Issue 17406010: Move getters from Options to Platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
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.io; 5 part of dart.io;
6 6
7 class _Platform { 7 class _Platform {
8 external static int _numberOfProcessors(); 8 external static int _numberOfProcessors();
9 external static String _pathSeparator(); 9 external static String _pathSeparator();
10 external static String _operatingSystem(); 10 external static String _operatingSystem();
11 external static _localHostname(); 11 external static _localHostname();
12 external static _environment(); 12 external static _environment();
13 external static String _version();
13 14
14 static int get numberOfProcessors { 15 static int get numberOfProcessors => _numberOfProcessors();
15 return _numberOfProcessors(); 16 static String get pathSeparator => _pathSeparator();
16 } 17 static String get operatingSystem => _operatingSystem();
17
18 static String get pathSeparator {
19 return _pathSeparator();
20 }
21
22 static String get operatingSystem {
23 return _operatingSystem();
24 }
25 18
26 static String get localHostname { 19 static String get localHostname {
27 var result = _localHostname(); 20 var result = _localHostname();
28 if (result is OSError) { 21 if (result is OSError) {
29 throw result; 22 throw result;
30 } else { 23 } else {
31 return result; 24 return result;
32 } 25 }
33 } 26 }
34 27
(...skipping 15 matching lines...) Expand all
50 var equalsIndex = str.indexOf('='); 43 var equalsIndex = str.indexOf('=');
51 if (equalsIndex == 0) { 44 if (equalsIndex == 0) {
52 equalsIndex = str.indexOf('=', 1); 45 equalsIndex = str.indexOf('=', 1);
53 } 46 }
54 assert(equalsIndex != -1); 47 assert(equalsIndex != -1);
55 result[str.substring(0, equalsIndex)] = str.substring(equalsIndex + 1); 48 result[str.substring(0, equalsIndex)] = str.substring(equalsIndex + 1);
56 } 49 }
57 return result; 50 return result;
58 } 51 }
59 } 52 }
53
54 static String get version => _version();
60 } 55 }
61 56
62 // Environment variables are case-insensitive on Windows. In order 57 // Environment variables are case-insensitive on Windows. In order
63 // to reflect that we use a case-insensitive string map on Windows. 58 // to reflect that we use a case-insensitive string map on Windows.
64 class _CaseInsensitiveStringMap<V> implements Map<String, V> { 59 class _CaseInsensitiveStringMap<V> implements Map<String, V> {
65 _CaseInsensitiveStringMap() : _map = new Map<String, V>(); 60 _CaseInsensitiveStringMap() : _map = new Map<String, V>();
66 61
67 _CaseInsensitiveStringMap.from(Map<String, V> other) 62 _CaseInsensitiveStringMap.from(Map<String, V> other)
68 : _map = new Map<String, V>() { 63 : _map = new Map<String, V>() {
69 other.forEach((String key, V value) { 64 other.forEach((String key, V value) {
(...skipping 17 matching lines...) Expand all
87 void clear() => _map.clear(); 82 void clear() => _map.clear();
88 void forEach(void f(String key, V value)) => _map.forEach(f); 83 void forEach(void f(String key, V value)) => _map.forEach(f);
89 Iterable<String> get keys => _map.keys; 84 Iterable<String> get keys => _map.keys;
90 Iterable<V> get values => _map.values; 85 Iterable<V> get values => _map.values;
91 int get length => _map.length; 86 int get length => _map.length;
92 bool get isEmpty => _map.isEmpty; 87 bool get isEmpty => _map.isEmpty;
93 bool get isNotEmpty => _map.isNotEmpty; 88 bool get isNotEmpty => _map.isNotEmpty;
94 89
95 Map<String, V> _map; 90 Map<String, V> _map;
96 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698