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

Side by Side Diff: pkg/path/lib/src/internal_style.dart

Issue 439223002: Add InternalStyle:rootLength to implement isAbsolute and rootPrefix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 path.internal_style; 5 library path.internal_style;
6 6
7 import 'context.dart'; 7 import 'context.dart';
8 import 'style.dart'; 8 import 'style.dart';
9 9
10 /// The internal interface for the [Style] type. 10 /// The internal interface for the [Style] type.
(...skipping 15 matching lines...) Expand all
26 26
27 /// Returns whether this path component needs a separator after it. 27 /// Returns whether this path component needs a separator after it.
28 /// 28 ///
29 /// Windows and POSIX styles just need separators when the previous component 29 /// Windows and POSIX styles just need separators when the previous component
30 /// doesn't already end in a separator, but the URL always needs to place a 30 /// doesn't already end in a separator, but the URL always needs to place a
31 /// separator between the root and the first component, even if the root 31 /// separator between the root and the first component, even if the root
32 /// already ends in a separator character. For example, to join "file://" and 32 /// already ends in a separator character. For example, to join "file://" and
33 /// "usr", an additional "/" is needed (making "file:///usr"). 33 /// "usr", an additional "/" is needed (making "file:///usr").
34 bool needsSeparator(String path); 34 bool needsSeparator(String path);
35 35
36 /// Returns the offset of the root part. Returns 0 if the path is relative.
Bob Nystrom 2014/08/04 17:17:32 "Returns the offset" -> "The number of characters"
nweiz 2014/08/04 20:11:57 The style guide says the first sentence of doc com
Anders Johnsen 2014/08/05 08:57:13 Done.
Anders Johnsen 2014/08/05 08:57:13 Done.
37 int rootLength(String path);
38
36 /// Gets the root prefix of [path] if path is absolute. If [path] is relative, 39 /// Gets the root prefix of [path] if path is absolute. If [path] is relative,
37 /// returns `null`. 40 /// returns `null`.
38 String getRoot(String path); 41 String getRoot(String path);
39 42
40 /// Gets the root prefix of [path] if it's root-relative. 43 /// Gets the root prefix of [path] if it's root-relative.
41 /// 44 ///
42 /// If [path] is relative or absolute and not root-relative, returns `null`. 45 /// If [path] is relative or absolute and not root-relative, returns `null`.
43 String getRelativeRoot(String path); 46 String getRelativeRoot(String path);
44 47
45 /// Returns the path represented by [uri] in this style. 48 /// Returns the path represented by [uri] in this style.
46 String pathFromUri(Uri uri); 49 String pathFromUri(Uri uri);
47 50
48 /// Returns the URI that represents the relative path made of [parts]. 51 /// Returns the URI that represents the relative path made of [parts].
49 Uri relativePathToUri(String path) => 52 Uri relativePathToUri(String path) =>
50 new Uri(pathSegments: context.split(path)); 53 new Uri(pathSegments: context.split(path));
51 54
52 /// Returns the URI that represents [path], which is assumed to be absolute. 55 /// Returns the URI that represents [path], which is assumed to be absolute.
53 Uri absolutePathToUri(String path); 56 Uri absolutePathToUri(String path);
54 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698