Found 1005364 results in 96509 files, showing top 150 files (show more).
github.com/google/gapid:gapis/service/path/path.proto: [ master, ]
21: package path;
28:   oneof path {
66:     StateTreeNodeForPath state_tree_node_for_path = 38;
493: message StateTreeNodeForPath {
22: option java_package = "com.google.gapid.proto.service.path";
23: option java_outer_classname = "Path";
24: option go_package = "github.com/google/gapid/gapis/service/path";
26: // Any is a oneof union of all the path types.
78: // ArrayIndex is path to a element in an array or slice.
91: // API is a path to an API.
113: // Blob is a path to a blob of data.
119: // Capture is a path to a capture.
127: // Command is the path to a command in the capture.
136: // Commands is a path to a list of commands in a capture.
148: // ConstantSet is a path to an enumerator of constants.
155: // Events is a path to a list of events in a capture.
174: // Parameter is the path to a single parameter on a command.
180: // Type is the path to a type used in an API.
186: // Result is the path to the result value of a command.
191: // Threads is path to a list of threads in a capture.
196: // Thread is a path to a single thread in a capture.
202: // Messages is path to a list of messages stored in the capture
207: // Contexts is path to a list of contexts in a capture.
212: // Context is a path to a single context in a capture.
218: // Device is a path to a device used for replay.
223: // DeviceTraceConfiguration is a path to the tracing config for a device
228: // FramebufferObservation is a path to a framebuffer observation image at the
234: // Field is a path to a field in a struct.
256: // CommandTree is a path to a hierarchy of command tree nodes.
293: // CommandTreeNode is a path to a command tree node.
302: // CommandTreeNodeForCommand is a path to a command tree node, resolved from a
303: // Command path and a CommandTree identifier. It is used to locate the
305: // Resolves to a path.CommandTreeNode.
309:   // The command path.
313: // ImageInfo is a path that refers to a image.Info.
318: // MapIndex is a path to a value held inside a map.
333: // Memory is a path to a region of memory.
354: // MemoryAsType is a path to a particular piece of memory
369: // Mesh is a path to a mesh representation of an object.
378: // MeshOptions provides parameters for the mesh returned by a Mesh path resolve.
411: // Report is a path to a list of report items for a capture.
414:   // The optional path to the device used to generate replay information.
422: // Resources is a path to a list of resources used in a capture.
427: // ResourceData is a path to a single resource snapshot at a given point in an
434: // MultiResourceData is a path to a set of resource snapshots at a given point
441: // Slice is a path to a subslice of a slice or array.
454: // State is a path to a subset of the GlobalState at a point in a capture.
461: // GlobalState is an path node to the absolute global state after a specfied
465:   path.Command after = 1;
468: // StateTree is a path to a hierarchy of state tree nodes.
480: // StateTreeNode is a path to a state tree node.
489: // StateTreeNodeForPath is a path to a state tree node, resolved from another
490: // path. It is used to locate the relevant StateTreeNode for a path to a state
492: // Resolves to a path.StateTreeNode.
496:   // The path to the state member to look for.
511: // Thumbnail is a path to a thumbnail image representing the object.
533:   path.Device replay_device = 1;
462: // command. GlobalStates are used where stable paths are required, such as
532:   // The device to use for any replays when resolving paths.
github.com/google/gapid:gapis/service/path/path.go: [ master, ]
15: package path
45: 	Path() *Any
60: func (n *API) Path() *Any                       { return &Any{Path: &Any_API{n}} }
61: func (n *ArrayIndex) Path() *Any                { return &Any{Path: &Any_ArrayIndex{n}} }
62: func (n *As) Path() *Any                        { return &Any{Path: &Any_As{n}} }
63: func (n *Blob) Path() *Any                      { return &Any{Path: &Any_Blob{n}} }
64: func (n *Capture) Path() *Any                   { return &Any{Path: &Any_Capture{n}} }
65: func (n *ConstantSet) Path() *Any               { return &Any{Path: &Any_ConstantSet{n}} }
66: func (n *Command) Path() *Any                   { return &Any{Path: &Any_Command{n}} }
67: func (n *Commands) Path() *Any                  { return &Any{Path: &Any_Commands{n}} }
68: func (n *CommandTree) Path() *Any               { return &Any{Path: &Any_CommandTree{n}} }
69: func (n *CommandTreeNode) Path() *Any           { return &Any{Path: &Any_CommandTreeNode{n}} }
70: func (n *CommandTreeNodeForCommand) Path() *Any { return &Any{Path: &Any_CommandTreeNodeForCommand{n}} }
71: func (n *Context) Path() *Any                   { return &Any{Path: &Any_Context{n}} }
72: func (n *Contexts) Path() *Any                  { return &Any{Path: &Any_Contexts{n}} }
73: func (n *Device) Path() *Any                    { return &Any{Path: &Any_Device{n}} }
74: func (n *DeviceTraceConfiguration) Path() *Any  { return &Any{Path: &Any_TraceConfig{n}} }
75: func (n *Events) Path() *Any                    { return &Any{Path: &Any_Events{n}} }
76: func (n *FramebufferObservation) Path() *Any    { return &Any{Path: &Any_FBO{n}} }
77: func (n *Field) Path() *Any                     { return &Any{Path: &Any_Field{n}} }
78: func (n *GlobalState) Path() *Any               { return &Any{Path: &Any_GlobalState{n}} }
79: func (n *ImageInfo) Path() *Any                 { return &Any{Path: &Any_ImageInfo{n}} }
80: func (n *MapIndex) Path() *Any                  { return &Any{Path: &Any_MapIndex{n}} }
81: func (n *Memory) Path() *Any                    { return &Any{Path: &Any_Memory{n}} }
82: func (n *MemoryAsType) Path() *Any              { return &Any{Path: &Any_MemoryAsType{n}} }
83: func (n *Mesh) Path() *Any                      { return &Any{Path: &Any_Mesh{n}} }
84: func (n *Metrics) Path() *Any                   { return &Any{Path: &Any_Metrics{n}} }
85: func (n *Parameter) Path() *Any                 { return &Any{Path: &Any_Parameter{n}} }
86: func (n *Pipelines) Path() *Any                 { return &Any{Path: &Any_Pipelines{n}} }
87: func (n *Report) Path() *Any                    { return &Any{Path: &Any_Report{n}} }
88: func (n *ResourceData) Path() *Any              { return &Any{Path: &Any_ResourceData{n}} }
89: func (n *Messages) Path() *Any                  { return &Any{Path: &Any_Messages{n}} }
90: func (n *MultiResourceData) Path() *Any         { return &Any{Path: &Any_MultiResourceData{n}} }
91: func (n *Resources) Path() *Any                 { return &Any{Path: &Any_Resources{n}} }
92: func (n *Result) Path() *Any                    { return &Any{Path: &Any_Result{n}} }
93: func (n *Slice) Path() *Any                     { return &Any{Path: &Any_Slice{n}} }
94: func (n *State) Path() *Any                     { return &Any{Path: &Any_State{n}} }
95: func (n *StateTree) Path() *Any                 { return &Any{Path: &Any_StateTree{n}} }
96: func (n *StateTreeNode) Path() *Any             { return &Any{Path: &Any_StateTreeNode{n}} }
98: func (n *Stats) Path() *Any                     { return &Any{Path: &Any_Stats{n}} }
99: func (n *Thumbnail) Path() *Any                 { return &Any{Path: &Any_Thumbnail{n}} }
100: func (n *Type) Path() *Any                      { return &Any{Path: &Any_Type{n}} }
97: func (n *StateTreeNodeForPath) Path() *Any      { return &Any{Path: &Any_StateTreeNodeForPath{n}} }
33: // command list, single command, memory, state or sub-object. A path can be
37: 	// Parent returns the path that this path derives from.
38: 	// If this path is a root, then Base returns nil.
41: 	// SetParent sets the path that this derives from.
44: 	// Path returns this path node as a path.
47: 	// Validate checks the path for correctness, returning an error if any
179: // Format implements fmt.Formatter to print the path.
184: // Format implements fmt.Formatter to print the path.
187: // Format implements fmt.Formatter to print the path.
192: // Format implements fmt.Formatter to print the path.
195: // Format implements fmt.Formatter to print the path.
198: // Format implements fmt.Formatter to print the path.
203: // Format implements fmt.Formatter to print the path.
208: // Format implements fmt.Formatter to print the path.
213: // Format implements fmt.Formatter to print the path.
216: // Format implements fmt.Formatter to print the path.
221: // Format implements fmt.Formatter to print the path.
226: // Format implements fmt.Formatter to print the path.
229: // Format implements fmt.Formatter to print the path.
232: // Format implements fmt.Formatter to print the path.
235: // Format implements fmt.Formatter to print the path.
238: // Format implements fmt.Formatter to print the path.
241: // Format implements fmt.Formatter to print the path.
244: // Format implements fmt.Formatter to print the path.
247: // Format implements fmt.Formatter to print the path.
250: // Format implements fmt.Formatter to print the path.
253: // Format implements fmt.Formatter to print the path
258: // Format implements fmt.Formatter to print the message path.
261: // Format implements fmt.Formatter to print the path.
264: // Format implements fmt.Formatter to print the path.
267: // Format implements fmt.Formatter to print the path.
270: // Format implements fmt.Formatter to print the path.
275: // Format implements fmt.Formatter to print the path.
280: // Format implements fmt.Formatter to print the path.
283: // Format implements fmt.Formatter to print the path.
286: // Format implements fmt.Formatter to print the path.
289: // Format implements fmt.Formatter to print the path.
294: // Format implements fmt.Formatter to print the path.
299: // Format implements fmt.Formatter to print the path.
302: // Format implements fmt.Formatter to print the path.
307: // Format implements fmt.Formatter to print the path.
312: // Format implements fmt.Formatter to print the path.
315: // Format implements fmt.Formatter to print the path.
459: // Node returns the path node for p.
460: func (p *Any) Node() Node { return oneOfNode(p.Path) }
462: // Format implements fmt.Formatter to print the path.
467: // FindCommand traverses the path nodes looking for a Command path node.
468: // If no Command path node was found then nil is returned.
479: // FindCapture traverses the path nodes looking for a Capture path node.
480: // If no Capture path node was found then nil is returned.
491: // NewAPI returns a new API path node with the given ID.
496: // NewCapture returns a new Capture path node with the given ID.
501: // NewDevice returns a new Device path node with the given ID.
506: // NewBlob returns a new Blob path node with the given ID.
511: // NewImageInfo returns a new ImageInfo path node with the given ID.
516: // NewField returns a new Field path.
523: // NewArrayIndex returns a new ArrayIndex path.
530: // NewMapIndex returns a new MapIndex path.
540: // NewSlice returns a new Slice path.
547: // ConstantSet returns a path to the API's i'th ConstantSet.
555: // Resources returns the path node to the capture's resources.
560: // Report returns the path node to the capture's report.
565: // Contexts returns the path node to the capture's contexts.
570: // Messages returns the path node to the capture's messages.
575: // Commands returns the path node to the capture's commands.
584: // CommandRange returns the path node to a range of the capture's commands.
593: // SubCommandRange returns the path node to a range of the capture's subcommands
602: // CommandTree returns the path to the root node of a capture's command tree
608: // Child returns the path to the i'th child of the CommandTreeNode.
616: // Command returns the path node to a single command in the capture.
622: // Context returns the path node to the a context with the given ID.
627: // Thread returns the path node to the thread with the given ID.
632: // MemoryAfter returns the path node to the memory after this command.
637: // ResourceAfter returns the path node to the resource with the given identifier
646: // ResourcesAfter returns the path node to the resources with the given
655: // FramebufferObservation returns the path node to framebuffer observation
661: // Mesh returns the path node to the mesh of this command.
689: // GlobalStateAfter returns the path node to the state after this command.
694: // StateAfter returns the path node to the state after this command.
699: // First returns the path to the first command.
704: // Last returns the path to the last command.
709: // Index returns the path to the i'th child of the StateTreeNode.
717: // Parameter returns the path node to the parameter with the given name.
722: // Result returns the path node to the command's result.
727: // Tree returns the path node to the state tree for this state.
139: func (n StateTreeNodeForPath) Parent() Node      { return nil }
175: func (n *StateTreeNodeForPath) SetParent(p Node)      {}
308: func (n StateTreeNodeForPath) Format(f fmt.State, c rune) {
794: // ShallowEqual returns true if paths a and b are equal (ignoring parents).
android.googlesource.com/platform/external/python/parse_type:tasks/_vendor/pathlib.py: [ master, ]
928: class Path(PurePath):
210:     def _split_extended_path(self, s, ext_prefix=ext_namespace_prefix):
134:     pathmod = ntpath
253:     pathmod = posixpath
565: class PurePath(object):
844:     def joinpath(self, *args):
915: class PurePosixPath(PurePath):
920: class PureWindowsPath(PurePath):
952:     def _make_child_relpath(self, part):
1275: class PosixPath(Path, PurePosixPath):
1278: class WindowsPath(Path, PureWindowsPath):
537: class _PathParents(Sequence):
40:         _getfinalpathname = None
45:     "Path", "PosixPath", "WindowsPath",
67:     """A flavour implements a particular (platform-specific) set of path
119:                 # Same drive => second path is relative to the first
122:             # Second path is non-anchored (common case)
162:             prefix, part = self._split_extended_path(part)
169:             # is a UNC path:
176:                 # a UNC path can't have two slashes in a row
201:     def resolve(self, path):
202:         s = str(path)
221:         # Turn back an extended path into a normal DOS-like path
222:         return self._split_extended_path(s)[1]
236:     def make_uri(self, path):
238:         drive = path.drive
240:             # It's a path on a local drive => 'file:///c:/a/b'
241:             rest = path.as_posix()[2:].lstrip('/')
245:             # It's a path on a network drive => 'file://host/share/a/b'
246:             return 'file:' + urlquote_from_bytes(path.as_posix().encode('utf-8'))
260:             # According to POSIX path resolution:
278:     def resolve(self, path):
280:         accessor = path._accessor
282:         def _resolve(path, rest):
284:                 path = ''
292:                     path, _, _ = path.rpartition(sep)
294:                 newpath = path + sep + name
296:                     # Already seen this path
297:                     path = seen[newpath]
298:                     if path is not None:
310:                     path = newpath
313:                     path = _resolve(path, target)
314:                     seen[newpath] = path # resolved symlink
316:             return path
317:         # NOTE: according to POSIX, getcwd() cannot contain path components
319:         base = '' if path.is_absolute() else os.getcwd()
320:         return _resolve(base, str(path)) or sep
325:     def make_uri(self, path):
326:         # We represent the path using the local filesystem encoding,
328:         bpath = bytes(path)
397:     def readlink(self, path):
398:         return os.readlink(path)
433:         raise ValueError("Invalid pattern: '**' can only be an entire path component")
446:     of a given path."""
455:     def select_from(self, parent_path):
456:         """Iterate over all child paths of `parent_path` matched by this
457:         selector.  This can contain parent_path itself."""
458:         path_cls = type(parent_path)
459:         is_dir = path_cls.is_dir
460:         exists = path_cls.exists
461:         listdir = parent_path._accessor.listdir
462:         return self._select_from(parent_path, is_dir, exists, listdir)
467:     def _select_from(self, parent_path, is_dir, exists, listdir):
468:         yield parent_path
477:     def _select_from(self, parent_path, is_dir, exists, listdir):
478:         if not is_dir(parent_path):
480:         path = parent_path._make_child_relpath(self.name)
481:         if exists(path):
482:             for p in self.successor._select_from(path, is_dir, exists, listdir):
492:     def _select_from(self, parent_path, is_dir, exists, listdir):
493:         if not is_dir(parent_path):
495:         cf = parent_path._flavour.casefold
496:         for name in listdir(parent_path):
499:                 path = parent_path._make_child_relpath(name)
500:                 for p in self.successor._select_from(path, is_dir, exists, listdir):
509:     def _iterate_directories(self, parent_path, is_dir, listdir):
510:         yield parent_path
511:         for name in listdir(parent_path):
512:             path = parent_path._make_child_relpath(name)
513:             if is_dir(path):
514:                 for p in self._iterate_directories(path, is_dir, listdir):
517:     def _select_from(self, parent_path, is_dir, exists, listdir):
518:         if not is_dir(parent_path):
524:                 for starting_point in self._iterate_directories(parent_path, is_dir, listdir):
539:     of a path.  Don't try to construct it yourself."""
542:     def __init__(self, path):
544:         self._pathcls = type(path)
545:         self._drv = path._drv
546:         self._root = path._root
547:         self._parts = path._parts
566:     """PurePath represents a filesystem path and offers operations which
579:         PurePath objects.  The strings and path objects are combined so as
580:         to yield a canonicalized path, which is incorporated into the
588:         # Using the parts tuple helps share interned path parts
604:                     "argument should be a path or str object, not %r"
639:         # Overriden in concrete Path
649:         """Return the string representation of the path, suitable for
659:         """Return the string representation of the path with forward (/)
665:         """Return the bytes representation of the path.  This is only
675:         """Return the path as a 'file' URI."""
677:             raise ValueError("relative path can't be expressed as a file URI")
725:                      doc="""The drive prefix (letter or UNC path), if any.""")
728:                     doc="""The root of the path, if any.""")
738:         """The final path component, if any."""
765:         """The final path component, minus its last suffix."""
774:         """Return a new path with the file name changed."""
781:         """Return a new path with the file suffix changed (or added, if none)."""
801:         """Return the relative path to another path identified by the passed
803:         a subpath of the other path), raise ValueError.
807:         #   Path('c:/').relative_to('c:')  gives Path('/')
808:         #   Path('c:/').relative_to('/')   raise ValueError
835:         components in the filesystem path."""
845:         """Combine this path with one or several arguments, and return a
846:         new path representing either a subpath (if all arguments are relative
847:         paths) or a totally different path (if one of the arguments is
864:         """The logical parent of the path."""
874:         """A sequence of this path's logical parents."""
878:         """True if the path is absolute (has both a root and, if applicable,
885:         """Return True if the path contains one of the special names reserved
889:     def match(self, path_pattern):
891:         Return True if this path matches the given pattern.
894:         path_pattern = cf(path_pattern)
895:         drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
934:         if cls is Path:
954:         # a single part relative to this path.
964:         Open the file pointed by this path and return a file descriptor,
973:         """Return a new path pointing to the current working directory
984:                 # Yielding a path object for these makes little sense
1013:         """Return an absolute version of this path.  This function works
1014:         even if the path doesn't point to anything.
1017:         Use resolve() to get the canonical path to a file.
1030:         Make the path absolute, resolving all symlinks on the way and also
1037:             # the path doesn't exist or is forbidden
1040:         # Now we have no symlinks in the path, it's safe to normalize it.
1048:         Return the result of the stat() system call on this path, like
1070:         Open the file pointed by this path and return a file object, as
1115:         Change the permissions of the path, like os.chmod().
1121:         Like chmod(), except if the path points to a symlink, the symlink's
1129:         If the path is a directory, use rmdir() instead.
1141:         Like stat(), except if the path points to a symlink, the symlink's
1148:         Rename this path to the given path.
1154:         Rename this path to the given path, clobbering the existing
1164:         Make this path a symlink pointing to the given path.
1173:         Whether this path exists.
1185:         Whether this path is a directory.
1192:             # Path doesn't exist or is a broken symlink
1198:         Whether this path is a regular file (also True for symlinks pointing
1206:             # Path doesn't exist or is a broken symlink
1212:         Whether this path is a symbolic link.
1219:             # Path doesn't exist
1224:         Whether this path is a block device.
1231:             # Path doesn't exist or is a broken symlink
1237:         Whether this path is a character device.
1244:             # Path doesn't exist or is a broken symlink
1250:         Whether this path is a FIFO.
1257:             # Path doesn't exist or is a broken symlink
1263:         Whether this path is a socket.
1270:             # Path doesn't exist or is a broken symlink
4: import ntpath
6: import posixpath
44:     "PurePath", "PurePosixPath", "PureWindowsPath",
111:         Join the two paths represented by the respective
128:     # Reference for Windows paths can be found at
150:     # Interesting findings about extended paths:
153:     # - extended paths are always absolute; "relative" extended paths will
160:             # XXX extended paths should also disable the collapsing of "."
227:         # We err on the side of caution and return True for paths which are
232:             # UNC paths are never reserved
262:             # "A pathname that begins with two successive slashes may be
295:                 if newpath in seen:
302:                     raise RuntimeError("Symlink loop from %r" % newpath)
305:                     target = accessor.readlink(newpath)
312:                     seen[newpath] = None # not resolved symlink
329:         return 'file://' + urlquote_from_bytes(bpath)
338:     accessing paths on the filesystem."""
345:         def wrapped(pathobj, *args):
346:             return strfunc(str(pathobj), *args)
351:         def wrapped(pathobjA, pathobjB, *args):
352:             return strfunc(str(pathobjA), str(pathobjB), *args)
368:         def lchmod(self, pathobj, mode):
540:     __slots__ = ('_pathcls', '_drv', '_root', '_parts')
558:         return self._pathcls._from_parsed_parts(self._drv, self._root,
562:         return "<{0}.parents>".format(self._pathcls.__name__)
568:     instantiating a PurePath will return either a PurePosixPath or a
569:     PureWindowsPath object.  You can also instantiate either of these classes
578:         """Construct a PurePath from one or several strings and or existing
581:         new PurePath object.
583:         if cls is PurePath:
584:             cls = PureWindowsPath if os.name == 'nt' else PurePosixPath
589:         # when pickling related paths.
598:             if isinstance(a, PurePath):
690:         if not isinstance(other, PurePath):
705:         if not isinstance(other, PurePath) or self._flavour is not other._flavour:
710:         if not isinstance(other, PurePath) or self._flavour is not other._flavour:
715:         if not isinstance(other, PurePath) or self._flavour is not other._flavour:
720:         if not isinstance(other, PurePath) or self._flavour is not other._flavour:
875:         return _PathParents(self)
935:             cls = WindowsPath if os.name == 'nt' else PosixPath
980:         result for the special paths '.' and '..'.
986:             yield self._make_child_relpath(name)
1041:         normed = self._flavour.pathmod.normpath(s)
1193:             # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
1207:             # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
1232:             # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
1245:             # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
1258:             # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
1271:             # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
37:         from nt import _getfinalpathname
205:         if _getfinalpathname is not None:
206:             return self._ext_to_normal(_getfinalpathname(s))
1023:         # use nt._getfullpathname())
github.com/apache/incubator-teaclave-sgx-sdk:sgx_tstd/src/path.rs: [ master, ]
551:     path: &'a [u8],
1629: impl ToOwned for Path {
1716: pub struct Path {
1729: impl Path {
2589: impl AsRef<OsStr> for Path {
2596: impl fmt::Debug for Path {
2623:     path: &'a Path,
2638: impl cmp::PartialEq for Path {
2645: impl Hash for Path {
2653: impl cmp::Eq for Path {}
2655: impl cmp::PartialOrd for Path {
2662: impl cmp::Ord for Path {
2669: impl AsRef<Path> for Path {
2727: impl<'a> IntoIterator for &'a Path {
642:     pub fn as_path(&self) -> &'a Path {
783:     pub fn as_path(&self) -> &'a Path {
1130:     pub fn as_path(&self) -> &Path {
1335:     pub fn into_boxed_path(self) -> Box<Path> {
1071: pub struct PathBuf {
1075: impl PathBuf {
1390: impl Clone for PathBuf {
1426: impl From<Box<Path>> for PathBuf {
1454: impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf {
1464: impl From<OsString> for PathBuf {
1484: impl From<String> for PathBuf {
1494: impl FromStr for PathBuf {
1503: impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
1511: impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
1522: impl fmt::Debug for PathBuf {
1528: impl ops::Deref for PathBuf {
1536: impl Borrow<Path> for PathBuf {
1543: impl Default for PathBuf {
1583: impl<'a> From<Cow<'a, Path>> for PathBuf {
1641: impl cmp::PartialEq for PathBuf {
1648: impl Hash for PathBuf {
1654: impl cmp::Eq for PathBuf {}
1656: impl cmp::PartialOrd for PathBuf {
1663: impl cmp::Ord for PathBuf {
1670: impl AsRef<OsStr> for PathBuf {
2711: impl AsRef<Path> for PathBuf {
2718: impl<'a> IntoIterator for &'a PathBuf {
1838:     pub fn to_path_buf(&self) -> PathBuf {
2582:     pub fn into_path_buf(self: Box<Path>) -> PathBuf {
18: //! Cross-platform path manipulation.
20: //! This module provides two types, [`PathBuf`] and [`Path`] (akin to [`String`]
23: //! on strings according to the local platform's path syntax.
26: //! returned by the [`components`] method on [`Path`]. [`Component`]s roughly
27: //! correspond to the substrings between path separators (`/` or `\`). You can
28: //! reconstruct an equivalent path from components with the [`push`] method on
34: //! Path manipulation includes both parsing components from slices and building
37: //! To parse a path, you can create a [`Path`] slice from a [`str`]
41: //! use std::path::Path;
44: //! let path = Path::new("/tmp/foo/bar.txt");
46: //! let parent = path.parent();
47: //! assert_eq!(parent, Some(Path::new("/tmp/foo")));
49: //! let file_stem = path.file_stem();
52: //! let extension = path.extension();
59: //! use std::path::PathBuf;
62: //! let mut path = PathBuf::from("c:\\");
64: //! path.push("windows");
65: //! path.push("system32");
67: //! path.set_extension("dll");
71: //! let path: PathBuf = ["c:\\", "windows", "system32.dll"].iter().collect();
74: //! [`components`]: Path::components
96: use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR};
112: /// Windows path prefixes, e.g., `C:` or `\\server\share`.
114: /// Windows uses a variety of path prefix styles, including references to drive
116: /// others. In addition, some path prefixes are "verbatim" (i.e., prefixed with
123: /// use std::path::{Component, Path, Prefix};
124: /// use std::path::Prefix::*;
127: /// fn get_path_prefix(s: &str) -> Prefix {
128: ///     let path = Path::new(s);
129: ///     match path.components().next().unwrap() {
197:     /// use std::path::Prefix::*;
228: /// Determines whether the character is one of the permitted path
234: /// use std::path;
236: /// assert!(path::is_separator('/')); // '/' works for both Unix and Windows
237: /// assert!(!path::is_separator('❤'));
243: /// The primary separator of path components for the current platform.
246: pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
295:     let path = if let Some(p) = prefix { &s[p.len()..] } else { s };
296:     !path.is_empty() && is_sep_byte(path[0])
343: /// front and back of the path each keep track of what parts of the path have
346: /// Going front to back, a path is made up of a prefix, a starting
356: /// A structure wrapping a Windows path prefix as well as its unparsed string
372: /// use std::path::{Component, Path, Prefix};
375: /// let path = Path::new(r"c:\you\later\");
376: /// match path.components().next().unwrap() {
442: /// A single component of a path.
444: /// A `Component` roughly corresponds to a substring between path separators
448: /// created by the [`components`](Path::components) method on [`Path`].
453: /// use std::path::{Component, Path};
455: /// let path = Path::new("/tmp/foo/bar.txt");
456: /// let components = path.components().collect::<Vec<_>>();
467:     /// A Windows path prefix, e.g., `C:` or `\\server\share`.
477:     /// It represents a separator that designates that a path starts from root.
499:     /// use std::path::Path;
501:     /// let path = Path::new("./tmp/foo/bar.txt");
502:     /// let components: Vec<_> = path.components().map(|comp| comp.as_os_str()).collect();
511:             Component::Normal(path) => path,
523: impl AsRef<Path> for Component<'_> {
525:     fn as_ref(&self) -> &Path {
530: /// An iterator over the [`Component`]s of a [`Path`].
532: /// This `struct` is created by the [`components`] method on [`Path`].
538: /// use std::path::Path;
540: /// let path = Path::new("/tmp/foo/bar.txt");
542: /// for component in path.components() {
547: /// [`components`]: Path::components
550:     // The path left to parse components from
556:     // true if path *physically* has a root separator; for most Windows
567: /// An iterator over the [`Component`]s of a [`Path`], as [`OsStr`] slices.
569: /// This `struct` is created by the [`iter`] method on [`Path`].
572: /// [`iter`]: Path::iter
580:         struct DebugHelper<'a>(&'a Path);
588:         f.debug_tuple("Components").field(&DebugHelper(self.as_path())).finish()
610:     // Given the iteration so far, how much of the pre-State::Body path is left?
629:     /// Extracts a slice corresponding to the portion of the path remaining for iteration.
634:     /// use std::path::Path;
636:     /// let mut components = Path::new("/tmp/foo/bar.txt").components();
640:     /// assert_eq!(Path::new("foo/bar.txt"), components.as_path());
650:         unsafe { Path::from_u8_slice(comps.path) }
653:     /// Is the *original* path rooted?
666:     /// Should the normalized path include a leading . ?
671:         let mut iter = self.path[self.prefix_len()..].iter();
679:     // parse a given byte sequence into the corresponding path component
684:             // the beginning of a path, which is treated
696:         let (extra, comp) = match self.path.iter().position(|b| self.is_sep_byte(*b)) {
697:             None => (0, self.path),
698:             Some(i) => (1, &self.path[..i]),
708:         let (extra, comp) = match self.path[start..].iter().rposition(|b| self.is_sep_byte(*b)) {
709:             None => (0, &self.path[start..]),
710:             Some(i) => (1, &self.path[start + i + 1..]),
717:         while !self.path.is_empty() {
722:                 self.path = &self.path[size..];
729:         while self.path.len() > self.len_before_body() {
734:                 self.path = &self.path[..self.path.len() - size];
740: impl AsRef<Path> for Components<'_> {
742:     fn as_ref(&self) -> &Path {
743:         self.as_path()
750:         self.as_path().as_os_str()
756:         struct DebugHelper<'a>(&'a Path);
764:         f.debug_tuple("Iter").field(&DebugHelper(self.as_path())).finish()
769:     /// Extracts a slice corresponding to the portion of the path remaining for iteration.
774:     /// use std::path::Path;
776:     /// let mut iter = Path::new("/tmp/foo/bar.txt").iter();
780:     /// assert_eq!(Path::new("foo/bar.txt"), iter.as_path());
784:         self.inner.as_path()
788: impl AsRef<Path> for Iter<'_> {
790:     fn as_ref(&self) -> &Path {
791:         self.as_path()
798:         self.as_path().as_os_str()
828:                     debug_assert!(self.prefix_len() <= self.path.len());
829:                     let raw = &self.path[..self.prefix_len()];
830:                     self.path = &self.path[self.prefix_len()..];
842:                         debug_assert!(!self.path.is_empty());
843:                         self.path = &self.path[1..];
850:                         debug_assert!(!self.path.is_empty());
851:                         self.path = &self.path[1..];
855:                 State::Body if !self.path.is_empty() => {
857:                     self.path = &self.path[size..];
876:                 State::Body if self.path.len() > self.len_before_body() => {
878:                     self.path = &self.path[..self.path.len() - size];
889:                         self.path = &self.path[..self.path.len() - 1];
896:                         self.path = &self.path[..self.path.len() - 1];
903:                         raw: unsafe { u8_slice_as_os_str(self.path) },
944:     // Fast path for long shared prefixes
949:     //   otherwise do it on the full path
951:     // The fast path isn't taken for paths with a PrefixComponent to avoid backtracking into
956:             match left.path.iter().zip(right.path.iter()).position(|(&a, &b)| a != b) {
957:                 None if left.path.len() == right.path.len() => return cmp::Ordering::Equal,
958:                 None => left.path.len().min(right.path.len()),
963:             left.path[..first_difference].iter().rposition(|&b| left.is_sep_byte(b))
966:             left.path = &left.path[mismatched_component_start..];
968:             right.path = &right.path[mismatched_component_start..];
976: /// An iterator over [`Path`] and its ancestors.
978: /// This `struct` is created by the [`ancestors`] method on [`Path`].
984: /// use std::path::Path;
986: /// let path = Path::new("/foo/bar");
988: /// for ancestor in path.ancestors() {
993: /// [`ancestors`]: Path::ancestors
996:     next: Option<&'a Path>,
1000:     type Item = &'a Path;
1005:         self.next = next.and_then(Path::parent);
1016: /// An owned, mutable path (akin to [`String`]).
1019: /// the path in place. It also implements [`Deref`] to [`Path`], meaning that
1020: /// all methods on [`Path`] slices are available on `PathBuf` values as well.
1034: /// use std::path::PathBuf;
1036: /// let mut path = PathBuf::new();
1038: /// path.push(r"C:\");
1039: /// path.push("windows");
1040: /// path.push("system32");
1042: /// path.set_extension("dll");
1049: /// use std::path::PathBuf;
1051: /// let path: PathBuf = [r"C:\", "windows", "system32.dll"].iter().collect();
1058: /// use std::path::PathBuf;
1060: /// let path = PathBuf::from(r"C:\windows\system32.dll");
1086:     /// use std::path::PathBuf;
1088:     /// let path = PathBuf::new();
1101:     /// use std::path::PathBuf;
1103:     /// let mut path = PathBuf::with_capacity(10);
1104:     /// let capacity = path.capacity();
1107:     /// path.push(r"C:\");
1109:     /// assert_eq!(capacity, path.capacity());
1118:     /// Coerces to a [`Path`] slice.
1123:     /// use std::path::{Path, PathBuf};
1126:     /// assert_eq!(Path::new("/test"), p.as_path());
1134:     /// Extends `self` with `path`.
1136:     /// If `path` is absolute, it replaces the current path.
1140:     /// * if `path` has a root but no prefix (e.g., `\windows`), it
1142:     /// * if `path` has a prefix but no root, it replaces `self`.
1146:     /// Pushing a relative path extends the existing path:
1149:     /// use std::path::PathBuf;
1151:     /// let mut path = PathBuf::from("/tmp");
1152:     /// path.push("file.bk");
1153:     /// assert_eq!(path, PathBuf::from("/tmp/file.bk"));
1156:     /// Pushing an absolute path replaces the existing path:
1159:     /// use std::path::PathBuf;
1161:     /// let mut path = PathBuf::from("/tmp");
1162:     /// path.push("/etc");
1163:     /// assert_eq!(path, PathBuf::from("/etc"));
1165:     pub fn push<P: AsRef<Path>>(&mut self, path: P) {
1166:         self._push(path.as_ref())
1169:     fn _push(&mut self, path: &Path) {
1177:                 && comps.prefix_len() == comps.path.len()
1184:         // absolute `path` replaces `self`
1185:         if path.is_absolute() || path.prefix().is_some() {
1188:         // `path` has a root but no prefix, e.g., `\windows` (Windows only)
1189:         } else if path.has_root() {
1193:         // `path` is a pure relative path
1198:         self.inner.push(path);
1206:     /// [`self.parent`]: Path::parent
1211:     /// use std::path::{Path, PathBuf};
1216:     /// assert_eq!(Path::new("/spirited"), p);
1218:     /// assert_eq!(Path::new("/"), p);
1236:     /// `file_name`. The new path will be a sibling of the original path.
1239:     /// [`self.file_name`]: Path::file_name
1245:     /// use std::path::PathBuf;
1275:     /// [`self.file_name`]: Path::file_name
1276:     /// [`self.extension`]: Path::extension
1281:     /// use std::path::{Path, PathBuf};
1286:     /// assert_eq!(Path::new("/feel/the.force"), p.as_path());
1289:     /// assert_eq!(Path::new("/feel/the.dark_side"), p.as_path());
1323:     /// use std::path::PathBuf;
1333:     /// Converts this `PathBuf` into a [boxed](Box) [`Path`].
1336:         let rw = Box::into_raw(self.inner.into_boxed_os_str()) as *mut Path;
1402: impl From<&Path> for Box<Path> {
1403:     /// Creates a boxed [`Path`] from a reference.
1405:     /// This will allocate and clone `path` to it.
1406:     fn from(path: &Path) -> Box<Path> {
1407:         let boxed: Box<OsStr> = path.inner.into();
1408:         let rw = Box::into_raw(boxed) as *mut Path;
1413: impl From<Cow<'_, Path>> for Box<Path> {
1414:     /// Creates a boxed [`Path`] from a clone-on-write pointer.
1418:     fn from(cow: Cow<'_, Path>) -> Box<Path> {
1420:             Cow::Borrowed(path) => Box::from(path),
1421:             Cow::Owned(path) => Box::from(path),
1427:     /// Converts a `Box<Path>` into a `PathBuf`
1431:     fn from(boxed: Box<Path>) -> PathBuf {
1432:         boxed.into_path_buf()
1436: impl From<PathBuf> for Box<Path> {
1437:     /// Converts a `PathBuf` into a `Box<Path>`
1442:     fn from(p: PathBuf) -> Box<Path> {
1443:         p.into_boxed_path()
1447: impl Clone for Box<Path> {
1450:         self.to_path_buf().into_boxed_path()
1479:     fn from(path_buf: PathBuf) -> OsString {
1480:         path_buf.inner
1529:     type Target = Path;
1531:     fn deref(&self) -> &Path {
1532:         Path::new(&self.inner)
1538:     fn borrow(&self) -> &Path {
1550: impl<'a> From<&'a Path> for Cow<'a, Path> {
1552:     /// [`Path`].
1556:     fn from(s: &'a Path) -> Cow<'a, Path> {
1561: impl<'a> From<PathBuf> for Cow<'a, Path> {
1567:     fn from(s: PathBuf) -> Cow<'a, Path> {
1572: impl<'a> From<&'a PathBuf> for Cow<'a, Path> {
1578:     fn from(p: &'a PathBuf) -> Cow<'a, Path> {
1579:         Cow::Borrowed(p.as_path())
1584:     /// Converts a clone-on-write pointer to an owned path.
1588:     fn from(p: Cow<'a, Path>) -> Self {
1593: impl From<PathBuf> for Arc<Path> {
1596:     fn from(s: PathBuf) -> Arc<Path> {
1598:         unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
1602: impl From<&Path> for Arc<Path> {
1603:     /// Converts a [`Path`] into an [`Arc`] by copying the [`Path`] data into a new [`Arc`] buffer.
1605:     fn from(s: &Path) -> Arc<Path> {
1607:         unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
1611: impl From<PathBuf> for Rc<Path> {
1614:     fn from(s: PathBuf) -> Rc<Path> {
1616:         unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
1620: impl From<&Path> for Rc<Path> {
1621:     /// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new `Rc` buffer.
1623:     fn from(s: &Path) -> Rc<Path> {
1625:         unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
1633:         self.to_path_buf()
1650:         self.as_path().hash(h)
1677: /// A slice of a path (akin to [`str`]).
1679: /// This type supports a number of operations for inspecting a path, including
1680: /// breaking the path into its components (separated by `/` on Unix and by either
1681: /// `/` or `\` on Windows), extracting the file name, determining whether the path
1694: /// use std::path::Path;
1698: /// let path = Path::new("./foo/bar.txt");
1700: /// let parent = path.parent();
1701: /// assert_eq!(parent, Some(Path::new("./foo")));
1703: /// let file_stem = path.file_stem();
1706: /// let extension = path.extension();
1709: #[cfg_attr(not(test), rustc_diagnostic_item = "Path")]
1711: // `Path::new` current implementation relies
1712: // on `Path` being layout-compatible with `OsStr`.
1713: // When attribute privacy is implemented, `Path` should be annotated as `#[repr(transparent)]`.
1714: // Anyway, `Path` representation and layout are considered implementation detail, are
1720: /// An error returned from [`Path::strip_prefix`] if the prefix was not found.
1722: /// This `struct` is created by the [`strip_prefix`] method on [`Path`].
1725: /// [`strip_prefix`]: Path::strip_prefix
1730:     // The following (private!) function allows construction of a path from a u8
1732:     unsafe fn from_u8_slice(s: &[u8]) -> &Path {
1733:         Path::new(u8_slice_as_os_str(s))
1740:     /// Directly wraps a string slice as a `Path` slice.
1747:     /// use std::path::Path;
1749:     /// Path::new("foo.txt");
1752:     /// You can create `Path`s from `String`s, or even other `Path`s:
1755:     /// use std::path::Path;
1758:     /// let from_string = Path::new(&string);
1759:     /// let from_path = Path::new(&from_string);
1760:     /// assert_eq!(from_string, from_path);
1762:     pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
1763:         unsafe { &*(s.as_ref() as *const OsStr as *const Path) }
1771:     /// use std::path::Path;
1773:     /// let os_str = Path::new("foo.txt").as_os_str();
1781:     /// Yields a [`&str`] slice if the `Path` is valid unicode.
1792:     /// use std::path::Path;
1794:     /// let path = Path::new("foo.txt");
1795:     /// assert_eq!(path.to_str(), Some("foo.txt"));
1802:     /// Converts a `Path` to a [`Cow<str>`].
1811:     /// Calling `to_string_lossy` on a `Path` with valid unicode:
1814:     /// use std::path::Path;
1816:     /// let path = Path::new("foo.txt");
1817:     /// assert_eq!(path.to_string_lossy(), "foo.txt");
1820:     /// Had `path` contained invalid unicode, the `to_string_lossy` call might
1827:     /// Converts a `Path` to an owned [`PathBuf`].
1832:     /// use std::path::Path;
1834:     /// let path_buf = Path::new("foo.txt").to_path_buf();
1835:     /// assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
1842:     /// Returns `true` if the `Path` is absolute, i.e., if it is independent of
1845:     /// * On Unix, a path is absolute if it starts with the root, so
1848:     /// * On Windows, a path is absolute if it has a prefix and starts with the
1854:     /// use std::path::Path;
1856:     /// assert!(!Path::new("foo.txt").is_absolute());
1859:     /// [`has_root`]: Path::has_root
1865:     /// Returns `true` if the `Path` is relative, i.e., not absolute.
1872:     /// use std::path::Path;
1874:     /// assert!(Path::new("foo.txt").is_relative());
1877:     /// [`is_absolute`]: Path::is_absolute
1887:     /// Returns `true` if the `Path` has a root.
1889:     /// * On Unix, a path has a root if it begins with `/`.
1891:     /// * On Windows, a path has a root if it:
1899:     /// use std::path::Path;
1901:     /// assert!(Path::new("/etc/passwd").has_root());
1908:     /// Returns the `Path` without its final component, if there is one.
1910:     /// Returns [`None`] if the path terminates in a root or prefix.
1915:     /// use std::path::Path;
1917:     /// let path = Path::new("/foo/bar");
1918:     /// let parent = path.parent().unwrap();
1919:     /// assert_eq!(parent, Path::new("/foo"));
1922:     /// assert_eq!(grand_parent, Path::new("/"));
1925:     pub fn parent(&self) -> Option<&Path> {
1930:                 Some(comps.as_path())
1936:     /// Produces an iterator over `Path` and its ancestors.
1938:     /// The iterator will yield the `Path` that is returned if the [`parent`] method is used zero
1947:     /// use std::path::Path;
1949:     /// let mut ancestors = Path::new("/foo/bar").ancestors();
1950:     /// assert_eq!(ancestors.next(), Some(Path::new("/foo/bar")));
1951:     /// assert_eq!(ancestors.next(), Some(Path::new("/foo")));
1952:     /// assert_eq!(ancestors.next(), Some(Path::new("/")));
1955:     /// let mut ancestors = Path::new("../foo/bar").ancestors();
1956:     /// assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
1957:     /// assert_eq!(ancestors.next(), Some(Path::new("../foo")));
1958:     /// assert_eq!(ancestors.next(), Some(Path::new("..")));
1959:     /// assert_eq!(ancestors.next(), Some(Path::new("")));
1963:     /// [`parent`]: Path::parent
1969:     /// Returns the final component of the `Path`, if there is one.
1971:     /// If the path is a normal file, this is the file name. If it's the path of a directory, this
1974:     /// Returns [`None`] if the path terminates in `..`.
1979:     /// use std::path::Path;
1982:     /// assert_eq!(Some(OsStr::new("bin")), Path::new("/usr/bin/").file_name());
1983:     /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("tmp/foo.txt").file_name());
1984:     /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.").file_name());
1985:     /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.//").file_name());
1986:     /// assert_eq!(None, Path::new("foo.txt/..").file_name());
1987:     /// assert_eq!(None, Path::new("/").file_name());
1996:     /// Returns a path that, when joined onto `base`, yields `self`.
2003:     /// [`starts_with`]: Path::starts_with
2008:     /// use std::path::{Path, PathBuf};
2010:     /// let path = Path::new("/test/haha/foo.txt");
2012:     /// assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
2013:     /// assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
2014:     /// assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
2015:     /// assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
2016:     /// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
2018:     /// assert!(path.strip_prefix("test").is_err());
2019:     /// assert!(path.strip_prefix("/haha").is_err());
2022:     /// assert_eq!(path.strip_prefix(prefix), Ok(Path::new("haha/foo.txt")));
2024:     pub fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>
2026:         P: AsRef<Path>,
2031:     fn _strip_prefix(&self, base: &Path) -> Result<&Path, StripPrefixError> {
2033:             .map(|c| c.as_path())
2039:     /// Only considers whole path components to match.
2044:     /// use std::path::Path;
2046:     /// let path = Path::new("/etc/passwd");
2048:     /// assert!(path.starts_with("/etc"));
2049:     /// assert!(path.starts_with("/etc/"));
2050:     /// assert!(path.starts_with("/etc/passwd"));
2051:     /// assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
2052:     /// assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
2054:     /// assert!(!path.starts_with("/e"));
2055:     /// assert!(!path.starts_with("/etc/passwd.txt"));
2057:     /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
2059:     pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
2063:     fn _starts_with(&self, base: &Path) -> bool {
2069:     /// Only considers whole path components to match.
2074:     /// use std::path::Path;
2076:     /// let path = Path::new("/etc/resolv.conf");
2078:     /// assert!(path.ends_with("resolv.conf"));
2079:     /// assert!(path.ends_with("etc/resolv.conf"));
2080:     /// assert!(path.ends_with("/etc/resolv.conf"));
2082:     /// assert!(!path.ends_with("/resolv.conf"));
2083:     /// assert!(!path.ends_with("conf")); // use .extension() instead
2085:     pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
2089:     fn _ends_with(&self, child: &Path) -> bool {
2095:     /// [`self.file_name`]: Path::file_name
2107:     /// use std::path::Path;
2109:     /// assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
2110:     /// assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
2114:     /// This method is similar to [`Path::file_prefix`], which extracts the portion of the file name
2117:     /// [`Path::file_prefix`]: Path::file_prefix
2133:     /// [`self.file_name`]: Path::file_name
2138:     /// # #![feature(path_file_prefix)]
2139:     /// use std::path::Path;
2141:     /// assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap());
2142:     /// assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap());
2146:     /// This method is similar to [`Path::file_stem`], which extracts the portion of the file name
2149:     /// [`Path::file_stem`]: Path::file_stem
2164:     /// [`self.file_name`]: Path::file_name
2169:     /// use std::path::Path;
2171:     /// assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
2172:     /// assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
2178:     /// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
2180:     /// See [`PathBuf::push`] for more details on what it means to adjoin a path.
2185:     /// use std::path::{Path, PathBuf};
2187:     /// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
2190:     pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
2191:         self._join(path.as_ref())
2194:     fn _join(&self, path: &Path) -> PathBuf {
2195:         let mut buf = self.to_path_buf();
2196:         buf.push(path);
2207:     /// use std::path::{Path, PathBuf};
2209:     /// let path = Path::new("/tmp/foo.txt");
2210:     /// assert_eq!(path.with_file_name("bar.txt"), PathBuf::from("/tmp/bar.txt"));
2212:     /// let path = Path::new("/tmp");
2213:     /// assert_eq!(path.with_file_name("var"), PathBuf::from("/var"));
2220:         let mut buf = self.to_path_buf();
2232:     /// use std::path::{Path, PathBuf};
2234:     /// let path = Path::new("foo.rs");
2235:     /// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
2237:     /// let path = Path::new("foo.tar.gz");
2238:     /// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
2239:     /// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
2240:     /// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
2247:         let mut buf = self.to_path_buf();
2252:     /// Produces an iterator over the [`Component`]s of the path.
2254:     /// When parsing the path, there is a small amount of normalization:
2260:     ///   beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and
2273:     /// use std::path::{Path, Component};
2276:     /// let mut components = Path::new("/tmp/foo.txt").components();
2288:             path: self.as_u8_slice(),
2296:     /// Produces an iterator over the path's components viewed as [`OsStr`]
2299:     /// For more information about the particulars of how the path is separated
2302:     /// [`components`]: Path::components
2307:     /// use std::path::{self, Path};
2310:     /// let mut it = Path::new("/tmp/foo.txt").iter();
2311:     /// assert_eq!(it.next(), Some(OsStr::new(&path::MAIN_SEPARATOR.to_string())));
2324:     /// escapes the path please use [`Debug`] instead.
2331:     /// use std::path::Path;
2333:     /// let path = Path::new("/tmp/foo.rs");
2335:     /// println!("{}", path.display());
2339:         Display { path: self }
2352:     /// use std::path::Path;
2354:     /// let path = Path::new("/Minas/tirith");
2355:     /// let metadata = path.metadata().expect("metadata call failed");
2371:     /// use std::path::Path;
2373:     /// let path = Path::new("/Minas/tirith");
2374:     /// let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
2383:     /// Returns the canonical, absolute form of the path with all intermediate
2391:     /// use std::path::{Path, PathBuf};
2393:     /// let path = Path::new("/foo/test/../test/bar.rs");
2394:     /// assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
2409:     /// use std::path::Path;
2411:     /// let path = Path::new("/laputa/sky_castle.rs");
2412:     /// let path_link = path.read_link().expect("read_link call failed");
2430:     /// use std::path::Path;
2432:     /// let path = Path::new("/laputa");
2433:     /// for entry in path.read_dir().expect("read_dir call failed") {
2435:     ///         println!("{:?}", entry.path());
2445:     /// Returns `true` if the path points at an existing entity.
2456:     /// use std::path::Path;
2457:     /// assert!(!Path::new("does_not_exist.txt").exists());
2470:     /// Returns `Ok(true)` if the path points at an existing entity.
2476:     /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2482:     /// #![feature(path_try_exists)]
2484:     /// use std::path::Path;
2485:     /// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"))...(1 bytes skipped)...
2486:     /// assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
2496:     /// Returns `true` if the path exists on disk and is pointing at a regular file.
2507:     /// use std::path::Path;
2508:     /// assert_eq!(Path::new("./is_a_directory/").is_file(), false);
2509:     /// assert_eq!(Path::new("a_file.txt").is_file(), true);
2528:     /// Returns `true` if the path exists on disk and is pointing at a directory.
2539:     /// use std::path::Path;
2540:     /// assert_eq!(Path::new("./is_a_directory/").is_dir(), true);
2541:     /// assert_eq!(Path::new("a_file.txt").is_dir(), false);
2554:     /// Returns true if the path exists on disk and is pointing at a symbolic link.
2567:     /// use std::path::Path;
2570:     /// let link_path = Path::new("link");
2571:     /// symlink("/origin_does_not_exists/", link_path).unwrap();
2572:     /// assert_eq!(link_path.is_symlink(), true);
2573:     /// assert_eq!(link_path.exists(), false);
2580:     /// Converts a [`Box<Path>`](Box) into a [`PathBuf`] without copying or
2604: /// A [`Path`] might contain non-Unicode data. This `struct` implements the
2606: /// [`display`](Path::display) method on [`Path`]. This may perform lossy
2608: /// which escapes the path please use [`Debug`] instead.
2613: /// use std::path::Path;
2615: /// let path = Path::new("/tmp/foo.rs");
2617: /// println!("{}", path.display());
2628:         fmt::Debug::fmt(&self.path, f)
2634:         self.path.inner.display(f)
2640:     fn eq(&self, other: &Path) -> bool {
2657:     fn partial_cmp(&self, other: &Path) -> Option<cmp::Ordering> {
2664:     fn cmp(&self, other: &Path) -> cmp::Ordering {
2671:     fn as_ref(&self) -> &Path {
2676: impl AsRef<Path> for OsStr {
2678:     fn as_ref(&self) -> &Path {
2679:         Path::new(self)
2683: impl AsRef<Path> for Cow<'_, OsStr> {
2685:     fn as_ref(&self) -> &Path {
2686:         Path::new(self)
2690: impl AsRef<Path> for OsString {
2692:     fn as_ref(&self) -> &Path {
2693:         Path::new(self)
2697: impl AsRef<Path> for str {
2699:     fn as_ref(&self) -> &Path {
2700:         Path::new(self)
2704: impl AsRef<Path> for String {
2706:     fn as_ref(&self) -> &Path {
2707:         Path::new(self)
2713:     fn as_ref(&self) -> &Path {
2741:                 <Path as PartialEq>::eq(self, other)
2748:                 <Path as PartialEq>::eq(self, other)
2755:                 <Path as PartialOrd>::partial_cmp(self, other)
2762:                 <Path as PartialOrd>::partial_cmp(self, other)
2768: impl_cmp!(PathBuf, Path);
2769: impl_cmp!(PathBuf, &'a Path);
2770: impl_cmp!(Cow<'a, Path>, Path);
2771: impl_cmp!(Cow<'a, Path>, &'b Path);
2772: impl_cmp!(Cow<'a, Path>, PathBuf);
2779:                 <Path as PartialEq>::eq(self, other.as_ref())
2786:                 <Path as PartialEq>::eq(self.as_ref(), other)
2793:                 <Path as PartialOrd>::partial_cmp(self, other.as_ref())
2800:                 <Path as PartialOrd>::partial_cmp(self.as_ref(), other)
2810: impl_cmp_os_str!(Path, OsStr);
2811: impl_cmp_os_str!(Path, &'a OsStr);
2812: impl_cmp_os_str!(Path, Cow<'a, OsStr>);
2813: impl_cmp_os_str!(Path, OsString);
2814: impl_cmp_os_str!(&'a Path, OsStr);
2815: impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
2816: impl_cmp_os_str!(&'a Path, OsString);
2817: impl_cmp_os_str!(Cow<'a, Path>, OsStr);
2818: impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
2819: impl_cmp_os_str!(Cow<'a, Path>, OsString);
21: //! and [`str`]), for working with paths abstractly. These types are thin wrappers
25: //! Paths can be parsed into [`Component`]s by iterating over the structure
29: //! [`PathBuf`]; note that the paths may differ syntactically by the
35: //! new owned paths.
56: //! To build or modify paths, use [`PathBuf`]:
75: //! [`push`]: PathBuf::push
1022: /// [`push`]: PathBuf::push
1023: /// [`set_extension`]: PathBuf::set_extension
1030: /// You can use [`push`] to build up a `PathBuf` from
1064: #[cfg_attr(not(test), rustc_diagnostic_item = "PathBuf")]
1066: // `PathBuf::as_mut_vec` current implementation relies
1067: // on `PathBuf` being layout-compatible with `Vec<u8>`.
1068: // When attribute privacy is implemented, `PathBuf` should be annotated as `#[repr(transparent)]`.
1069: // Anyway, `PathBuf` representation and layout are considered implementation detail, are
1078:         unsafe { &mut *(self as *mut PathBuf as *mut Vec<u8>) }
1081:     /// Allocates an empty `PathBuf`.
1091:     pub fn new() -> PathBuf {
1092:         PathBuf { inner: OsString::new() }
1095:     /// Creates a new `PathBuf` with a given capacity used to create the
1114:     pub fn with_capacity(capacity: usize) -> PathBuf {
1115:         PathBuf { inner: OsString::with_capacity(capacity) }
1125:     /// let p = PathBuf::from("/test");
1213:     /// let mut p = PathBuf::from("/spirited/away.rs");
1240:     /// [`pop`]: PathBuf::pop
1247:     /// let mut buf = PathBuf::from("/");
1250:     /// assert!(buf == PathBuf::from("/bar"));
1253:     /// assert!(buf == PathBuf::from("/baz.txt"));
1283:     /// let mut p = PathBuf::from("/feel/the");
1318:     /// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
1325:     /// let p = PathBuf::from("/the/head");
1393:         PathBuf { inner: self.inner.clone() }
1455:     /// Converts a borrowed `OsStr` to a `PathBuf`.
1457:     /// Allocates a [`PathBuf`] and copies the data into it.
1459:     fn from(s: &T) -> PathBuf {
1460:         PathBuf::from(s.as_ref().to_os_string())
1465:     /// Converts an [`OsString`] into a [`PathBuf`]
1469:     fn from(s: OsString) -> PathBuf {
1470:         PathBuf { inner: s }
1474: impl From<PathBuf> for OsString {
1475:     /// Converts a [`PathBuf`] into an [`OsString`]
1485:     /// Converts a [`String`] into a [`PathBuf`]
1489:     fn from(s: String) -> PathBuf {
1490:         PathBuf::from(OsString::from(s))
1499:         Ok(PathBuf::from(s))
1504:     fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
1505:         let mut buf = PathBuf::new();
1546:         PathBuf::new()
1563:     /// instance of [`PathBuf`].
1574:     /// [`PathBuf`].
1594:     /// Converts a [`PathBuf`] into an [`Arc`] by moving the [`PathBuf`] data into a new [`Arc`] buffer.
1612:     /// Converts a [`PathBuf`] into an [`Rc`] by moving the [`PathBuf`] data into a new `Rc` buffer.
1630:     type Owned = PathBuf;
1632:     fn to_owned(&self) -> PathBuf {
1636:     fn clone_into(&self, target: &mut PathBuf) {
1643:     fn eq(&self, other: &PathBuf) -> bool {
1658:     fn partial_cmp(&self, other: &PathBuf) -> Option<cmp::Ordering> {
1665:     fn cmp(&self, other: &PathBuf) -> cmp::Ordering {
1686: /// see [`PathBuf`].
1839:         PathBuf::from(self.inner.to_os_string())
2021:     /// let prefix = PathBuf::from("/test/");
2200:     /// Creates an owned [`PathBuf`] like `self` but with the given file name.
2202:     /// See [`PathBuf::set_file_name`] for more details.
2215:     pub fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf {
2219:     fn _with_file_name(&self, file_name: &OsStr) -> PathBuf {
2225:     /// Creates an owned [`PathBuf`] like `self` but with the given extension.
2227:     /// See [`PathBuf::set_extension`] for more details.
2242:     pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
2246:     fn _with_extension(&self, extension: &OsStr) -> PathBuf {
2321:     /// Returns an object that implements [`Display`] for safely printing paths
2398:     pub fn canonicalize(&self) -> io::Result<PathBuf> {
2416:     pub fn read_link(&self) -> io::Result<PathBuf> {
2585:         PathBuf { inner: OsString::from(inner) }
2602: /// Helper struct for safely printing paths with [`format!`] and `{}`.
2806: impl_cmp_os_str!(PathBuf, OsStr);
2807: impl_cmp_os_str!(PathBuf, &'a OsStr);
2808: impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
2809: impl_cmp_os_str!(PathBuf, OsString);
github.com/apache/servicecomb-service-center:datasource/etcd/path/key_generator.go: [ master, ]
18: package path
github.com/apache/incubator-teaclave:third_party/rust-sgx-sdk/sgx_tstd/src/path.rs: [ master, ]
392:     path: &'a [u8],
1202: impl ToOwned for Path {
1262: pub struct Path {
1277: impl Path {
1730: impl AsRef<OsStr> for Path {
1736: impl fmt::Debug for Path {
1749:     path: &'a Path,
1764: impl cmp::PartialEq for Path {
1770: impl Hash for Path {
1778: impl cmp::Eq for Path {}
1780: impl cmp::PartialOrd for Path {
1786: impl cmp::Ord for Path {
1792: impl AsRef<Path> for Path {
1844: impl<'a> IntoIterator for &'a Path {
475:     pub fn as_path(&self) -> &'a Path {
602:     pub fn as_path(&self) -> &'a Path {
823:     pub fn as_path(&self) -> &Path {
968:     pub fn into_boxed_path(self) -> Box<Path> {
797: pub struct PathBuf {
801: impl PathBuf {
1030: impl From<Box<Path>> for PathBuf {
1056: impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf {
1062: impl From<OsString> for PathBuf {
1081: impl From<String> for PathBuf {
1090: impl FromStr for PathBuf {
1098: impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
1106: impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
1112: impl fmt::Debug for PathBuf {
1118: impl ops::Deref for PathBuf {
1126: impl Borrow<Path> for PathBuf {
1132: impl Default for PathBuf {
1159: impl<'a> From<Cow<'a, Path>> for PathBuf {
1212: impl cmp::PartialEq for PathBuf {
1218: impl Hash for PathBuf {
1224: impl cmp::Eq for PathBuf {}
1226: impl cmp::PartialOrd for PathBuf {
1232: impl cmp::Ord for PathBuf {
1238: impl AsRef<OsStr> for PathBuf {
1829: impl AsRef<Path> for PathBuf {
1836: impl<'a> IntoIterator for &'a PathBuf {
1333:     pub fn to_path_buf(&self) -> PathBuf {
1723:     pub fn into_path_buf(self: Box<Path>) -> PathBuf {
18: //! Cross-platform path manipulation.
20: //! This module provides two types, [`PathBuf`] and [`Path`] (akin to [`String`]
23: //! on strings according to the local platform's path syntax.
26: //! returned by the [`components`] method on [`Path`]. [`Component`]s roughly
27: //! correspond to the substrings between path separators (`/` or `\`). You can
28: //! reconstruct an equivalent path from components with the [`push`] method on
39: use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR};
65: /// Windows path prefixes, e.g., `C:` or `\\server\share`.
67: /// Windows uses a variety of path prefix styles, including references to drive
69: /// others. In addition, some path prefixes are "verbatim" (i.e., prefixed with
152: /// Determines whether the character is one of the permitted path
159: /// The primary separator of path components for the current platform.
162: pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
210:     let path = if let Some(p) = prefix { &s[p.len()..] } else { s };
211:     !path.is_empty() && is_sep_byte(path[0])
242: /// front and back of the path each keep track of what parts of the path have
245: /// Going front to back, a path is made up of a prefix, a starting
255: /// A structure wrapping a Windows path prefix as well as its unparsed string
319: /// A single component of a path.
321: /// A `Component` roughly corresponds to a substring between path separators
325: /// created by the [`components`][`Path::components`] method on [`Path`].
330:     /// A Windows path prefix, e.g., `C:` or `\\server\share`.
342:     /// It represents a separator that designates that a path starts from root.
367:             Component::Normal(path) => path,
378: impl AsRef<Path> for Component<'_> {
379:     fn as_ref(&self) -> &Path {
384: /// An iterator over the [`Component`]s of a [`Path`].
386: /// This `struct` is created by the [`components`] method on [`Path`].
391:     // The path left to parse components from
397:     // true if path *physically* has a root separator; for most Windows
408: /// An iterator over the [`Component`]s of a [`Path`], as [`OsStr`] slices.
410: /// This `struct` is created by the [`iter`] method on [`Path`].
414: /// [`iter`]: struct.Path.html#method.iter
416: /// [`Path`]: struct.Path.html
424:         struct DebugHelper<'a>(&'a Path);
432:         f.debug_tuple("Components").field(&DebugHelper(self.as_path())).finish()
454:     // Given the iteration so far, how much of the pre-State::Body path is left?
473:     /// Extracts a slice corresponding to the portion of the path remaining for iteration.
483:         unsafe { Path::from_u8_slice(comps.path) }
486:     /// Is the *original* path rooted?
499:     /// Should the normalized path include a leading . ?
504:         let mut iter = self.path[self.prefix_len()..].iter();
512:     // parse a given byte sequence into the corresponding path component
517:             // the beginning of a path, which is treated
529:         let (extra, comp) = match self.path.iter().position(|b| self.is_sep_byte(*b)) {
530:             None => (0, self.path),
531:             Some(i) => (1, &self.path[..i]),
541:         let (extra, comp) = match self.path[start..].iter().rposition(|b| self.is_sep_byte(*b)) {
542:             None => (0, &self.path[start..]),
543:             Some(i) => (1, &self.path[start + i + 1..]),
550:         while !self.path.is_empty() {
555:                 self.path = &self.path[size..];
562:         while self.path.len() > self.len_before_body() {
567:                 self.path = &self.path[..self.path.len() - size];
573: impl AsRef<Path> for Components<'_> {
574:     fn as_ref(&self) -> &Path {
575:         self.as_path()
581:         self.as_path().as_os_str()
587:         struct DebugHelper<'a>(&'a Path);
595:         f.debug_tuple("Iter").field(&DebugHelper(self.as_path())).finish()
600:     /// Extracts a slice corresponding to the portion of the path remaining for iteration.
603:         self.inner.as_path()
607: impl AsRef<Path> for Iter<'_> {
608:     fn as_ref(&self) -> &Path {
609:         self.as_path()
615:         self.as_path().as_os_str()
643:                     debug_assert!(self.prefix_len() <= self.path.len());
644:                     let raw = &self.path[..self.prefix_len()];
645:                     self.path = &self.path[self.prefix_len()..];
657:                         debug_assert!(!self.path.is_empty());
658:                         self.path = &self.path[1..];
665:                         debug_assert!(!self.path.is_empty());
666:                         self.path = &self.path[1..];
670:                 State::Body if !self.path.is_empty() => {
672:                     self.path = &self.path[size..];
691:                 State::Body if self.path.len() > self.len_before_body() => {
693:                     self.path = &self.path[..self.path.len() - size];
704:                         self.path = &self.path[..self.path.len() - 1];
711:                         self.path = &self.path[..self.path.len() - 1];
718:                         raw: unsafe { u8_slice_as_os_str(self.path) },
755: /// An iterator over [`Path`] and its ancestors.
757: /// This `struct` is created by the [`ancestors`] method on [`Path`].
762:     next: Option<&'a Path>,
766:     type Item = &'a Path;
770:         self.next = next.and_then(Path::parent);
781: /// An owned, mutable path (akin to [`String`]).
784: /// the path in place. It also implements [`Deref`] to [`Path`], meaning that
785: /// all methods on [`Path`] slices are available on `PathBuf` values as well.
788: /// [`Path`]: struct.Path.html
819:     /// Coerces to a [`Path`] slice.
821:     /// [`Path`]: struct.Path.html
827:     /// Extends `self` with `path`.
829:     /// If `path` is absolute, it replaces the current path.
833:     /// * if `path` has a root but no prefix (e.g., `\windows`), it
835:     /// * if `path` has a prefix but no root, it replaces `self`.
837:     pub fn push<P: AsRef<Path>>(&mut self, path: P) {
838:         self._push(path.as_ref())
841:     fn _push(&mut self, path: &Path) {
849:                 && comps.prefix_len() == comps.path.len()
856:         // absolute `path` replaces `self`
857:         if path.is_absolute() || path.prefix().is_some() {
860:         // `path` has a root but no prefix, e.g., `\windows` (Windows only)
861:         } else if path.has_root() {
865:         // `path` is a pure relative path
870:         self.inner.push(path);
898:     /// `file_name`. The new path will be a sibling of the original path.
964:     /// Converts this `PathBuf` into a [boxed][`Box`] [`Path`].
967:     /// [`Path`]: struct.Path.html
969:         let rw = Box::into_raw(self.inner.into_boxed_os_str()) as *mut Path;
1022: impl From<&Path> for Box<Path> {
1023:     fn from(path: &Path) -> Box<Path> {
1024:         let boxed: Box<OsStr> = path.inner.into();
1025:         let rw = Box::into_raw(boxed) as *mut Path;
1031:     /// Converts a `Box<Path>` into a `PathBuf`
1034:     fn from(boxed: Box<Path>) -> PathBuf {
1035:         boxed.into_path_buf()
1039: impl From<PathBuf> for Box<Path> {
1040:     /// Converts a `PathBuf` into a `Box<Path>`
1044:     fn from(p: PathBuf) -> Box<Path> {
1045:         p.into_boxed_path()
1049: impl Clone for Box<Path> {
1052:         self.to_path_buf().into_boxed_path()
1076:     fn from(path_buf: PathBuf) -> OsString {
1077:         path_buf.inner
1119:     type Target = Path;
1121:     fn deref(&self) -> &Path {
1122:         Path::new(&self.inner)
1127:     fn borrow(&self) -> &Path {
1138: impl<'a> From<&'a Path> for Cow<'a, Path> {
1140:     fn from(s: &'a Path) -> Cow<'a, Path> {
1145: impl<'a> From<PathBuf> for Cow<'a, Path> {
1147:     fn from(s: PathBuf) -> Cow<'a, Path> {
1152: impl<'a> From<&'a PathBuf> for Cow<'a, Path> {
1154:     fn from(p: &'a PathBuf) -> Cow<'a, Path> {
1155:         Cow::Borrowed(p.as_path())
1161:     fn from(p: Cow<'a, Path>) -> Self {
1166: impl From<PathBuf> for Arc<Path> {
1169:     fn from(s: PathBuf) -> Arc<Path> {
1171:         unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
1175: impl From<&Path> for Arc<Path> {
1176:     /// Converts a `Path` into an `Arc` by copying the `Path` data into a new `Arc` buffer.
1178:     fn from(s: &Path) -> Arc<Path> {
1180:         unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
1184: impl From<PathBuf> for Rc<Path> {
1187:     fn from(s: PathBuf) -> Rc<Path> {
1189:         unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
1193: impl From<&Path> for Rc<Path> {
1194:     /// Converts a `Path` into an `Rc` by copying the `Path` data into a new `Rc` buffer.
1196:     fn from(s: &Path) -> Rc<Path> {
1198:         unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
1205:         self.to_path_buf()
1220:         self.as_path().hash(h)
1244: /// A slice of a path (akin to [`str`]).
1246: /// This type supports a number of operations for inspecting a path, including
1247: /// breaking the path into its components (separated by `/` on Unix and by either
1248: /// `/` or `\` on Windows), extracting the file name, determining whether the path
1266: /// An error returned from [`Path::strip_prefix`][`strip_prefix`] if the prefix
1269: /// This `struct` is created by the [`strip_prefix`] method on [`Path`].
1272: /// [`strip_prefix`]: struct.Path.html#method.strip_prefix
1273: /// [`Path`]: struct.Path.html
1278:     // The following (private!) function allows construction of a path from a u8
1280:     unsafe fn from_u8_slice(s: &[u8]) -> &Path {
1281:         Path::new(u8_slice_as_os_str(s))
1288:     /// Directly wraps a string slice as a `Path` slice.
1292:     pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
1293:         unsafe { &*(s.as_ref() as *const OsStr as *const Path) }
1304:     /// Yields a [`&str`] slice if the `Path` is valid unicode.
1316:     /// Converts a `Path` to a [`Cow<str>`].
1328:     /// Converts a `Path` to an owned [`PathBuf`].
1337:     /// Returns `true` if the `Path` is absolute, i.e., if it is independent of
1340:     /// * On Unix, a path is absolute if it starts with the root, so
1343:     /// * On Windows, a path is absolute if it has a prefix and starts with the
1351:     /// Returns `true` if the `Path` is relative, i.e., not absolute.
1363:     /// Returns `true` if the `Path` has a root.
1365:     /// * On Unix, a path has a root if it begins with `/`.
1367:     /// * On Windows, a path has a root if it:
1376:     /// Returns the `Path` without its final component, if there is one.
1378:     /// Returns [`None`] if the path terminates in a root or prefix.
1382:     pub fn parent(&self) -> Option<&Path> {
1387:                 Some(comps.as_path())
1393:     /// Produces an iterator over `Path` and its ancestors.
1395:     /// The iterator will yield the `Path` that is returned if the [`parent`] method is used zero
1405:     /// Returns the final component of the `Path`, if there is one.
1407:     /// If the path is a normal file, this is the file name. If it's the path of a directory, this
1410:     /// Returns [`None`] if the path terminates in `..`.
1421:     /// Returns a path that, when joined onto `base`, yields `self`.
1431:     pub fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>
1433:         P: AsRef<Path>,
1438:     fn _strip_prefix(&self, base: &Path) -> Result<&Path, StripPrefixError> {
1440:             .map(|c| c.as_path())
1446:     /// Only considers whole path components to match.
1448:     pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
1452:     fn _starts_with(&self, base: &Path) -> bool {
1458:     /// Only considers whole path components to match.
1460:     pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
1464:     fn _ends_with(&self, child: &Path) -> bool {
1470:     /// [`self.file_name`]: struct.Path.html#method.file_name
1494:     /// [`self.file_name`]: struct.Path.html#method.file_name
1501:     /// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
1503:     /// See [`PathBuf::push`] for more details on what it means to adjoin a path.
1508:     pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
1509:         self._join(path.as_ref())
1512:     fn _join(&self, path: &Path) -> PathBuf {
1513:         let mut buf = self.to_path_buf();
1514:         buf.push(path);
1530:         let mut buf = self.to_path_buf();
1547:         let mut buf = self.to_path_buf();
1552:     /// Produces an iterator over the [`Component`]s of the path.
1554:     /// When parsing the path, there is a small amount of normalization:
1560:     ///   beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and
1573:             path: self.as_u8_slice(),
1581:     /// Produces an iterator over the path's components viewed as [`OsStr`]
1584:     /// For more information about the particulars of how the path is separated
1600:         Display { path: self }
1628:     /// Returns the canonical, absolute form of the path with all intermediate
1665:     /// use std::path::Path;
1667:     /// let path = Path::new("/laputa");
1668:     /// for entry in path.read_dir().expect("read_dir call failed") {
1670:     ///         println!("{:?}", entry.path());
1679:     /// Returns `true` if the path points at an existing entity.
1692:     /// Returns `true` if the path exists on disk and is pointing at a regular file.
1705:     /// Returns `true` if the path exists on disk and is pointing at a directory.
1718:     /// Converts a [`Box<Path>`][`Box`] into a [`PathBuf`] without copying or
1744: /// A [`Path`] might contain non-Unicode data. This `struct` implements the
1746: /// [`display`][`Path::display`] method on [`Path`].
1754:         fmt::Debug::fmt(&self.path, f)
1760:         self.path.inner.display(f)
1765:     fn eq(&self, other: &Path) -> bool {
1781:     fn partial_cmp(&self, other: &Path) -> Option<cmp::Ordering> {
1787:     fn cmp(&self, other: &Path) -> cmp::Ordering {
1793:     fn as_ref(&self) -> &Path {
1798: impl AsRef<Path> for OsStr {
1799:     fn as_ref(&self) -> &Path {
1800:         Path::new(self)
1804: impl AsRef<Path> for Cow<'_, OsStr> {
1805:     fn as_ref(&self) -> &Path {
1806:         Path::new(self)
1810: impl AsRef<Path> for OsString {
1811:     fn as_ref(&self) -> &Path {
1812:         Path::new(self)
1816: impl AsRef<Path> for str {
1818:     fn as_ref(&self) -> &Path {
1819:         Path::new(self)
1823: impl AsRef<Path> for String {
1824:     fn as_ref(&self) -> &Path {
1825:         Path::new(self)
1831:     fn as_ref(&self) -> &Path {
1857:                 <Path as PartialEq>::eq(self, other)
1864:                 <Path as PartialEq>::eq(self, other)
1871:                 <Path as PartialOrd>::partial_cmp(self, other)
1878:                 <Path as PartialOrd>::partial_cmp(self, other)
1884: impl_cmp!(PathBuf, Path);
1885: impl_cmp!(PathBuf, &'a Path);
1886: impl_cmp!(Cow<'a, Path>, Path);
1887: impl_cmp!(Cow<'a, Path>, &'b Path);
1888: impl_cmp!(Cow<'a, Path>, PathBuf);
1895:                 <Path as PartialEq>::eq(self, other.as_ref())
1902:                 <Path as PartialEq>::eq(self.as_ref(), other)
1909:                 <Path as PartialOrd>::partial_cmp(self, other.as_ref())
1916:                 <Path as PartialOrd>::partial_cmp(self.as_ref(), other)
1926: impl_cmp_os_str!(Path, OsStr);
1927: impl_cmp_os_str!(Path, &'a OsStr);
1928: impl_cmp_os_str!(Path, Cow<'a, OsStr>);
1929: impl_cmp_os_str!(Path, OsString);
1930: impl_cmp_os_str!(&'a Path, OsStr);
1931: impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
1932: impl_cmp_os_str!(&'a Path, OsString);
1933: impl_cmp_os_str!(Cow<'a, Path>, OsStr);
1934: impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
1935: impl_cmp_os_str!(Cow<'a, Path>, OsString);
21: //! and [`str`]), for working with paths abstractly. These types are thin wrappers
25: //! Paths can be parsed into [`Component`]s by iterating over the structure
29: //! [`PathBuf`]; note that the paths may differ syntactically by the
789: /// [`push`]: struct.PathBuf.html#method.push
790: /// [`set_extension`]: struct.PathBuf.html#method.set_extension
803:         unsafe { &mut *(self as *mut PathBuf as *mut Vec<u8>) }
806:     /// Allocates an empty `PathBuf`.
808:     pub fn new() -> PathBuf {
809:         PathBuf { inner: OsString::new() }
812:     /// Creates a new `PathBuf` with a given capacity used to create the
815:     pub fn with_capacity(capacity: usize) -> PathBuf {
816:         PathBuf { inner: OsString::with_capacity(capacity) }
879:     /// [`self.parent`]: struct.PathBuf.html#method.parent
901:     /// [`self.file_name`]: struct.PathBuf.html#method.file_name
903:     /// [`pop`]: struct.PathBuf.html#method.pop
925:     /// [`self.file_name`]: struct.PathBuf.html#method.file_name
926:     /// [`self.extension`]: struct.PathBuf.html#method.extension
956:     /// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
1057:     fn from(s: &T) -> PathBuf {
1058:         PathBuf::from(s.as_ref().to_os_string())
1063:     /// Converts a `OsString` into a `PathBuf`
1067:     fn from(s: OsString) -> PathBuf {
1068:         PathBuf { inner: s }
1072: impl From<PathBuf> for OsString {
1073:     /// Converts a `PathBuf` into a `OsString`
1082:     /// Converts a `String` into a `PathBuf`
1085:     fn from(s: String) -> PathBuf {
1086:         PathBuf::from(OsString::from(s))
1094:         Ok(PathBuf::from(s))
1099:     fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
1100:         let mut buf = PathBuf::new();
1134:         PathBuf::new()
1167:     /// Converts a `PathBuf` into an `Arc` by moving the `PathBuf` data into a new `Arc` buffer.
1185:     /// Converts a `PathBuf` into an `Rc` by moving the `PathBuf` data into a new `Rc` buffer.
1203:     type Owned = PathBuf;
1204:     fn to_owned(&self) -> PathBuf {
1207:     fn clone_into(&self, target: &mut PathBuf) {
1213:     fn eq(&self, other: &PathBuf) -> bool {
1227:     fn partial_cmp(&self, other: &PathBuf) -> Option<cmp::Ordering> {
1233:     fn cmp(&self, other: &PathBuf) -> cmp::Ordering {
1253: /// see [`PathBuf`].
1257: /// [`PathBuf`]: struct.PathBuf.html
1330:     /// [`PathBuf`]: struct.PathBuf.html
1334:         PathBuf::from(self.inner.to_os_string())
1505:     /// [`PathBuf`]: struct.PathBuf.html
1506:     /// [`PathBuf::push`]: struct.PathBuf.html#method.push
1518:     /// Creates an owned [`PathBuf`] like `self` but with the given file name.
1520:     /// See [`PathBuf::set_file_name`] for more details.
1522:     /// [`PathBuf`]: struct.PathBuf.html
1523:     /// [`PathBuf::set_file_name`]: struct.PathBuf.html#method.set_file_name
1525:     pub fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf {
1529:     fn _with_file_name(&self, file_name: &OsStr) -> PathBuf {
1535:     /// Creates an owned [`PathBuf`] like `self` but with the given extension.
1537:     /// See [`PathBuf::set_extension`] for more details.
1539:     /// [`PathBuf`]: struct.PathBuf.html
1540:     /// [`PathBuf::set_extension`]: struct.PathBuf.html#method.set_extension
1542:     pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
1546:     fn _with_extension(&self, extension: &OsStr) -> PathBuf {
1594:     /// Returns an object that implements [`Display`] for safely printing paths
1636:     pub fn canonicalize(&self) -> io::Result<PathBuf> {
1647:     pub fn read_link(&self) -> io::Result<PathBuf> {
1722:     /// [`PathBuf`]: struct.PathBuf.html
1726:         PathBuf { inner: OsString::from(inner) }
1742: /// Helper struct for safely printing paths with [`format!`] and `{}`.
1922: impl_cmp_os_str!(PathBuf, OsStr);
1923: impl_cmp_os_str!(PathBuf, &'a OsStr);
1924: impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
1925: impl_cmp_os_str!(PathBuf, OsString);
github.com/apache/flex-sdk:frameworks/projects/spark/src/spark/primitives/Path.as: [ master, ]
64: public class Path extends FilledElement
82:     public function Path()
1196: class PathSegmentsCollection
1214: public function PathSegmentsCollection(value:String)
1540: public function generateGraphicsPath(graphicsPath:GraphicsPath,
1742: public function PathSegment(_x:Number = 0, _y:Number = 0)
39:  *  The Path class is a filled graphic element that draws a series of path segments.
40:  *  In vector graphics, a path is a series of points connected by straight or curved line segments. 
41:  *  Together the lines form an image. In Flex, you use the Path class to define a complex vector shape 
44:  *  <p>Typically, the first element of a path definition is a Move segment to specify the starting pen 
51:  *  point of the line. You can use multiple Move segments in the path definition to 
54:  *  <p>The syntax used by the Path class to define the shape is the same as the SVG path syntax, 
94:      *  Dirty flag to indicate when path data has changed. 
105:      *  path segment information  
116:      *  commands to draw this Path.  
118:      *  The data commands expressed in a Path's <code>data</code> 
140:      *  A string containing a compact represention of the path segments. This is an alternate
144:      *  <p>The value is a space-delimited string describing each path segment. Each
198:      *      <td>Close path</td>
201:      *      <td>Closes off the path.</td>
245:      *  Fill rule for intersecting or overlapping path segments. 
322:      *  Returns the bounding box for the path including stroke, if the path is resized
406:      *  @return Returns the axis aligned bounding box of the path when
420:         // then the non-stroked path bounds for the give size can be
556:         // slow code-path Player execution for all graphics in that DisplayObject.
708:      *  if the path is resized to the specified size.
947:         // Resize transformed path with the iterative solution
962:         // the path size as the size changes the angles of the joints.
1193:  *  Path segments.
1452:  *  A Vector of the actual path segments. May be empty, but always non-null. 
1510:     // If path is empty, it's untransformed bounding box is (0,0), so we return transformed point (0,0)
1522:  *  array and draws each path egment based on its control points. 
1524:  *  Segments are drawn from the x and y position of the path. 
1526:  *  applied to the path. 
1529:  *  path segment should be drawn
1532:  *  path segment should be drawn
1535:  *  this path segment 
1538:  *  path segment
1550:     // the path will begin at the previous pen location
1712:  *  The PathSegment class is the base class for a segment of a path.
1794:  *  Draws this path segment. You can determine the current pen position by 
1817:  *  path segment.
24: import flash.display.GraphicsPath;
55:  *  which makes it easy to convert SVG paths to Flex paths.</p>
112:     private var segments:PathSegmentsCollection;
115:      *  A GraphicsPath object that contains the drawing 
123:     mx_internal var graphicsPath:GraphicsPath = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
218:         segments = new PathSegmentsCollection(value);
392:     private function tangentIsValid(prevSegment:PathSegment, curSegment:PathSegment,
418:         var pathBBox:Rectangle;
424:             pathBBox = new Rectangle(naturalBounds.x * sx,
429:                 pathBBox.offset(m.tx, m.ty);
433:             pathBBox = this.segments.getBoundingBox(width, height, m);
439:             return pathBBox;
441:         // Always add half the stroke weight, even for miter limit paths,
445:         pathBBox.inflate(strokeExtents.right, strokeExtents.bottom);
447:         var seg:Vector.<PathSegment> = segments.data;
453:             return pathBBox;
473:                 var prevSegment:PathSegment = start > 0 ? seg[start - 1] : null;
482:             var startSegment:PathSegment = seg[start];
519:             var endSegment:PathSegment = seg[end];
531:                     pathBBox);
538:         return pathBBox;
582:     private function addMiterLimitStrokeToBounds(segment0:PathSegment,
583:                                                  segment1:PathSegment,
584:                                                  segment2:PathSegment,
939:         // We have special handling for miter-limit stroked non-transformed paths,
1098:                 segments.generateGraphicsPath(graphicsPath, drawX, drawY, sx, sy);
1102:         g.drawPath(graphicsPath.commands, graphicsPath.data, winding);
1187: //  Internal Helper Class - PathSegmentsCollection
1194:  *  Provides methods for generating GraphicsPath and calculating bounds. 
1218:         _segments = new Vector.<PathSegment>();
1222:     var newSegments:Vector.<PathSegment> = new Vector.<PathSegment>();
1418:                 _segments = new Vector.<PathSegment>();
1449: private var _segments:Vector.<PathSegment>;
1454: public function get data():Vector.<PathSegment>
1499:     var prevSegment:PathSegment;
1500:     var pathBBox:Rectangle;
1505:         var segment:PathSegment = _segments[i];
1506:         pathBBox = segment.getBoundingBox(prevSegment, sx, sy, m, pathBBox);
1511:     if (!pathBBox)
1515:         pathBBox = new Rectangle(x, y);
1517:     return pathBBox;
1546:     graphicsPath.commands = null;
1547:     graphicsPath.data = null;
1552:     graphicsPath.moveTo(tx, ty);
1554:     var curSegment:PathSegment;
1555:     var prevSegment:PathSegment;
1561:         curSegment.draw(graphicsPath, tx, ty, sx, sy, prevSegment);
1702: //  Internal Helper Class - PathSegment 
1705: import flash.display.GraphicsPath;
1721: class PathSegment extends Object
1805: public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
1824: public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number, m:Matrix, rect:Rectangle):Rectangle
1839: public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
1853: import flash.display.GraphicsPath;
1869: class LineSegment extends PathSegment
1911: override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
1913:     graphicsPath.lineTo(dx + x*sx, dy + y*sy);
1924: override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number, m:Matrix, rect:Rectangle):Rectangle
1952: override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
1967: import flash.display.GraphicsPath;
1981: class MoveSegment extends PathSegment
2024: override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
2026:     graphicsPath.moveTo(dx+x*sx, dy+y*sy);
2036: import flash.display.GraphicsPath;
2061: class CubicBezierSegment extends PathSegment
2198:     override public function draw(graphicsPath:GraphicsPath, dx:Number, dy:Number, sx:Number, sy:Number, prev:PathSegment):void
2202:         graphicsPath.curveTo(dx + qPts.control1.x*sx, dy+qPts.control1.y*sy, dx+qPts.anchor1.x*sx, dy+qPts.anchor1.y*sy)...(1 bytes skipped)...
2203:         graphicsPath.curveTo(dx + qPts.control2.x*sx, dy+qPts.control2.y*sy, dx+qPts.anchor2.x*sx, dy+qPts.anchor2.y*sy)...(1 bytes skipped)...
2204:         graphicsPath.curveTo(dx + qPts.control3.x*sx, dy+qPts.control3.y*sy, dx+qPts.anchor3.x*sx, dy+qPts.anchor3.y*sy)...(1 bytes skipped)...
2205:         graphicsPath.curveTo(dx + qPts.control4.x*sx, dy+qPts.control4.y*sy, dx+qPts.anchor4.x*sx, dy+qPts.anchor4.y*sy)...(1 bytes skipped)...
2216:     override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number,
2252:     override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
2318:     private function getQuadraticPoints(prev:PathSegment):QuadraticPoints
2411: import flash.display.GraphicsPath;
2431: class QuadraticBezierSegment extends PathSegment
2526:     override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
2528:         graphicsPath.curveTo(dx+control1X*sx, dy+control1Y*sy, dx+x*sx, dy+y*sy);
2574:     override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
2591:     override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number,
101:     private var graphicsPathChanged:Boolean = true;
220:         graphicsPathChanged = true;
246:      *  Possible values are <code>GraphicsPathWinding.EVEN_ODD</code> or <code>GraphicsPathWinding.NON_ZERO</code>.
250:      *  @see flash.display.GraphicsPathWinding 
262:             graphicsPathChanged = true;
1085:             graphicsPathChanged = true;
1092:         if (graphicsPathChanged)
1099:             graphicsPathChanged = false;
1139:         graphicsPathChanged = true;
github.com/GNOME/gimp:tools/gimppath2svg.py: [ mainline, ]
43: class Path:
114: path = Path()
30: <path id="%s" transform="translate (%d,%d)"
55:             path.name = namematch.group(1)
59:                path.gimppoints.append ([])
61:             path.gimppoints[-1].append (map (int, pointmatch.groups()))
71:       for path in self.gimppoints:
72:          if path:
73:             start = path[0]
75:             path = path[1:]
76:             while path:
77:                curve = path [0:3]
78:                path = path[3:]
115: path.readgimpfile (infile)
116: path.makesvg()
117: path.writesvgfile (outfile)
6: gimppath2svg.py -- Converts Gimp-Paths to a SVG-File.
23: Usage: gimppath2svg.py [infile [outfile]]
46:       self.svgpath = ""
89:             self.svgpath = self.svgpath + svg
92:       if self.svgpath:
97:                               self.svgpath)
github.com/GNOME/librsvg:rsvg_internals/src/path_builder.rs: [ mainline, ]
456: pub struct Path {
547: impl Path {
440:     path_commands: TinyVec<[PathCommand; 32]>,
482:     pub fn into_path(self) -> Path {
542:     pub fn close_path(&mut self) {
331: pub enum PathCommand {
336:     ClosePath,
339: impl Default for PathCommand {
345: impl PathCommand {
439: pub struct PathBuilder {
472:     ClosePath,
475: impl PathBuilder {
27:     /// The (x, y) coordinates of the end point of this path segment.
88:     /// The (x, y) coordinates for the start point of this path segment.
90:     /// The (x, y) coordinates for the end point of this path segment.
352:             PathCommand::ClosePath => cr.close_path(),
356:     // Returns the number of coordinate values that this command will generate in a `Path`.
434: /// Constructs a path out of commands.
436: /// When you are finished constructing a path builder, turn it into
437: /// a `Path` with `into_path`.
443: /// An immutable path with a compact representation.
446: /// can get an iterator for the path's commands with the `iter`
461: /// Packed version of a `PathCommand`, used in `Path`.
478:             path_commands: TinyVec::new(),
484:             .path_commands
491:             .path_commands
496:         Path {
503:         self.path_commands.push(PathCommand::MoveTo(x, y));
507:         self.path_commands.push(PathCommand::LineTo(x, y));
516:         self.path_commands.push(PathCommand::CurveTo(curve));
539:         self.path_commands.push(PathCommand::Arc(arc));
543:         self.path_commands.push(PathCommand::ClosePath);
566:         // We check the cr's status right after feeding it a new path for a few reasons:
568:         // * Any of the individual path commands may cause the cr to enter an error state, for
599:         let path = builder.into_path();
600:         assert!(path.is_empty());
601:         assert_eq!(path.iter().count(), 0);
621:         builder.close_path();
622:         let path = builder.into_path();
623:         assert!(path.iter().eq(vec![
1: //! Representation of Bézier paths.
341:         PathCommand::CurveTo(CubicBezierCurve::default())
348:             PathCommand::MoveTo(x, y) => cr.move_to(x, y),
349:             PathCommand::LineTo(x, y) => cr.line_to(x, y),
350:             PathCommand::CurveTo(curve) => curve.to_cairo(cr),
351:             PathCommand::Arc(arc) => arc.to_cairo(cr),
359:             PathCommand::MoveTo(..) => 2,
360:             PathCommand::LineTo(..) => 2,
361:             PathCommand::CurveTo(_) => 6,
362:             PathCommand::Arc(_) => 7,
363:             PathCommand::ClosePath => 0,
369:             PathCommand::MoveTo(x, y) => {
375:             PathCommand::LineTo(x, y) => {
381:             PathCommand::CurveTo(ref c) => c.to_packed_and_coords(coords),
383:             PathCommand::Arc(ref a) => a.to_packed_and_coords(coords),
385:             PathCommand::ClosePath => PackedCommand::ClosePath,
389:     fn from_packed<'a>(packed: PackedCommand, coords: &mut slice::Iter<'a, f64>) -> PathCommand {
394:                 PathCommand::MoveTo(x, y)
400:                 PathCommand::LineTo(x, y)
403:             PackedCommand::CurveTo => PathCommand::CurveTo(CubicBezierCurve::from_coords(coords)),
405:             PackedCommand::ClosePath => PathCommand::ClosePath,
407:             PackedCommand::ArcSmallNegative => PathCommand::Arc(EllipticalArc::from_coords(
413:             PackedCommand::ArcSmallPositive => PathCommand::Arc(EllipticalArc::from_coords(
419:             PackedCommand::ArcLargeNegative => PathCommand::Arc(EllipticalArc::from_coords(
425:             PackedCommand::ArcLargePositive => PathCommand::Arc(EllipticalArc::from_coords(
445: /// This is constructed from a `PathBuilder` once it is finished.  You
449: /// Most `PathCommand` variants only have a few coordinates, but `PathCommand::Arc`
454: /// Each `PathCommand` knows how many coordinates it ought to produce, with
476:     pub fn new() -> PathBuilder {
477:         PathBuilder {
486:             .map(PathCommand::num_coordinates)
548:     pub fn iter<'a>(&'a self) -> impl Iterator<Item = PathCommand> + 'a {
552:         commands.map(move |cmd| PathCommand::from_packed(*cmd, &mut coords))
598:         let builder = PathBuilder::new();
606:         let mut builder = PathBuilder::new();
624:             PathCommand::MoveTo(42.0, 43.0),
625:             PathCommand::LineTo(42.0, 43.0),
626:             PathCommand::CurveTo(CubicBezierCurve {
631:             PathCommand::Arc(EllipticalArc {
639:             PathCommand::ClosePath,
github.com/google/go-cmp:cmp/path.go: [ master, ]
26: type Path []PathStep
34: type PathStep interface {
151: type pathStep struct {
172: 	pathStep
211: 	pathStep
256: 	pathStep
270: 	pathStep
280: 	pathStep
290: 	pathStep
335: type pointerPath struct {
17: // Path is a list of PathSteps describing the sequence of operations to get
19: // The first Path element is always an operation-less PathStep that exists
37: 	// Type is the resulting type after performing the path step.
40: 	// Values is the resulting values after performing the path step.
65: func (pa *Path) push(s PathStep) {
69: func (pa *Path) pop() {
73: // Last returns the last PathStep in the Path.
74: // If the path is empty, this returns a non-nil PathStep that reports a nil Type.
75: func (pa Path) Last() PathStep {
79: // Index returns the ith step in the Path and supports negative indexing.
80: // A negative index starts counting from the tail of the Path such that -1
83: func (pa Path) Index(i int) PathStep {
93: // String returns the simplified path to a node.
94: // The simplified path only contains struct field accesses.
98: func (pa Path) String() string {
108: // GoString returns the path to a specific node using Go syntax.
112: func (pa Path) GoString() string {
329: // Path for whether px was ever encountered in the Path history of x, and
334: // in O(1) instead of O(N) where N is len(Path).
28: // PathStep is a union-type for specific operations to traverse
57: 	_ PathStep = StructField{}
58: 	_ PathStep = SliceIndex{}
59: 	_ PathStep = MapIndex{}
60: 	_ PathStep = Indirect{}
61: 	_ PathStep = TypeAssertion{}
62: 	_ PathStep = Transform{}
82: // If index is invalid, this returns a non-nil PathStep that reports a nil Type.
88: 		return pathStep{}
116: 		var nextStep PathStep
156: func (ps pathStep) Type() reflect.Type             { return ps.typ }
157: func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy }
158: func (ps pathStep) String() string {
308: // pointerPath represents a dual-stack of pointers encountered when
313: // The pointerPath uses a map to represent a stack; where descension into a
331: // equal if both px and py have a cycle resulting from the same PathStep.
342: func (p *pointerPath) Init() {
354: func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) {
369: func (p pointerPath) Pop(vx, vy reflect.Value) {
chromium.googlesource.com/infra/third_party/virtualenv:src/virtualenv/util/path/_pathlib/via_os_path.py: [ master, ]
12: class Path(object):
13:     def __init__(self, path):
14:         if isinstance(path, Path):
15:             _path = path._path
17:             _path = ensure_text(path)
19:                 _path = _path.encode("utf-8")
20:         self._path = _path
23:         return ensure_str("Path({})".format(ensure_text(self._path)))
26:         return ensure_text(self._path)
29:         return ensure_str(self._path)
32:         if isinstance(other, Path):
33:             right = other._path
38:         return Path(os.path.join(self._path, right))
44:         return self._path == (other._path if isinstance(other, Path) else None)
50:         return hash(self._path)
53:         return os.path.exists(self._path)
57:         return Path(os.path.abspath(os.path.join(self._path, os.path.pardir)))
60:         return Path(os.path.realpath(self._path))
64:         return os.path.basename(self._path)
68:         return self._path.split(os.sep)
71:         return os.path.isfile(self._path)
74:         return os.path.isdir(self._path)
78:             os.makedirs(self._path)
87:         with open(self._path, "rb") as file_handler:
91:         with open(self._path, "wb") as file_handler:
98:         for p in os.listdir(self._path):
99:             yield Path(os.path.join(self._path, p))
103:         _, ext = os.path.splitext(self.name)
108:         base, _ = os.path.splitext(self.name)
113:         with open(self._path, mode) as file_handler:
121:             result.append(Path(os.sep.join(parts[0 : i + 1])))
125:         os.remove(self._path)
131:         return os.path.islink(self._path)
134:         if not self._path.startswith(other._path):
135:             raise ValueError("{} does not start with {}".format(self._path, other._path))
136:         return Path(os.sep.join(self.parts[len(other.parts) :]))
139:         return os.stat(self._path)
142:         os.chmod(self._path, mode)
145:         return Path(os.path.abspath(self._path))
148: __all__ = ("Path",)
android.googlesource.com/platform/external/python/parse_type:tasks/_vendor/path.py: [ master, ]
176: class Path(text_type):
1717: class path(Path):
294:     def abspath(self):
302:     def normpath(self):
306:     def realpath(self):
383:     def splitpath(self):
441:     def joinpath(cls, first, *others):
475:     def relpath(self, start='.'):
1141:         def pathconf(self, name):
482:     def relpathto(self, dest):
2: # SOURCE: https://pypi.python.org/pypi/path.py
27: path.py - An object representing a path to a file or directory.
29: https://github.com/jaraco/path.py
33:     from path import Path
34:     d = Path('/home/guido/bin')
113: __all__ = ['Path', 'CaseInsensitivePattern']
126:     __version__ = pkg_resources.require('path.py')[0].version
143:     Save results for the :meth:'path.using_module' classmethod.
178:     Represents a filesystem path.
181:     counterparts in :mod:`os.path`.
185:     such that they will be bound to the Path instance. For example,
186:     ``Path(src).copy(target)`` is equivalent to
189:     the Path instance.
192:     module = os.path
193:     """ The path module to use for path operations.
195:     .. seealso:: :mod:`os.path`
200:             raise TypeError("Invalid initial value for path: None")
221:     def _always_unicode(cls, path):
223:         Ensure the path as retrieved from a Python API, such as :func:`os.listdir`,
226:         if PY3 or isinstance(path, text_type):
227:             return path
228:         return path.decode(sys.getfilesystemencoding(), 'surrogateescape')
233:         return '%s(%s)' % (type(self).__name__, super(Path, self).__repr__())
235:     # Adding a Path and a string yields a Path.
238:             return self._next_class(super(Path, self).__add__(more))
251:         Join two path components, adding a separator character if
254:         .. seealso:: :func:`os.path.join`
265:         Join two path components, adding a separator character if
268:         .. seealso:: :func:`os.path.join`
285:         """ Return the current working directory as a path object.
292:     # --- Operations on Path strings.
295:         """ .. seealso:: :func:`os.path.abspath` """
299:         """ .. seealso:: :func:`os.path.normcase` """
303:         """ .. seealso:: :func:`os.path.normpath` """
307:         """ .. seealso:: :func:`os.path.realpath` """
311:         """ .. seealso:: :func:`os.path.expanduser` """
315:         """ .. seealso:: :func:`os.path.expandvars` """
319:         """ .. seealso:: :attr:`parent`, :func:`os.path.dirname` """
323:         """ .. seealso:: :attr:`name`, :func:`os.path.basename` """
340:         ``Path('/home/guido/python.tar.gz').name == 'python.tar.gz'``,
342:         ``Path('/home/guido/python.tar.gz').namebase == 'python.tar'``.
364:         """ This path's parent directory, as a new Path object.
367:         ``Path('/usr/local/lib/libpython.so').parent ==
368:         Path('/usr/local/lib')``
370:         .. seealso:: :meth:`dirname`, :func:`os.path.dirname`
375:         """ The name of this file or directory without the full path.
378:         ``Path('/usr/local/lib/libpython.so').name == 'libpython.so'``
380:         .. seealso:: :meth:`basename`, :func:`os.path.basename`
386:         .. seealso:: :attr:`parent`, :attr:`name`, :func:`os.path.split`
394:         Split the drive specifier from this path.  If there is
396:         is simply ``(Path(''), p)``.  This is always the case on Unix.
398:         .. seealso:: :func:`os.path.splitdrive`
406:         Split the filename extension from this path and return
410:         last path segment.  This has the property that if
413:         .. seealso:: :func:`os.path.splitext`
419:         """ p.stripext() -> Remove one file extension from the path.
421:         For example, ``Path('/home/guido/python.tar.gz').stripext()``
422:         returns ``Path('/home/guido/python.tar')``.
427:         """ .. seealso:: :func:`os.path.splitunc` """
434:         The UNC mount point for this path.
443:         Join first to zero or more :class:`Path` components, adding a separator
447:         .. seealso:: :func:`os.path.join`
454:         r""" Return a list of the path components in this path.
456:         The first item in the list will be a Path.  Its value will be
458:         directory of this path (for example, ``'/'`` or ``'C:\\'``).  The
461:         ``path.Path.joinpath(*result)`` will yield the original path.
476:         """ Return this path as a relative path,
483:         """ Return a relative path from `self` to `dest`.
485:         If there is no relative path from `self` to `dest`, for example if
528:         The elements of the list are Path objects.
546:         The elements of the list are Path objects.
559:         The elements of the list are Path objects.
572:         The iterator yields Path objects naming each child item of
713:             attribute, it is applied to the name and path prior to comparison.
717:             to :meth:`os.path.normcase`.
728:         """ Return a list of Path objects that match the pattern.
730:         `pattern` - a path relative to this directory, with wildcards.
732:         For example, ``Path('/users').glob('*/bin/*')`` returns a list
766:                >>> for chunk in Path("path.py").chunks(8192, mode='rb'):
902:         By default this overwrites any existing file at this path.
956:         """ Returns a hash object for the file at the current path.
987:     # N.B. On some platforms, the os.path functions may be implemented in C
992:         """ .. seealso:: :func:`os.path.isabs` """
996:         """ .. seealso:: :func:`os.path.exists` """
1000:         """ .. seealso:: :func:`os.path.isdir` """
1004:         """ .. seealso:: :func:`os.path.isfile` """
1008:         """ .. seealso:: :func:`os.path.islink` """
1012:         """ .. seealso:: :func:`os.path.ismount` """
1016:         """ .. seealso:: :func:`os.path.samefile` """
1018:             other = Path(other).realpath().normpath().normcase()
1023:         """ .. seealso:: :attr:`atime`, :func:`os.path.getatime` """
1030:         .. seealso:: :meth:`getatime`, :func:`os.path.getatime`
1034:         """ .. seealso:: :attr:`mtime`, :func:`os.path.getmtime` """
1041:         .. seealso:: :meth:`getmtime`, :func:`os.path.getmtime`
1045:         """ .. seealso:: :attr:`ctime`, :func:`os.path.getctime` """
1052:         .. seealso:: :meth:`getctime`, :func:`os.path.getctime`
1056:         """ .. seealso:: :attr:`size`, :func:`os.path.getsize` """
1063:         .. seealso:: :meth:`getsize`, :func:`os.path.getsize`
1068:             """ Return ``True`` if current user has access to this path.
1078:         """ Perform a ``stat()`` system call on this path.
1134:             """ Perform a ``statvfs()`` system call on this path.
1322:             """ Return the path to which this symbolic link points.
1324:             The result may be an absolute or a relative path.
1331:             """ Return the path to which this symbolic link points.
1333:             The result is always an absolute path.
1345:     # Path(name).copy(target) will invoke shutil.copy(name, target)
1432:             p = Path(filename)
1506:             dir = Path.special().user.config
1514:             dir = Path.special("My App").user.config.makedirs_p()
1531:     def __init__(self, path_class, *args, **kwargs):
1539:             path_class=path_class,
1549:         result wrapped in self.path_class
1553:         MultiPath = Multi.for_class(self.path_class)
1559:     A mix-in for a Path which may contain multiple Path separated by pathsep.
1562:     def for_class(cls, path_cls):
1563:         name = 'Multi' + path_cls.__name__
1566:         return type(name, (cls, path_cls), {})
1590: class tempdir(Path):
1598:             # do stuff with the Path object "d"
1608:         return Path
1707:         from path import Path, CaseInsensitivePattern as ci
1708:         Path('.').files(ci('*.py'))
1719:         msg = "path is deprecated. Use Path instead."
1721:         return Path.__new__(cls, *args, **kwargs)
1724: __all__ += ['path']
247:     # The / operator joins Paths.
249:         """ fp.__div__(rel) == fp / rel == fp.joinpath(rel)
261:     # The / operator joins Paths the other way around
296:         return self._next_class(self.module.abspath(self))
304:         return self._next_class(self.module.normpath(self))
308:         return self._next_class(self.module.realpath(self))
328:         :meth:`expanduser()`, and :meth:`normpath()` on it.
333:         return self.expandvars().expanduser().normpath()
384:         """ p.splitpath() -> Return ``(p.parent, p.name)``.
435:         This is empty for paths on local drives.
467:             loc, child = prev.splitpath()
487:         ``dest.abspath()``.
489:         origin = self.abspath()
490:         dest = self._next_class(dest).abspath()
500:         # Find the location where the two paths start to differ.
507:         # Now i is the point where the two paths diverge.
515:             relpath = os.curdir
517:             relpath = self.module.join(*segments)
518:         return self._next_class(relpath)
1019:             return self.realpath().normpath().normcase() == other
1140:     if hasattr(os, 'pathconf'):
1142:             """ .. seealso:: :func:`os.pathconf` """
1143:             return os.pathconf(self, name)
1303:         def link(self, newpath):
1304:             """ Create a hard link at `newpath`, pointing to this file.
1308:             os.link(self, newpath)
1309:             return self._next_class(newpath)
1341:                 return (self.parent / p).abspath()
1510:         the paths in a platform-friendly way.
1524:         def __init__(self, paths, scope):
1525:             self.paths = paths
1529:             return self.paths.get_dir(self.scope, class_)
1554:         return MultiPath.detect(value)
1570:         if os.pathsep not in input:
1575:         return iter(map(self._next_class, self.split(os.pathsep)))
1713:         return __import__('ntpath').normcase
480:         return cwd.relpathto(self)
android.googlesource.com/platform/external/go-cmp:cmp/path.go: [ master, ]
26: type Path []PathStep
34: type PathStep interface {
151: type pathStep struct {
172: 	pathStep
211: 	pathStep
256: 	pathStep
270: 	pathStep
280: 	pathStep
290: 	pathStep
335: type pointerPath struct {
17: // Path is a list of PathSteps describing the sequence of operations to get
19: // The first Path element is always an operation-less PathStep that exists
37: 	// Type is the resulting type after performing the path step.
40: 	// Values is the resulting values after performing the path step.
65: func (pa *Path) push(s PathStep) {
69: func (pa *Path) pop() {
73: // Last returns the last PathStep in the Path.
74: // If the path is empty, this returns a non-nil PathStep that reports a nil Type.
75: func (pa Path) Last() PathStep {
79: // Index returns the ith step in the Path and supports negative indexing.
80: // A negative index starts counting from the tail of the Path such that -1
83: func (pa Path) Index(i int) PathStep {
93: // String returns the simplified path to a node.
94: // The simplified path only contains struct field accesses.
98: func (pa Path) String() string {
108: // GoString returns the path to a specific node using Go syntax.
112: func (pa Path) GoString() string {
329: // Path for whether px was ever encountered in the Path history of x, and
334: // in O(1) instead of O(N) where N is len(Path).
28: // PathStep is a union-type for specific operations to traverse
57: 	_ PathStep = StructField{}
58: 	_ PathStep = SliceIndex{}
59: 	_ PathStep = MapIndex{}
60: 	_ PathStep = Indirect{}
61: 	_ PathStep = TypeAssertion{}
62: 	_ PathStep = Transform{}
82: // If index is invalid, this returns a non-nil PathStep that reports a nil Type.
88: 		return pathStep{}
116: 		var nextStep PathStep
156: func (ps pathStep) Type() reflect.Type             { return ps.typ }
157: func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy }
158: func (ps pathStep) String() string {
308: // pointerPath represents a dual-stack of pointers encountered when
313: // The pointerPath uses a map to represent a stack; where descension into a
331: // equal if both px and py have a cycle resulting from the same PathStep.
342: func (p *pointerPath) Init() {
354: func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) {
369: func (p pointerPath) Pop(vx, vy reflect.Value) {
chromium.googlesource.com/arc/arc:third_party/android/frameworks/base/libs/hwui/PathCache.h: [ master, ]
120:         struct Path {
122:         } path;
284:         const SkPath path;
49:     #define PATH_LOGD(...) ALOGD(__VA_ARGS__)
51:     #define PATH_LOGD(...)
230:     typedef Pair<SkPath*, SkPath*> path_pair_t;
61: struct PathTexture: public Texture {
62:     PathTexture(Caches& caches): Texture(caches) {
107:     kShapePath
110: struct PathDescription {
118:     SkPathEffect* pathEffect;
121:             const SkPath* mPath;
160: class PathCache: public OnEntryRemoved<PathDescription, PathTexture*> {
272:     class PathTask: public Task<SkBitmap*> {
274:         PathTask(const SkPath* path, const SkPaint* paint, PathTexture* texture):
291:     class PathProcessor: public TaskProcessor<SkBitmap*> {
18: #define ANDROID_HWUI_PATH_CACHE_H
65:     ~PathTexture() {
278:         ~PathTask() {
294:         ~PathProcessor() { }
17: #ifndef ANDROID_HWUI_PATH_CACHE_H
59:  * Alpha texture used to represent a path.
70:      * Left coordinate of the path bounds.
74:      * Top coordinate of the path bounds.
78:      * Offset to draw the path at the correct origin.
169:     void operator()(PathDescription& path, PathTexture*& texture);
195:     PathTexture* get(const SkPath* path, const SkPaint* paint);
198:      * Removes the specified path. This is meant to be called from threads
201:     void removeDeferred(SkPath* path);
219:      * Precaches the specified path using background threads.
221:     void precache(const SkPath* path, const SkPaint* paint);
223:     static bool canDrawAsConvexPath(SkPath* path, const SkPaint* paint);
224:     static void computePathBounds(const SkPath* path, const SkPaint* paint,
233:             const SkPath *path, const SkPaint* paint);
249:      * The pair must define first=path, second=sourcePath
251:     void remove(Vector<PathDescription>& pathsToRemove, const path_pair_t& pair);
275:             path(*path), paint(*paint), texture(texture) {
282:         // copied, since input path not refcounted / guaranteed to survive for duration of task
311:     Vector<path_pair_t> mGarbage;
318: #endif // ANDROID_HWUI_PATH_CACHE_H
35: class SkPath;
48: #if DEBUG_PATHS
98: }; // struct PathTexture
111:     DESCRIPTION_TYPE(PathDescription);
149:     PathDescription();
150:     PathDescription(ShapeType shapeType, const SkPaint* paint);
162:     PathCache();
163:     ~PathCache();
189:     PathTexture* getRoundRect(float width, float height, float rx, float ry, const SkPaint* paint);
190:     PathTexture* getCircle(float radius, const SkPaint* paint);
191:     PathTexture* getOval(float width, float height, const SkPaint* paint);
192:     PathTexture* getRect(float width, float height, const SkPaint* paint);
193:     PathTexture* getArc(float width, float height, float startAngle, float sweepAngle,
232:     PathTexture* addTexture(const PathDescription& entry,
234:     PathTexture* addTexture(const PathDescription& entry, SkBitmap* bitmap);
240:     void generateTexture(const PathDescription& entry, SkBitmap* bitmap, PathTexture* texture,
243:     PathTexture* get(const PathDescription& entry) {
259:     void removeTexture(PathTexture* texture);
288:         PathTexture* texture;
293:         PathProcessor(Caches& caches);
302:     LruCache<PathDescription, PathTexture*> mCache;
309:     sp<PathProcessor> mProcessor;
313: }; // class PathCache
chromium.googlesource.com/chromium/src/third_party:blink/web_tests/hittesting/image-with-clip-path.html: [ master, ]
54:             <path id="path" d="M 0 0 L 100 100 L 100 0Z" />
58: <img id="imageWithReferenceClipPath" class="referenceClipPath" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAX...(47 bytes skipped)...
59: <img id="imageWithShapeClipPath" class="shapeClipPath" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAX...(47 bytes skipped)...
61:     <img id="transformedWithReferenceClipPath" class="referenceClipPath" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAX...(47 bytes skipped)...
62:     <img id="transformedWithShapeClipPath" class="shapeClipPath" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAX...(47 bytes skipped)...
53:         <clipPath id="referenceClipPathTopLeft" clipPathUnits="objectBoundingBox">
6:         -webkit-clip-path: url(#referenceClipPathTopLeft);
7:         clip-path: url(#referenceClipPathTopLeft);
16:         -webkit-clip-path: polygon(0% 0%, 100% 100%, 100% 0%);
17:         clip-path: polygon(0% 0%, 100% 100%, 100% 0%);
68:     // Check that clip path affects hit testing for the first row of images.
70:     // (75,125) is outside the triangular clip path, (125,75) is inside it.
73:     // Same test as above but for a shape-based clip path offset by 100px.
77:     // Check that clip path affects hit testing for the second row. These
81:     // (100,255) and (135,175) are outside the triangular clip path.
82:     // (115,175) and (120,225) are inside the triangular clip path.
87:     // Same test as above but for a shape-based clip path offset by 100px.
5:     .referenceClipPath {
12:     .referenceClipPath:hover {
15:     .shapeClipPath {
22:     .shapeClipPath:hover {
25:     #imageWithReferenceClipPath {
29:     #imageWithShapeClipPath {
39:     #transformedWithReferenceClipPath {
44:     #transformedWithShapeClipPath {
55:         </clipPath>
71:     assert_not_equals(document.elementFromPoint(75, 125).id, "imageWithReferenceClipPath");
72:     assert_equals(document.elementFromPoint(125, 75).id, "imageWithReferenceClipPath");
74:     assert_not_equals(document.elementFromPoint(75+100, 125).id, "imageWithShapeClipPath");
75:     assert_equals(document.elementFromPoint(125+100, 75).id, "imageWithShapeClipPath");
83:     assert_not_equals(document.elementFromPoint(100, 225).id, "transformedWithReferenceClipPath");
84:     assert_not_equals(document.elementFromPoint(135, 175).id, "transformedWithReferenceClipPath");
85:     assert_equals(document.elementFromPoint(115, 175).id, "transformedWithReferenceClipPath");
86:     assert_equals(document.elementFromPoint(120, 225).id, "transformedWithReferenceClipPath");
88:     assert_not_equals(document.elementFromPoint(100+100, 225).id, "transformedWithShapeClipPath");
89:     assert_not_equals(document.elementFromPoint(135+100, 175).id, "transformedWithShapeClipPath");
90:     assert_equals(document.elementFromPoint(115+100, 175).id, "transformedWithShapeClipPath");
91:     assert_equals(document.elementFromPoint(120+100, 225).id, "transformedWithShapeClipPath");
android.googlesource.com/platform/tools/gpu:service/path/path_binary.go: [ master, ]
6: package path
76: 		o.Array = obj.(Path)
113: 	Package: "path",
116: 		{Declared: "Array", Type: &schema.Interface{Name: "Path"}},
163: 	Package: "path",
218: 	Package: "path",
284: 	Package: "path",
334: 	Package: "path",
383: 	Package: "path",
412: 		o.Struct = obj.(Path)
449: 	Package: "path",
452: 		{Declared: "Struct", Type: &schema.Interface{Name: "Path"}},
505: 	Package: "path",
554: 	Package: "path",
592: 		o.Map = obj.(Path)
633: 	Package: "path",
636: 		{Declared: "Map", Type: &schema.Interface{Name: "Path"}},
722: 	Package: "path",
780: 	Package: "path",
812: 		o.Array = obj.(Path)
857: 	Package: "path",
860: 		{Declared: "Array", Type: &schema.Interface{Name: "Path"}},
914: 	Package: "path",
963: 	Package: "path",
github.com/GNOME/gegl:gegl/property-types/gegl-path.c: [ mainline, ]
42:   GeglPathList *path;
44:   GeglPathList *flat_path; /*< cache of flat path */
1005: gegl_path_get_path (GeglPath *path)
1013: gegl_path_get_flat_path (GeglPath *path)
1719: #define GEGL_PARAM_PATH(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_PARAM_PATH, GeglParamPath))
1769: gegl_param_spec_path   (const gchar *name,
1722: typedef struct _GeglParamPath GeglParamPath;
1724: struct _GeglParamPath
45:   gboolean      flat_path_clean;
65: #define GEGL_PATH_GET_PRIVATE(o) \
70:   GEGL_PATH_CHANGED,
71:   GEGL_PATH_LAST_SIGNAL
74: guint gegl_path_signals[GEGL_PATH_LAST_SIGNAL] = { 0 };
189: gegl_path_init (GeglPath *self)
201: gegl_path_class_init (GeglPathClass *klass)
262: gegl_path_new (void)
269: gegl_path_new_from_string (const gchar *path_string)
277: gegl_path_is_empty (GeglPath *path)
284: gegl_path_get_n_nodes  (GeglPath *vector)
301: gegl_path_get_length (GeglPath *self)
317: gegl_path_get_node (GeglPath     *vector,
347: gegl_path_to_string (GeglPath  *vector)
398: gegl_path_set_matrix (GeglPath    *path,
413: void gegl_path_get_matrix (GeglPath    *path,
421: gegl_path_closest_point (GeglPath *path,
513: gegl_path_calc (GeglPath   *self,
558: gegl_path_calc_values (GeglPath *self,
571: gegl_path_get_bounds (GeglPath *self,
633: gegl_path_foreach (GeglPath     *vector,
650: gegl_path_foreach_flat (GeglPath     *vector,
668: gegl_path_clear (GeglPath *vector)
678: gegl_path_insert_node (GeglPath           *vector,
724: gegl_path_replace_node (GeglPath           *vector,
759: gegl_path_remove_node (GeglPath *vector,
793: gegl_path_dirty (GeglPath *path)
802: gegl_path_parse_string (GeglPath    *vector,
866: gegl_path_append (GeglPath *self,
947: gegl_path_freeze (GeglPath *path)
954: gegl_path_thaw (GeglPath *path)
962: gegl_path_add_type (gchar        type,
982: gegl_path_add_flattener (GeglPathList *(*flattener) (GeglPathList *original))
1039: gegl_path_emit_changed (GeglPath            *self,
1316: gegl_path_item_free (GeglPathList *p)
1324: gegl_path_list_destroy (GeglPathList *path)
1337: gegl_path_list_append (GeglPathList *head,
1376: gegl_path_list_append_item  (GeglPathList  *head,
1418: gegl_path_list_flatten (GeglMatrix3  *matrix,
1443: gegl_path_list_calc (GeglPathList *path,
1526: gegl_path_list_calc_values (GeglPathList *path,
1603: gegl_path_list_get_length (GeglPathList *path)
1651: gegl_path_point_lerp (GeglPathPoint  *dest,
1661: gegl_path_point_dist (GeglPathPoint *a,
1670: gint gegl_path_calc_y_for_x (GeglPath *path,
1720: #define GEGL_IS_PARAM_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_PARAM_PATH))
1744: gegl_param_path_get_type (void)
34: struct _GeglPathClass
40: struct _GeglPathPrivate
61: typedef struct _GeglPathPrivate  GeglPathPrivate;
27: #include "gegl-path.h"
63: G_DEFINE_TYPE_WITH_PRIVATE (GeglPath, gegl_path, G_TYPE_OBJECT)
66:   ((GeglPathPrivate *) gegl_path_get_instance_private ((GeglPath *) (o)))
85:    * @head: head of the new path
86:    * @prev: current tail of the new path
91:    * This function is called for each node of the path to be flattened.
92:    * This function should build a new flattened path on the fly.
95:    * Return a pointer to the head of the flattened path.
116: static void             gegl_path_emit_changed        (GeglPath         *self,
147: static void             gegl_path_item_free           (GeglPathList     *p);
148: static GeglPathList *   gegl_path_list_append_item    (GeglPathList     *head,
152: static GeglPathList *   gegl_path_list_flatten        (GeglMatrix3      *matrix,
154: static gboolean         gegl_path_list_calc           (GeglPathList     *path,
160: static void             gegl_path_list_calc_values    (GeglPathList     *path,
164: static gdouble          gegl_path_list_get_length     (GeglPathList     *path);
170:  * "SVG path" parser/serializer.
192:   priv = GEGL_PATH_GET_PRIVATE (self);
193:   priv->flat_path_clean = FALSE;
209:   gegl_path_signals[GEGL_PATH_CHANGED] =
220:   GeglPath        *self = GEGL_PATH (gobject);
221:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (self);
224:   if (priv->path)
225:     gegl_path_list_destroy (priv->path);
226:   if (priv->flat_path)
227:     gegl_path_list_destroy (priv->flat_path);
230:   G_OBJECT_CLASS (gegl_path_parent_class)->finalize (gobject);
264:   return g_object_new (GEGL_TYPE_PATH,
271:   GeglPath *self = gegl_path_new ();
272:   gegl_path_parse_string (self, path_string);
279:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
280:   return priv->path == NULL;
291:   priv = GEGL_PATH_GET_PRIVATE (vector);
293:   for (iter = priv->path; iter; iter=iter->next)
303:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (self);
310:       priv->length = gegl_path_list_get_length (priv->flat_path);
321:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
325:   for (iter = priv->path; iter; iter=iter->next)
356:   priv = GEGL_PATH_GET_PRIVATE (vector);
357:   for (iter = priv->path; iter; iter=iter->next)
402:   if (!path)
404:       g_warning ("EEek! no path\n");
407:   priv = GEGL_PATH_GET_PRIVATE (path);
409:   priv->flat_path_clean = FALSE;
416:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
428:   gdouble length = gegl_path_get_length (path);
448:   gegl_path_calc_values (path, n, samples_x, samples_y);
480:       GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
484:       for (iter=priv->path,i=0; iter;i++,iter=iter->next)
489:           dist = gegl_path_closest_point (path,
518:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (self);
528:   entry = priv->flat_path;
541:   if (gegl_path_list_calc (entry,rel_pos,xd,yd,&stop,&leftover))
563:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (self);
567:   gegl_path_list_calc_values (priv->flat_path, num_samples, xs, ys);
596:   priv = GEGL_PATH_GET_PRIVATE (self);
599:   iter = priv->flat_path;
642:   priv = GEGL_PATH_GET_PRIVATE (vector);
643:   for (iter = priv->path; iter; iter=iter->next)
659:   priv = GEGL_PATH_GET_PRIVATE (vector);
661:   for (iter = priv->flat_path; iter; iter=iter->next)
670:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
671:   if (priv->path)
672:     gegl_path_list_destroy (priv->path);
673:   priv->path = NULL;
682:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
688:   for (iter = priv->path; iter; iter=iter->next)
699:           priv->flat_path_clean = FALSE;
701:           gegl_path_emit_changed (vector, NULL);
716:         priv->path = new;
718:   priv->flat_path_clean = FALSE;
720:   gegl_path_emit_changed (vector, NULL);
728:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
733:   for (iter = priv->path; iter; iter=iter->next)
739:           priv->flat_path_clean = FALSE;
742:           gegl_path_emit_changed (vector, NULL);
753:   priv->flat_path_clean = FALSE;
755:   gegl_path_emit_changed (vector, NULL);
762:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
769:     pos = gegl_path_get_n_nodes (vector)-1;
771:   for (iter = priv->path; iter; iter=iter->next)
778:             priv->path = iter->next;
779:           gegl_path_item_free (iter);
786:   priv->flat_path_clean = FALSE;
789:   gegl_path_emit_changed (vector, NULL);
795:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
796:   priv->flat_path_clean = FALSE;
798:   gegl_path_emit_changed (path, NULL);
803:                         const gchar *path)
805:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
806:   const gchar *p = path;
834:                 priv->path = gegl_path_list_append (priv->path, type, 0., 0.);
839:                 priv->path = gegl_path_list_append (priv->path, type, x0, y0);
844:                 priv->path = gegl_path_list_append (priv->path, type, x0, y0, x1, y1);
850:                 priv->path = gegl_path_list_append (priv->path, type, x0, y0, x1, y1, x2, y2);
862:   gegl_path_dirty (vector);
876:   priv = GEGL_PATH_GET_PRIVATE (self);
884:   priv->path = gegl_path_list_append_item (priv->path, type, &iter, ensure_tail(priv));
894:   priv->flat_path_clean = FALSE;
898:       /* special case lineto so that the full path doesn't need
908:       for (iter2=priv->path;iter2 && iter2->next != iter && iter2->next;iter2=iter2->next);
937:       gegl_path_emit_changed (self, &rect);
941:       gegl_path_emit_changed (self, NULL);
949:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
956:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
958:   gegl_path_emit_changed (path, NULL); /* expose a full changed */
984:   GeglPath *vector = g_object_new (GEGL_TYPE_PATH, NULL);
985:   GeglPathClass *klass= GEGL_PATH_GET_CLASS (vector);
1007:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
1009:   return priv->path;
1015:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
1017:   ensure_flattened (path);
1018:   return priv->flat_path;
1042:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (self);
1053:   if (! gegl_path_is_empty (self))
1055:       gegl_path_get_bounds (self, &min_x, &max_x, &min_y, &max_y);
1095:   priv->cached_extent_empty = gegl_path_is_empty (self);
1099:       g_signal_emit (self, gegl_path_signals[GEGL_PATH_CHANGED], 0,
1115:   GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector);
1117:   GeglPathList *path = priv->path;
1118:   GeglPathList *new_path;
1119:   GeglPathList *old_path = NULL;
1120:   GeglPathClass *klass= GEGL_PATH_GET_CLASS (vector);
1122:   if (priv->flat_path_clean)
1124:   if (priv->flat_path)
1125:     old_path = priv->flat_path;
1129:       new_path = klass->flattener[i] (path);
1130:       if (new_path != path)
1132:           if (path != priv->path)
1133:             gegl_path_list_destroy (path);
1134:           path = new_path;
1138:   priv->flat_path = gegl_path_list_flatten (&priv->matrix, path);
1139:   if (old_path)
1140:     gegl_path_list_destroy (old_path);
1141:   if (path != priv->path)
1142:     gegl_path_list_destroy (path);
1143:   priv->flat_path_clean = TRUE;
1152:  * Ensure that priv->tail point to the last element of the path list
1159:   tail = priv->tail ? priv->tail : priv->path;
1185:   head = gegl_path_list_append_item (head, self->d.type, &newp, NULL);
1201:   head = gegl_path_list_append_item (head, self->d.type, &newp, NULL);
1237:       head = gegl_path_list_append (head, 'L', res.x, res.y);
1241:   head = gegl_path_list_append (head, 'L', res.x, res.y);
1305:     gegl_path_point_lerp (&ab, &prev->point[2], &curve->point[0], t);
1307:     gegl_path_point_lerp (&ab, &prev->point[0], &curve->point[0], t);
1308:   gegl_path_point_lerp (&bc, &curve->point[0], &curve->point[1], t);
1309:   gegl_path_point_lerp (&cd, &curve->point[1], &curve->point[2], t);
1310:   gegl_path_point_lerp (&abbc, &ab, &bc,t);
1311:   gegl_path_point_lerp (&bccd, &bc, &cd,t);
1312:   gegl_path_point_lerp (dest, &abbc, &bccd, t);
1326:   GeglPathList *iter = path;
1330:       gegl_path_item_free (iter);
1353:   head = gegl_path_list_append_item (head, type, &iter, NULL);
1366:  * gegl_path_list_append_item:
1396:   else /* creating new path */
1411:  * gegl_path_list_flatten:
1450:   GeglPathList *iter = path, *prev = NULL;
1454:   /* fetch the start point of the path */
1470:   /* travel along the path */
1490:               distance = gegl_path_point_dist (&a, &b);
1498:                   gegl_path_point_lerp (&spot, &a, &b, ratio);
1531:   GeglPathList *iter = path;
1532:   gdouble length = gegl_path_list_get_length (path);
1560:               distance = gegl_path_point_dist (&a, &b);
1568:                   gegl_path_point_lerp (&spot, &a, &b, ratio);
1590:             g_error ("stroking uninitialized path\n");
1605:   GeglPathList *iter = path;
1628:               distance = gegl_path_point_dist (&a, &b);
1685:   gegl_path_calc_values (path, Y_FOR_X_RES, xs, ys);
1738:                                                        GEGL_TYPE_PARAM_PATH));
1759:       param_vector_type_info.value_type = GEGL_TYPE_PATH;
1777:   param_vector = g_param_spec_internal (GEGL_TYPE_PARAM_PATH,
118: static void             ensure_flattened              (GeglPath         *vector);
260: /***** GeglPath *****/
261: GeglPath *
268: GeglPath *
1107:  * @vector: a #GeglPath
1113: ensure_flattened (GeglPath *vector)
1150:  * @priv: the private struct of a GeglPath
1714:  * A GParamSpec class to describe behavior of GeglPath as an object property
1751:         sizeof (GeglParamPath),
1761:       param_vector_type = g_param_type_register_static ("GeglParamPath",
1772:                         GeglPath  *default_vector,
1775:   GeglParamPath *param_vector;
37:   GeglPathList *(*flattener[8]) (GeglPathList *original);
43:   GeglPathList *tail; /*< for fast appending */
50:   GeglPathList *calc_stop;
97:   GeglPathList *(*flatten) (GeglMatrix3   *matrix,
98:                             GeglPathList *head,
99:                             GeglPathList *prev,
100:                             GeglPathList *self);
119: static GeglPathList *   ensure_tail                   (GeglPathPrivate  *priv);
121: static GeglPathList *   flatten_copy                  (GeglMatrix3      *matrix,
122:                                                        GeglPathList     *head,
123:                                                        GeglPathList     *prev,
124:                                                        GeglPathList     *self);
125: static GeglPathList *   flatten_rel_copy              (GeglMatrix3      *matrix,
126:                                                        GeglPathList     *head,
127:                                                        GeglPathList     *prev,
128:                                                        GeglPathList     *self);
129: static GeglPathList *   flatten_nop                   (GeglMatrix3      *matrix,
130:                                                        GeglPathList     *head,
131:                                                        GeglPathList     *prev,
132:                                                        GeglPathList     *self);
133: static GeglPathList *   flatten_curve                 (GeglMatrix3      *matrix,
134:                                                        GeglPathList     *head,
135:                                                        GeglPathList     *prev,
136:                                                        GeglPathList     *self);
140:                                                        GeglPathItem     *dst);
141: static void             copy_data                     (const GeglPathItem *src,
142:                                                        GeglPathItem     *dst);
143: static void             bezier2                       (GeglPathItem     *prev,
144:                                                        GeglPathItem     *curve,
145:                                                        GeglPathPoint    *dest,
150:                                                        GeglPathList    **res,
151:                                                        GeglPathList     *tail);
153:                                                        GeglPathList     *original);
158:                                                        GeglPathList    **stop,
191:   GeglPathPrivate *priv;
286:   GeglPathPrivate *priv;
287:   GeglPathList *iter;
319:                     GeglPathItem *node)
322:   GeglPathList *iter;
323:   GeglPathItem *last = NULL;
349:   GeglPathPrivate *priv;
352:   GeglPathList *iter;
401:   GeglPathPrivate *priv;
481:       GeglPathList *iter;
519:   GeglPathList *entry;
520:   GeglPathList *stop  = NULL;
578:   GeglPathPrivate *priv;
579:   GeglPathList    *iter;
634:                    void (*func) (const GeglPathItem *knot,
638:   GeglPathPrivate *priv;
639:   GeglPathList *iter;
651:                         void (*func) (const GeglPathItem *knot,
655:   GeglPathPrivate *priv;
656:   GeglPathList *iter;
680:                        const GeglPathItem *knot)
683:   GeglPathList *iter;
684:   GeglPathList *prev = NULL;
692:           GeglPathList *new = g_slice_alloc0 (sizeof (gpointer) + sizeof (gchar) + sizeof (gfloat)*2 *(info->n_items+3...(5 bytes skipped)...
709:       GeglPathList *new = g_slice_alloc0 (sizeof (gpointer) + sizeof (gchar) + sizeof (gfloat)*2 *(info->n_items+3...(5 bytes skipped)...
726:                         const GeglPathItem *knot)
729:   GeglPathList *iter;
730:   GeglPathList *prev = NULL;
763:   GeglPathList *iter;
764:   GeglPathList *prev = NULL;
869:   GeglPathPrivate *priv;
871:   GeglPathList *iter;
901:       GeglPathList *iter2;
1004: GeglPathList *
1012: GeglPathList *
1154: static GeglPathList *
1155: ensure_tail (GeglPathPrivate *priv)
1157:   GeglPathList *tail;
1169: static GeglPathList *
1171:              GeglPathList *head,
1172:              GeglPathList *prev,
1173:              GeglPathList *self)
1178: static GeglPathList *
1180:               GeglPathList *head,
1181:               GeglPathList *prev,
1182:               GeglPathList *self)
1184:   GeglPathList *newp;
1191: static GeglPathList *
1193:                   GeglPathList *head,
1194:                   GeglPathList *prev,
1195:                   GeglPathList *self)
1197:   GeglPathList *newp;
1220: static GeglPathList *
1222:                GeglPathList *head,
1223:                GeglPathList *prev,
1224:                GeglPathList *self)
1227:   GeglPathPoint res;
1229:   GeglPathItem *item=(void*)buf;
1257: /***** GeglPathItem *****/
1260:                 GeglPathItem *dst)
1277: copy_data (const GeglPathItem *src,
1278:            GeglPathItem       *dst)
1297: bezier2 (GeglPathItem  *prev,
1298:          GeglPathItem  *curve,
1299:          GeglPathPoint *dest,
1302:   GeglPathPoint ab,bc,cd,abbc,bccd;
1322: /***** GeglPathList *****/
1323: GeglPathList *
1329:       GeglPathList *next = iter->next;
1336: GeglPathList *
1341:   GeglPathList *iter;
1375: static GeglPathList *
1378:                              GeglPathList **res,
1379:                              GeglPathList  *tail)
1381:   GeglPathList *iter = tail?tail:head;
1413:  * @original: the #GeglPathList to flatten
1415:  * Flatten the provided GeglPathList
1417: static GeglPathList *
1419:                         GeglPathList *original)
1421:   GeglPathList *iter;
1422:   GeglPathList *self = NULL;
1424:   GeglPathList *endp = NULL;
1447:                      GeglPathList **stop,
1481:               GeglPathPoint a,b;
1495:                   GeglPathPoint spot;
1551:               GeglPathPoint a,b;
1565:                   GeglPathPoint spot;
1619:               GeglPathPoint a,b;
1649: /***** GeglPathPoint *****/
1652:                       GeglPathPoint  *a,
1653:                       GeglPathPoint  *b,
1662:                       GeglPathPoint *b)
android.googlesource.com/platform/external/boost:boost/filesystem/path.hpp: [ master, ]
49:     typedef basic_path< std::string, path_traits > path;
51:     struct path_traits
91:     template<class Path> struct is_basic_path
93:     template<> struct is_basic_path<path>
96:     template<> struct is_basic_path<wpath>
122:     template<class Path> struct path_alt_separator
125:     template<> struct path_alt_separator<wpath>
146:     class basic_path
158:       typedef basic_path<String, Traits> path_type;
165:       basic_path() {}
166:       basic_path( const string_type & s ) { operator/=( s ); }
167:       basic_path( const value_type * s )  { operator/=( s ); }
170:           basic_path( InputIterator first, InputIterator last )
173:      ~basic_path() {}
254:       basic_path   branch_path() const     { return parent_path(); }
256:       bool         has_branch_path() const { return !parent_path().empty(); }
264:       bool has_relative_path() const   { return !relative_path().empty(); }
266:       bool has_parent_path() const     { return !parent_path().empty(); }
319:       string_type  m_path; // invariant: portable path grammar
340:       basic_path( const string_type & str, name_check ) { operator/=( str ); }
341:       basic_path( const typename string_type::value_type * s, name_check )
672:       typedef Path path_type;
685:       const path_type & path1() const
690:       const path_type & path2() const
757:           boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
805:         typedef typename boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
865:         typedef typename boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
904:             path_type;
958:     basic_path<String, Traits> basic_path<String, Traits>::parent_path() const
982:     basic_path<String, Traits> basic_path<String, Traits>::relative_path() const
1028:     basic_path<String, Traits> basic_path<String, Traits>::root_path() const
1047:     inline bool basic_path<String, Traits>::has_root_path() const
65:     typedef basic_path< std::wstring, wpath_traits > wpath;
18: #define BOOST_FILESYSTEM_PATH_HPP
297:         const basic_path *      m_path_ptr; // path being iterated over
707:         path_type                 m_path1; // may be empty()
708:         path_type                 m_path2; // may be empty()
63:     struct BOOST_FILESYSTEM_DECL wpath_traits;
67:     struct BOOST_FILESYSTEM_DECL wpath_traits
1: //  boost/filesystem/path.hpp  -----------------------------------------------//
11: //  basic_path's stem(), extension(), and replace_extension() are based on
17: #ifndef BOOST_FILESYSTEM_PATH_HPP
30: #include <iosfwd>    // needed by basic_path inserter and extractor
46:     template<class String, class Traits> class basic_path;
48:     struct path_traits;
55:       static external_string_type to_external( const path &,
89:     //  path traits  ---------------------------------------------------------//
100:     // These only have to be specialized if Path::string_type::value_type