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 /** | 5 /** |
6 * A Path, which is a String interpreted as a sequence of path segments, | 6 * A Path, which is a String interpreted as a sequence of path segments, |
7 * which are strings, separated by forward slashes. | 7 * which are strings, separated by forward slashes. |
8 * Paths are immutable wrappers of a String, that offer member functions for | 8 * Paths are immutable wrappers of a String, that offer member functions for |
9 * useful path manipulations and queries. Joining of paths and normalization | 9 * useful path manipulations and queries. Joining of paths and normalization |
10 * interpret '.' and '..' in the usual way. | 10 * interpret '.' and '..' in the usual way. |
11 */ | 11 */ |
12 interface Path extends Hashable default _Path { | 12 abstract class Path extends Hashable { |
13 /** | 13 /** |
14 * Creates a Path from the String [source]. [source] is used as-is, so if | 14 * Creates a Path from the String [source]. [source] is used as-is, so if |
15 * the string does not consist of segments separated by forward slashes, the | 15 * the string does not consist of segments separated by forward slashes, the |
16 * behavior may not be as expected. Paths are immutable, and constant | 16 * behavior may not be as expected. Paths are immutable. |
17 * Path objects may be constructed from constant Strings. | |
18 */ | 17 */ |
19 const Path(String source); | 18 factory Path(String source) => new _Path(source); |
20 | 19 |
21 /** | 20 /** |
22 * Creates a Path from a String that uses the native filesystem's conventions. | 21 * Creates a Path from a String that uses the native filesystem's conventions. |
23 * On Windows, this converts '\' to '/', and adds a '/' before a drive letter. | 22 * On Windows, this converts '\' to '/', and adds a '/' before a drive letter. |
24 * A path starting with '/c:/' (or any other character instead of 'c') is | 23 * A path starting with '/c:/' (or any other character instead of 'c') is |
25 * treated specially. Backwards links ('..') cannot cancel the drive letter. | 24 * treated specially. Backwards links ('..') cannot cancel the drive letter. |
26 */ | 25 */ |
27 Path.fromNative(String source); | 26 factory Path.fromNative(String source) => new _Path.fromNative(source); |
28 | 27 |
29 /** | 28 /** |
30 * Is this path the empty string? | 29 * Is this path the empty string? |
31 */ | 30 */ |
32 bool get isEmpty; | 31 bool get isEmpty; |
33 | 32 |
34 /** | 33 /** |
35 * Is this path an absolute path, beginning with a path separator? | 34 * Is this path an absolute path, beginning with a path separator? |
36 */ | 35 */ |
37 bool get isAbsolute; | 36 bool get isAbsolute; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 165 |
167 /** | 166 /** |
168 * The part of [filename] after the last '.', or '' if [filename] | 167 * The part of [filename] after the last '.', or '' if [filename] |
169 * contains no '.'. If [filename] is '.' or '..', returns ''. | 168 * contains no '.'. If [filename] is '.' or '..', returns ''. |
170 * | 169 * |
171 * new Path('tiger.svg').extension == 'svg' | 170 * new Path('tiger.svg').extension == 'svg' |
172 * new Path('/src/dart/dart_secrets').extension == '' | 171 * new Path('/src/dart/dart_secrets').extension == '' |
173 */ | 172 */ |
174 String get extension; | 173 String get extension; |
175 } | 174 } |
OLD | NEW |