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

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

Issue 12794002: Move Options to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/corelib_sources.gypi ('k') | sdk/lib/io/io.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart.core;
6
7 /**
8 * The Options object allows accessing the arguments which have been passed to
9 * the current isolate.
10 */
11 abstract class Options {
12 /**
13 * A newly constructed Options object contains the arguments exactly as they
14 * have been passed to the isolate.
15 */
16 factory Options() => new _OptionsImpl();
17
18 /**
19 * Returns a list of arguments that have been passed to this isolate. Any
20 * modifications to the list will be contained to the options object owning
21 * this list.
22 *
23 * If the execution environment does not support [arguments] an empty list
24 * is returned.
25 */
26 List<String> get arguments;
27
28 /**
29 * Returns the path of the executable used to run the script in this
30 * isolate.
31 *
32 * If the execution environment does not support [executable] an empty
33 * string is returned.
34 */
35 String get executable;
36
37 /**
38 * Returns the path of the script being run in this isolate.
39 *
40 * If the executable environment does not support [script] an empty
41 * string is returned.
42 */
43 String get script;
44 }
45
46 class _OptionsImpl implements Options {
47 List<String> get arguments {
48 if (_arguments == null) {
49 // On first access make a copy of the native arguments.
50 _arguments = _nativeArguments.getRange(0, _nativeArguments.length);
51 }
52 return _arguments;
53 }
54
55 String get executable {
56 return _nativeExecutable;
57 }
58
59 String get script {
60 return _nativeScript;
61 }
62
63 List<String> _arguments = null;
64
65 // This arguments singleton is written to by the embedder if applicable.
66 static List<String> _nativeArguments = const [];
67
68 // This executable singleton is written to by the embedder if applicable.
69 static String _nativeExecutable = '';
70
71 // This script singleton is written to by the embedder if applicable.
72 static String _nativeScript = '';
73 }
OLDNEW
« no previous file with comments | « sdk/lib/core/corelib_sources.gypi ('k') | sdk/lib/io/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698