Found 1007553 results in 165726 files, showing top 450 files (show more).
github.com/llvm-mirror/clang:include/clang/Analysis/PathDiagnostic.h: [ master, ]
554:   PathPieces path;
759:   const PathPieces &path;
61: class PathDiagnosticConsumer {
111:   enum PathGenerationScheme {
145: class PathDiagnosticRange : public SourceRange {
149:   PathDiagnosticRange(SourceRange R, bool isP = false)
157: class PathDiagnosticLocation {
167:   PathDiagnosticLocation(SourceLocation L, const SourceManager &sm, Kind kind)
182:   PathDiagnosticLocation(const Stmt *s, const SourceManager &sm,
193:   PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
203:   PathDiagnosticLocation(SourceLocation loc, const SourceManager &sm)
335: class PathDiagnosticLocationPair {
340:   PathDiagnosticLocationPair(const PathDiagnosticLocation &start,
365: class PathDiagnosticPiece: public llvm::FoldingSetNode {
454: using PathDiagnosticPieceRef = std::shared_ptr<PathDiagnosticPiece>;
456: class PathPieces : public std::list<PathDiagnosticPieceRef> {
470: class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
475:   PathDiagnosticSpotPiece(const PathDiagnosticLocation &pos,
496: class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
500:   PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
526: class PathDiagnosticCallPiece : public PathDiagnosticPiece {
542:   PathDiagnosticCallPiece(const Decl *callerD,
546:   PathDiagnosticCallPiece(PathPieces &oldPath, const Decl *caller)
596: class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
600:   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
607:   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
666: class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
668:   PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos)
689: class PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
691:   PathDiagnosticNotePiece(const PathDiagnosticLocation &Pos, StringRef S,
705: class PathDiagnosticPopUpPiece: public PathDiagnosticSpotPiece {
707:   PathDiagnosticPopUpPiece(const PathDiagnosticLocation &Pos, StringRef S,
727: class PathDiagnostic : public llvm::FoldingSetNode {
739:   PathPieces pathImpl;
740:   SmallVector<PathPieces *, 3> pathStack;
763:   PathPieces &getActivePath() {
777:   void pushActivePath(PathPieces *p) { pathStack.push_back(p); }
778:   void popActivePath() { if (!pathStack.empty()) pathStack.pop_back(); }
782:   void setEndOfPath(PathDiagnosticPieceRef EndPiece) {
14: #define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_PATHDIAGNOSTIC_H
128:   bool shouldAddPathEdges() const { return getGenerationScheme() == Extensive; }
1: //===- PathDiagnostic.h - Path-Specific Diagnostic Handling -----*- C++ -*-===//
56: // High-level interface for handlers of path-sensitive diagnostics.
142: // Path-sensitive diagnostics.
362: // Path "pieces" for path-sensitive diagnostics.
548:         path(oldPath) {}
576:     for (const auto &I : path)
724: /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive
726: ///  each which represent the pieces of the path.
736:   /// Loc The location of the path diagnostic report.
747:   /// Lines executed in the path.
761:   /// Return the path currently used by builders for constructing the
769:   /// Return a mutable version of 'path'.
774:   /// Return the unrolled size of the path.
785:     assert(Loc.isValid() && "Invalid location for end-of-path piece");
820:   /// issue occurs along a path, this represents the "central" area
852:   /// Profiles the diagnostic, independent of the path it references.
858:   /// Profiles the diagnostic, including its path.
9: //  This file defines the PathDiagnostic-related interfaces.
13: #ifndef LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_PATHDIAGNOSTIC_H
59: class PathDiagnostic;
88:     void addDiagnostic(const PathDiagnostic &PD,
92:     PDFileEntry::ConsumerFiles *getFiles(const PathDiagnostic &PD);
99:   PathDiagnosticConsumer() = default;
100:   virtual ~PathDiagnosticConsumer();
104:   virtual void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
109:   void HandlePathDiagnostic(std::unique_ptr<PathDiagnostic> D);
122:   virtual PathGenerationScheme getGenerationScheme() const { return Minimal; }
132:   /// Return true if the PathDiagnosticConsumer supports individual
133:   /// PathDiagnostics that span multiple files.
138:   llvm::FoldingSet<PathDiagnostic> Diags;
151:   PathDiagnosticRange() = default;
165:   PathDiagnosticRange Range;
174:   PathDiagnosticRange genRange(
179:   PathDiagnosticLocation() = default;
210:   static PathDiagnosticLocation create(const Decl *D,
212:     return PathDiagnosticLocation(D, SM);
216:   static PathDiagnosticLocation createBegin(const Decl *D,
222:   static PathDiagnosticLocation
229:   static PathDiagnosticLocation createBegin(const Stmt *S,
237:   static PathDiagnosticLocation createEnd(const Stmt *S,
243:   static PathDiagnosticLocation createOperatorLoc(const BinaryOperator *BO,
245:   static PathDiagnosticLocation createConditionalColonLoc(
251:   static PathDiagnosticLocation createMemberLoc(const MemberExpr *ME,
256:   static PathDiagnosticLocation createBeginBrace(const CompoundStmt *CS,
261:   static PathDiagnosticLocation createEndBrace(const CompoundStmt *CS,
266:   static PathDiagnosticLocation createDeclBegin(const LocationContext *LC,
271:   static PathDiagnosticLocation createDeclEnd(const LocationContext *LC,
275:   static PathDiagnosticLocation create(const ProgramPoint &P,
279:   static PathDiagnosticLocation createSingleLocation(
280:                                              const PathDiagnosticLocation &PDL);
289:   bool operator==(const PathDiagnosticLocation &X) const {
293:   bool operator!=(const PathDiagnosticLocation &X) const {
305:   PathDiagnosticRange asRange() const {
323:     *this = PathDiagnosticLocation();
337:   PathDiagnosticLocation Start, End;
341:                              const PathDiagnosticLocation &end)
344:   const PathDiagnosticLocation &getStart() const { return Start; }
345:   const PathDiagnosticLocation &getEnd() const { return End; }
347:   void setStart(const PathDiagnosticLocation &L) { Start = L; }
348:   void setEnd(const PathDiagnosticLocation &L) { End = L; }
379:   /// A constant string that can be used to tag the PathDiagnosticPiece,
389:   PathDiagnosticPiece(StringRef s, Kind k, DisplayHint hint = Below);
390:   PathDiagnosticPiece(Kind k, DisplayHint hint = Below);
393:   PathDiagnosticPiece() = delete;
394:   PathDiagnosticPiece(const PathDiagnosticPiece &) = delete;
395:   PathDiagnosticPiece &operator=(const PathDiagnosticPiece &) = delete;
396:   virtual ~PathDiagnosticPiece();
400:   /// Tag this PathDiagnosticPiece with the given C-string.
403:   /// Return the opaque tag (if any) on the PathDiagnosticPiece.
411:   ///  be displayed by the PathDiagnosticConsumer.
414:   virtual PathDiagnosticLocation getLocation() const = 0;
435:   /// Return the SourceRanges associated with this PathDiagnosticPiece.
438:   /// Return the fix-it hints associated with this PathDiagnosticPiece.
457:   void flattenTo(PathPieces &Primary, PathPieces &Current,
461:   PathPieces flatten(bool ShouldFlattenMacros) const {
462:     PathPieces Result;
472:   PathDiagnosticLocation Pos;
477:                           PathDiagnosticPiece::Kind k,
479:       : PathDiagnosticPiece(s, k), Pos(pos) {
481:            "PathDiagnosticSpotPiece's must have a valid location.");
485:   PathDiagnosticLocation getLocation() const override { return Pos; }
490:   static bool classof(const PathDiagnosticPiece *P) {
502:       : PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
503:   ~PathDiagnosticEventPiece() override;
521:   static bool classof(const PathDiagnosticPiece *P) {
543:                           const PathDiagnosticLocation &callReturnPos)
544:       : PathDiagnosticPiece(Call), Caller(callerD), NoExit(false),
547:       : PathDiagnosticPiece(Call), Caller(caller), NoExit(true),
551:   PathDiagnosticLocation callEnter;
552:   PathDiagnosticLocation callEnterWithin;
553:   PathDiagnosticLocation callReturn;
556:   ~PathDiagnosticCallPiece() override;
566:   PathDiagnosticLocation getLocation() const override { return callEnter; }
568:   std::shared_ptr<PathDiagnosticEventPiece> getCallEnterEvent() const;
569:   std::shared_ptr<PathDiagnosticEventPiece>
571:   std::shared_ptr<PathDiagnosticEventPiece> getCallExitEvent() const;
580:   static std::shared_ptr<PathDiagnosticCallPiece>
584:   static PathDiagnosticCallPiece *construct(PathPieces &pieces,
591:   static bool classof(const PathDiagnosticPiece *P) {
597:   std::vector<PathDiagnosticLocationPair> LPairs;
601:                                  const PathDiagnosticLocation &endPos,
603:       : PathDiagnosticPiece(s, ControlFlow) {
604:     LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
608:                                  const PathDiagnosticLocation &endPos)
609:       : PathDiagnosticPiece(ControlFlow) {
610:     LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
613:   ~PathDiagnosticControlFlowPiece() override;
615:   PathDiagnosticLocation getStartLocation() const {
617:            "PathDiagnosticControlFlowPiece needs at least one location.");
621:   PathDiagnosticLocation getEndLocation() const {
623:            "PathDiagnosticControlFlowPiece needs at least one location.");
627:   void setStartLocation(const PathDiagnosticLocation &L) {
631:   void setEndLocation(const PathDiagnosticLocation &L) {
635:   void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); }
637:   PathDiagnosticLocation getLocation() const override {
641:   using iterator = std::vector<PathDiagnosticLocationPair>::iterator;
652:       std::vector<PathDiagnosticLocationPair>::const_iterator;
657:   static bool classof(const PathDiagnosticPiece *P) {
669:       : PathDiagnosticSpotPiece(pos, "", Macro) {}
670:   ~PathDiagnosticMacroPiece() override;
672:   PathPieces subPieces;
675:     PathDiagnosticSpotPiece::flattenLocations();
680:   static bool classof(const PathDiagnosticPiece *P) {
693:       : PathDiagnosticSpotPiece(Pos, S, Note, AddPosRange) {}
694:   ~PathDiagnosticNotePiece() override;
696:   static bool classof(const PathDiagnosticPiece *P) {
709:       : PathDiagnosticSpotPiece(Pos, S, PopUp, AddPosRange) {}
710:   ~PathDiagnosticPopUpPiece() override;
712:   static bool classof(const PathDiagnosticPiece *P) {
725: ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
737:   PathDiagnosticLocation Loc;
744:   PathDiagnosticLocation UniqueingLoc;
751:   PathDiagnostic() = delete;
752:   PathDiagnostic(StringRef CheckerName, const Decl *DeclWithIssue,
754:                  StringRef category, PathDiagnosticLocation LocationToUnique,
757:   ~PathDiagnostic();
762:   /// PathDiagnostic.
764:     if (pathStack.empty())
765:       return pathImpl;
766:     return *pathStack.back();
770:   PathPieces &getMutablePieces() {
771:     return pathImpl;
780:   bool isWithinCall() const { return !pathStack.empty(); }
786:     getActivePath().push_back(std::move(EndPiece));
828:   PathDiagnosticLocation getLocation() const {
832:   void setLocation(PathDiagnosticLocation NewLoc) {
837:   PathDiagnosticLocation getUniqueingLoc() const {
848:     for (const auto &I : pathImpl)
855:   /// along different paths.
860:   /// Two diagnostics with the same issue along different paths will generate
868: #endif // LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_PATHDIAGNOSTIC_H
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, ]
582:     path: &'a [u8],
1748: impl ToOwned for Path {
1835: pub struct Path {
1848: impl Path {
2746: impl AsRef<OsStr> for Path {
2753: impl fmt::Debug for Path {
2780:     path: &'a Path,
2795: impl cmp::PartialEq for Path {
2802: impl Hash for Path {
2853: impl cmp::Eq for Path {}
2855: impl cmp::PartialOrd for Path {
2862: impl cmp::Ord for Path {
2869: impl AsRef<Path> for Path {
2927: impl<'a> IntoIterator for &'a Path {
675:     pub fn as_path(&self) -> &'a Path {
817:     pub fn as_path(&self) -> &'a Path {
1186:     pub fn as_path(&self) -> &Path {
1435:     pub fn into_boxed_path(self) -> Box<Path> {
1124: pub struct PathBuf {
1128: impl PathBuf {
1507: impl Clone for PathBuf {
1543: impl From<Box<Path>> for PathBuf {
1571: impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf {
1581: impl From<OsString> for PathBuf {
1601: impl From<String> for PathBuf {
1611: impl FromStr for PathBuf {
1620: impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
1628: impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
1639: impl fmt::Debug for PathBuf {
1645: impl ops::Deref for PathBuf {
1653: impl Borrow<Path> for PathBuf {
1660: impl Default for PathBuf {
1700: impl<'a> From<Cow<'a, Path>> for PathBuf {
1760: impl cmp::PartialEq for PathBuf {
1767: impl Hash for PathBuf {
1773: impl cmp::Eq for PathBuf {}
1775: impl cmp::PartialOrd for PathBuf {
1782: impl cmp::Ord for PathBuf {
1789: impl AsRef<OsStr> for PathBuf {
2911: impl AsRef<Path> for PathBuf {
2918: impl<'a> IntoIterator for &'a PathBuf {
1964:     pub fn to_path_buf(&self) -> PathBuf {
2739:     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: //! Unless otherwise indicated path methods that do not access the filesystem,
35: //! such as [`Path::starts_with`] and [`Path::ends_with`], are case sensitive no
41: //! Path manipulation includes both parsing components from slices and building
44: //! To parse a path, you can create a [`Path`] slice from a [`str`]
48: //! use std::path::Path;
51: //! let path = Path::new("/tmp/foo/bar.txt");
53: //! let parent = path.parent();
54: //! assert_eq!(parent, Some(Path::new("/tmp/foo")));
56: //! let file_stem = path.file_stem();
59: //! let extension = path.extension();
66: //! use std::path::PathBuf;
69: //! let mut path = PathBuf::from("c:\\");
71: //! path.push("windows");
72: //! path.push("system32");
74: //! path.set_extension("dll");
78: //! let path: PathBuf = ["c:\\", "windows", "system32.dll"].iter().collect();
81: //! [`components`]: Path::components
104: use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR};
120: /// Windows path prefixes, e.g., `C:` or `\\server\share`.
122: /// Windows uses a variety of path prefix styles, including references to drive
124: /// others. In addition, some path prefixes are "verbatim" (i.e., prefixed with
131: /// use std::path::{Component, Path, Prefix};
132: /// use std::path::Prefix::*;
135: /// fn get_path_prefix(s: &str) -> Prefix {
136: ///     let path = Path::new(s);
137: ///     match path.components().next().unwrap() {
145: ///            get_path_prefix(r"\\?\pictures\kittens"));
147: ///            get_path_prefix(r"\\?\UNC\server\share"));
148: /// assert_eq!(VerbatimDisk(b'C'), get_path_prefix(r"\\?\c:\"));
150: ///            get_path_prefix(r"\\.\BrainInterface"));
152: ///            get_path_prefix(r"\\server\share"));
153: /// assert_eq!(Disk(b'C'), get_path_prefix(r"C:\Users\Rust\Pictures\Ferris"));
218:     /// use std::path::Prefix::*;
250: /// Determines whether the character is one of the permitted path
256: /// use std::path;
258: /// assert!(path::is_separator('/')); // '/' works for both Unix and Windows
259: /// assert!(!path::is_separator('❤'));
266: /// The primary separator of path components for the current platform.
269: pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
271: /// The primary separator of path components for the current platform.
274: pub const MAIN_SEPARATOR_STR: &str = crate::sys::path::MAIN_SEP_STR;
322:     let path = if let Some(p) = prefix { &s[p.len()..] } else { s };
323:     !path.is_empty() && is_sep_byte(path[0])
370: /// front and back of the path each keep track of what parts of the path have
373: /// Going front to back, a path is made up of a prefix, a starting
383: /// A structure wrapping a Windows path prefix as well as its unparsed string
399: /// use std::path::{Component, Path, Prefix};
402: /// let path = Path::new(r"c:\you\later\");
403: /// match path.components().next().unwrap() {
471: /// A single component of a path.
473: /// A `Component` roughly corresponds to a substring between path separators
477: /// created by the [`components`](Path::components) method on [`Path`].
482: /// use std::path::{Component, Path};
484: /// let path = Path::new("/tmp/foo/bar.txt");
485: /// let components = path.components().collect::<Vec<_>>();
496:     /// A Windows path prefix, e.g., `C:` or `\\server\share`.
506:     /// It represents a separator that designates that a path starts from root.
528:     /// use std::path::Path;
530:     /// let path = Path::new("./tmp/foo/bar.txt");
531:     /// let components: Vec<_> = path.components().map(|comp| comp.as_os_str()).collect();
541:             Component::Normal(path) => path,
553: impl AsRef<Path> for Component<'_> {
555:     fn as_ref(&self) -> &Path {
560: /// An iterator over the [`Component`]s of a [`Path`].
562: /// This `struct` is created by the [`components`] method on [`Path`].
568: /// use std::path::Path;
570: /// let path = Path::new("/tmp/foo/bar.txt");
572: /// for component in path.components() {
577: /// [`components`]: Path::components
581:     // The path left to parse components from
587:     // true if path *physically* has a root separator; for most Windows
598: /// An iterator over the [`Component`]s of a [`Path`], as [`OsStr`] slices.
600: /// This `struct` is created by the [`iter`] method on [`Path`].
603: /// [`iter`]: Path::iter
612:         struct DebugHelper<'a>(&'a Path);
620:         f.debug_tuple("Components").field(&DebugHelper(self.as_path())).finish()
642:     // Given the iteration so far, how much of the pre-State::Body path is left?
661:     /// Extracts a slice corresponding to the portion of the path remaining for iteration.
666:     /// use std::path::Path;
668:     /// let mut components = Path::new("/tmp/foo/bar.txt").components();
672:     /// assert_eq!(Path::new("foo/bar.txt"), components.as_path());
683:         unsafe { Path::from_u8_slice(comps.path) }
686:     /// Is the *original* path rooted?
699:     /// Should the normalized path include a leading . ?
704:         let mut iter = self.path[self.prefix_remaining()..].iter();
712:     // parse a given byte sequence into the corresponding path component
717:             // the beginning of a path, which is treated
729:         let (extra, comp) = match self.path.iter().position(|b| self.is_sep_byte(*b)) {
730:             None => (0, self.path),
731:             Some(i) => (1, &self.path[..i]),
741:         let (extra, comp) = match self.path[start..].iter().rposition(|b| self.is_sep_byte(*b)) {
742:             None => (0, &self.path[start..]),
743:             Some(i) => (1, &self.path[start + i + 1..]),
750:         while !self.path.is_empty() {
755:                 self.path = &self.path[size..];
762:         while self.path.len() > self.len_before_body() {
767:                 self.path = &self.path[..self.path.len() - size];
773: impl AsRef<Path> for Components<'_> {
775:     fn as_ref(&self) -> &Path {
776:         self.as_path()
783:         self.as_path().as_os_str()
789:         struct DebugHelper<'a>(&'a Path);
797:         f.debug_tuple("Iter").field(&DebugHelper(self.as_path())).finish()
802:     /// Extracts a slice corresponding to the portion of the path remaining for iteration.
807:     /// use std::path::Path;
809:     /// let mut iter = Path::new("/tmp/foo/bar.txt").iter();
813:     /// assert_eq!(Path::new("foo/bar.txt"), iter.as_path());
818:         self.inner.as_path()
822: impl AsRef<Path> for Iter<'_> {
824:     fn as_ref(&self) -> &Path {
825:         self.as_path()
832:         self.as_path().as_os_str()
862:                     debug_assert!(self.prefix_len() <= self.path.len());
863:                     let raw = &self.path[..self.prefix_len()];
864:                     self.path = &self.path[self.prefix_len()..];
876:                         debug_assert!(!self.path.is_empty());
877:                         self.path = &self.path[1..];
884:                         debug_assert!(!self.path.is_empty());
885:                         self.path = &self.path[1..];
889:                 State::Body if !self.path.is_empty() => {
891:                     self.path = &self.path[size..];
910:                 State::Body if self.path.len() > self.len_before_body() => {
912:                     self.path = &self.path[..self.path.len() - size];
923:                         self.path = &self.path[..self.path.len() - 1];
930:                         self.path = &self.path[..self.path.len() - 1];
937:                         raw: unsafe { u8_slice_as_os_str(self.path) },
957:         let Components { path: _, front: _, back: _, has_physical_root: _, prefix: _ } = self;
959:         // Fast path for exact matches, e.g. for hashmap lookups.
961:         // either be covered by the `path` buffer or are only relevant for `prefix_verbatim()`.
962:         if self.path.len() == other.path.len()
970:             if self.path == other.path {
997:     // Fast path for long shared prefixes
1002:     //   otherwise do it on the full path
1004:     // The fast path isn't taken for paths with a PrefixComponent to avoid backtracking into
1008:         let first_difference = match left.path.iter().zip(right.path).position(|(&a, &b)| a != b) {
1009:             None if left.path.len() == right.path.len() => return cmp::Ordering::Equal,
1010:             None => left.path.len().min(right.path.len()),
1015:             left.path[..first_difference].iter().rposition(|&b| left.is_sep_byte(b))
1018:             left.path = &left.path[mismatched_component_start..];
1020:             right.path = &right.path[mismatched_component_start..];
1028: /// An iterator over [`Path`] and its ancestors.
1030: /// This `struct` is created by the [`ancestors`] method on [`Path`].
1036: /// use std::path::Path;
1038: /// let path = Path::new("/foo/bar");
1040: /// for ancestor in path.ancestors() {
1045: /// [`ancestors`]: Path::ancestors
1049:     next: Option<&'a Path>,
1053:     type Item = &'a Path;
1058:         self.next = next.and_then(Path::parent);
1069: /// An owned, mutable path (akin to [`String`]).
1072: /// the path in place. It also implements [`Deref`] to [`Path`], meaning that
1073: /// all methods on [`Path`] slices are available on `PathBuf` values as well.
1087: /// use std::path::PathBuf;
1089: /// let mut path = PathBuf::new();
1091: /// path.push(r"C:\");
1092: /// path.push("windows");
1093: /// path.push("system32");
1095: /// path.set_extension("dll");
1102: /// use std::path::PathBuf;
1104: /// let path: PathBuf = [r"C:\", "windows", "system32.dll"].iter().collect();
1111: /// use std::path::PathBuf;
1113: /// let path = PathBuf::from(r"C:\windows\system32.dll");
1139:     /// use std::path::PathBuf;
1141:     /// let path = PathBuf::new();
1155:     /// use std::path::PathBuf;
1157:     /// let mut path = PathBuf::with_capacity(10);
1158:     /// let capacity = path.capacity();
1161:     /// path.push(r"C:\");
1163:     /// assert_eq!(capacity, path.capacity());
1173:     /// Coerces to a [`Path`] slice.
1178:     /// use std::path::{Path, PathBuf};
1181:     /// assert_eq!(Path::new("/test"), p.as_path());
1190:     /// Extends `self` with `path`.
1192:     /// If `path` is absolute, it replaces the current path.
1196:     /// * if `path` has a root but no prefix (e.g., `\windows`), it
1198:     /// * if `path` has a prefix but no root, it replaces `self`.
1200:     ///   and `path` is not empty, the new path is normalized: all references
1205:     /// Pushing a relative path extends the existing path:
1208:     /// use std::path::PathBuf;
1210:     /// let mut path = PathBuf::from("/tmp");
1211:     /// path.push("file.bk");
1212:     /// assert_eq!(path, PathBuf::from("/tmp/file.bk"));
1215:     /// Pushing an absolute path replaces the existing path:
1218:     /// use std::path::PathBuf;
1220:     /// let mut path = PathBuf::from("/tmp");
1221:     /// path.push("/etc");
1222:     /// assert_eq!(path, PathBuf::from("/etc"));
1224:     pub fn push<P: AsRef<Path>>(&mut self, path: P) {
1225:         self._push(path.as_ref())
1228:     fn _push(&mut self, path: &Path) {
1236:             && comps.prefix_len() == comps.path.len()
1242:         // absolute `path` replaces `self`
1243:         if path.is_absolute() || path.prefix().is_some() {
1247:         } else if comps.prefix_verbatim() && !path.inner.is_empty() {
1249:             for c in path.components() {
1286:         // `path` has a root but no prefix, e.g., `\windows` (Windows only)
1287:         } else if path.has_root() {
1291:         // `path` is a pure relative path
1296:         self.inner.push(path);
1304:     /// [`self.parent`]: Path::parent
1309:     /// use std::path::{Path, PathBuf};
1314:     /// assert_eq!(Path::new("/spirited"), p);
1316:     /// assert_eq!(Path::new("/"), p);
1334:     /// `file_name`. The new path will be a sibling of the original path.
1337:     /// [`self.file_name`]: Path::file_name
1343:     /// use std::path::PathBuf;
1373:     /// [`self.file_name`]: Path::file_name
1374:     /// [`self.extension`]: Path::extension
1379:     /// use std::path::{Path, PathBuf};
1384:     /// assert_eq!(Path::new("/feel/the.force"), p.as_path());
1387:     /// assert_eq!(Path::new("/feel/the.dark_side"), p.as_path());
1421:     /// use std::path::PathBuf;
1432:     /// Converts this `PathBuf` into a [boxed](Box) [`Path`].
1436:         let rw = Box::into_raw(self.inner.into_boxed_os_str()) as *mut Path;
1519: impl From<&Path> for Box<Path> {
1520:     /// Creates a boxed [`Path`] from a reference.
1522:     /// This will allocate and clone `path` to it.
1523:     fn from(path: &Path) -> Box<Path> {
1524:         let boxed: Box<OsStr> = path.inner.into();
1525:         let rw = Box::into_raw(boxed) as *mut Path;
1530: impl From<Cow<'_, Path>> for Box<Path> {
1531:     /// Creates a boxed [`Path`] from a clone-on-write pointer.
1535:     fn from(cow: Cow<'_, Path>) -> Box<Path> {
1537:             Cow::Borrowed(path) => Box::from(path),
1538:             Cow::Owned(path) => Box::from(path),
1544:     /// Converts a <code>[Box]&lt;[Path]&gt;</code> into a [`PathBuf`].
1548:     fn from(boxed: Box<Path>) -> PathBuf {
1549:         boxed.into_path_buf()
1553: impl From<PathBuf> for Box<Path> {
1554:     /// Converts a [`PathBuf`] into a <code>[Box]&lt;[Path]&gt;</code>.
1559:     fn from(p: PathBuf) -> Box<Path> {
1560:         p.into_boxed_path()
1564: impl Clone for Box<Path> {
1567:         self.to_path_buf().into_boxed_path()
1596:     fn from(path_buf: PathBuf) -> OsString {
1597:         path_buf.inner
1646:     type Target = Path;
1648:     fn deref(&self) -> &Path {
1649:         Path::new(&self.inner)
1655:     fn borrow(&self) -> &Path {
1667: impl<'a> From<&'a Path> for Cow<'a, Path> {
1669:     /// [`Path`].
1673:     fn from(s: &'a Path) -> Cow<'a, Path> {
1678: impl<'a> From<PathBuf> for Cow<'a, Path> {
1684:     fn from(s: PathBuf) -> Cow<'a, Path> {
1689: impl<'a> From<&'a PathBuf> for Cow<'a, Path> {
1695:     fn from(p: &'a PathBuf) -> Cow<'a, Path> {
1696:         Cow::Borrowed(p.as_path())
1701:     /// Converts a clone-on-write pointer to an owned path.
1705:     fn from(p: Cow<'a, Path>) -> Self {
1710: impl From<PathBuf> for Arc<Path> {
1711:     /// Converts a [`PathBuf`] into an <code>[Arc]<[Path]></code> by moving the [`PathBuf`] data
1714:     fn from(s: PathBuf) -> Arc<Path> {
1716:         unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
1720: impl From<&Path> for Arc<Path> {
1721:     /// Converts a [`Path`] into an [`Arc`] by copying the [`Path`] data into a new [`Arc`] buffer.
1723:     fn from(s: &Path) -> Arc<Path> {
1725:         unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
1729: impl From<PathBuf> for Rc<Path> {
1730:     /// Converts a [`PathBuf`] into an <code>[Rc]<[Path]></code> by moving the [`PathBuf`] data into
1733:     fn from(s: PathBuf) -> Rc<Path> {
1735:         unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
1739: impl From<&Path> for Rc<Path> {
1740:     /// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new [`Rc`] buffer.
1742:     fn from(s: &Path) -> Rc<Path> {
1744:         unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
1752:         self.to_path_buf()
1769:         self.as_path().hash(h)
1796: /// A slice of a path (akin to [`str`]).
1798: /// This type supports a number of operations for inspecting a path, including
1799: /// breaking the path into its components (separated by `/` on Unix and by either
1800: /// `/` or `\` on Windows), extracting the file name, determining whether the path
1813: /// use std::path::Path;
1817: /// let path = Path::new("./foo/bar.txt");
1819: /// let parent = path.parent();
1820: /// assert_eq!(parent, Some(Path::new("./foo")));
1822: /// let file_stem = path.file_stem();
1825: /// let extension = path.extension();
1828: #[cfg_attr(not(test), rustc_diagnostic_item = "Path")]
1830: // `Path::new` current implementation relies
1831: // on `Path` being layout-compatible with `OsStr`.
1832: // When attribute privacy is implemented, `Path` should be annotated as `#[repr(transparent)]`.
1833: // Anyway, `Path` representation and layout are considered implementation detail, are
1839: /// An error returned from [`Path::strip_prefix`] if the prefix was not found.
1841: /// This `struct` is created by the [`strip_prefix`] method on [`Path`].
1844: /// [`strip_prefix`]: Path::strip_prefix
1849:     // The following (private!) function allows construction of a path from a u8
1851:     unsafe fn from_u8_slice(s: &[u8]) -> &Path {
1852:         Path::new(u8_slice_as_os_str(s))
1859:     /// Directly wraps a string slice as a `Path` slice.
1866:     /// use std::path::Path;
1868:     /// Path::new("foo.txt");
1871:     /// You can create `Path`s from `String`s, or even other `Path`s:
1874:     /// use std::path::Path;
1877:     /// let from_string = Path::new(&string);
1878:     /// let from_path = Path::new(&from_string);
1879:     /// assert_eq!(from_string, from_path);
1881:     pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
1882:         unsafe { &*(s.as_ref() as *const OsStr as *const Path) }
1890:     /// use std::path::Path;
1892:     /// let os_str = Path::new("foo.txt").as_os_str();
1901:     /// Yields a [`&str`] slice if the `Path` is valid unicode.
1912:     /// use std::path::Path;
1914:     /// let path = Path::new("foo.txt");
1915:     /// assert_eq!(path.to_str(), Some("foo.txt"));
1924:     /// Converts a `Path` to a [`Cow<str>`].
1933:     /// Calling `to_string_lossy` on a `Path` with valid unicode:
1936:     /// use std::path::Path;
1938:     /// let path = Path::new("foo.txt");
1939:     /// assert_eq!(path.to_string_lossy(), "foo.txt");
1942:     /// Had `path` contained invalid unicode, the `to_string_lossy` call might
1951:     /// Converts a `Path` to an owned [`PathBuf`].
1956:     /// use std::path::Path;
1958:     /// let path_buf = Path::new("foo.txt").to_path_buf();
1959:     /// assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
1968:     /// Returns `true` if the `Path` is absolute, i.e., if it is independent of
1971:     /// * On Unix, a path is absolute if it starts with the root, so
1974:     /// * On Windows, a path is absolute if it has a prefix and starts with the
1980:     /// use std::path::Path;
1982:     /// assert!(!Path::new("foo.txt").is_absolute());
1985:     /// [`has_root`]: Path::has_root
1992:     /// Returns `true` if the `Path` is relative, i.e., not absolute.
1999:     /// use std::path::Path;
2001:     /// assert!(Path::new("foo.txt").is_relative());
2004:     /// [`is_absolute`]: Path::is_absolute
2015:     /// Returns `true` if the `Path` has a root.
2017:     /// * On Unix, a path has a root if it begins with `/`.
2019:     /// * On Windows, a path has a root if it:
2027:     /// use std::path::Path;
2029:     /// assert!(Path::new("/etc/passwd").has_root());
2037:     /// Returns the `Path` without its final component, if there is one.
2039:     /// Returns [`None`] if the path terminates in a root or prefix.
2044:     /// use std::path::Path;
2046:     /// let path = Path::new("/foo/bar");
2047:     /// let parent = path.parent().unwrap();
2048:     /// assert_eq!(parent, Path::new("/foo"));
2051:     /// assert_eq!(grand_parent, Path::new("/"));
2055:     pub fn parent(&self) -> Option<&Path> {
2060:                 Some(comps.as_path())
2066:     /// Produces an iterator over `Path` and its ancestors.
2068:     /// The iterator will yield the `Path` that is returned if the [`parent`] method is used zero
2077:     /// use std::path::Path;
2079:     /// let mut ancestors = Path::new("/foo/bar").ancestors();
2080:     /// assert_eq!(ancestors.next(), Some(Path::new("/foo/bar")));
2081:     /// assert_eq!(ancestors.next(), Some(Path::new("/foo")));
2082:     /// assert_eq!(ancestors.next(), Some(Path::new("/")));
2085:     /// let mut ancestors = Path::new("../foo/bar").ancestors();
2086:     /// assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
2087:     /// assert_eq!(ancestors.next(), Some(Path::new("../foo")));
2088:     /// assert_eq!(ancestors.next(), Some(Path::new("..")));
2089:     /// assert_eq!(ancestors.next(), Some(Path::new("")));
2093:     /// [`parent`]: Path::parent
2099:     /// Returns the final component of the `Path`, if there is one.
2101:     /// If the path is a normal file, this is the file name. If it's the path of a directory, this
2104:     /// Returns [`None`] if the path terminates in `..`.
2109:     /// use std::path::Path;
2112:     /// assert_eq!(Some(OsStr::new("bin")), Path::new("/usr/bin/").file_name());
2113:     /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("tmp/foo.txt").file_name());
2114:     /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.").file_name());
2115:     /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.//").file_name());
2116:     /// assert_eq!(None, Path::new("foo.txt/..").file_name());
2117:     /// assert_eq!(None, Path::new("/").file_name());
2127:     /// Returns a path that, when joined onto `base`, yields `self`.
2134:     /// [`starts_with`]: Path::starts_with
2139:     /// use std::path::{Path, PathBuf};
2141:     /// let path = Path::new("/test/haha/foo.txt");
2143:     /// assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
2144:     /// assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
2145:     /// assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
2146:     /// assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
2147:     /// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
2149:     /// assert!(path.strip_prefix("test").is_err());
2150:     /// assert!(path.strip_prefix("/haha").is_err());
2153:     /// assert_eq!(path.strip_prefix(prefix), Ok(Path::new("haha/foo.txt")));
2155:     pub fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>
2157:         P: AsRef<Path>,
2162:     fn _strip_prefix(&self, base: &Path) -> Result<&Path, StripPrefixError> {
2164:             .map(|c| c.as_path())
2170:     /// Only considers whole path components to match.
2175:     /// use std::path::Path;
2177:     /// let path = Path::new("/etc/passwd");
2179:     /// assert!(path.starts_with("/etc"));
2180:     /// assert!(path.starts_with("/etc/"));
2181:     /// assert!(path.starts_with("/etc/passwd"));
2182:     /// assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
2183:     /// assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
2185:     /// assert!(!path.starts_with("/e"));
2186:     /// assert!(!path.starts_with("/etc/passwd.txt"));
2188:     /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
2191:     pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
2195:     fn _starts_with(&self, base: &Path) -> bool {
2201:     /// Only considers whole path components to match.
2206:     /// use std::path::Path;
2208:     /// let path = Path::new("/etc/resolv.conf");
2210:     /// assert!(path.ends_with("resolv.conf"));
2211:     /// assert!(path.ends_with("etc/resolv.conf"));
2212:     /// assert!(path.ends_with("/etc/resolv.conf"));
2214:     /// assert!(!path.ends_with("/resolv.conf"));
2215:     /// assert!(!path.ends_with("conf")); // use .extension() instead
2218:     pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
2222:     fn _ends_with(&self, child: &Path) -> bool {
2228:     /// [`self.file_name`]: Path::file_name
2240:     /// use std::path::Path;
2242:     /// assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
2243:     /// assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
2247:     /// This method is similar to [`Path::file_prefix`], which extracts the portion of the file name
2250:     /// [`Path::file_prefix`]: Path::file_prefix
2267:     /// [`self.file_name`]: Path::file_name
2272:     /// # #![feature(path_file_prefix)]
2273:     /// use std::path::Path;
2275:     /// assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap());
2276:     /// assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap());
2280:     /// This method is similar to [`Path::file_stem`], which extracts the portion of the file name
2283:     /// [`Path::file_stem`]: Path::file_stem
2300:     /// [`self.file_name`]: Path::file_name
2305:     /// use std::path::Path;
2307:     /// assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
2308:     /// assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
2315:     /// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
2317:     /// See [`PathBuf::push`] for more details on what it means to adjoin a path.
2322:     /// use std::path::{Path, PathBuf};
2324:     /// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
2327:     pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
2328:         self._join(path.as_ref())
2331:     fn _join(&self, path: &Path) -> PathBuf {
2332:         let mut buf = self.to_path_buf();
2333:         buf.push(path);
2344:     /// use std::path::{Path, PathBuf};
2346:     /// let path = Path::new("/tmp/foo.txt");
2347:     /// assert_eq!(path.with_file_name("bar.txt"), PathBuf::from("/tmp/bar.txt"));
2349:     /// let path = Path::new("/tmp");
2350:     /// assert_eq!(path.with_file_name("var"), PathBuf::from("/var"));
2358:         let mut buf = self.to_path_buf();
2370:     /// use std::path::{Path, PathBuf};
2372:     /// let path = Path::new("foo.rs");
2373:     /// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
2375:     /// let path = Path::new("foo.tar.gz");
2376:     /// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
2377:     /// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
2378:     /// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
2385:         let mut buf = self.to_path_buf();
2390:     /// Produces an iterator over the [`Component`]s of the path.
2392:     /// When parsing the path, there is a small amount of normalization:
2398:     ///   beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and
2411:     /// use std::path::{Path, Component};
2414:     /// let mut components = Path::new("/tmp/foo.txt").components();
2426:             path: self.as_u8_slice(),
2434:     /// Produces an iterator over the path's components viewed as [`OsStr`]
2437:     /// For more information about the particulars of how the path is separated
2440:     /// [`components`]: Path::components
2445:     /// use std::path::{self, Path};
2448:     /// let mut it = Path::new("/tmp/foo.txt").iter();
2449:     /// assert_eq!(it.next(), Some(OsStr::new(&path::MAIN_SEPARATOR.to_string())));
2462:     /// escapes the path please use [`Debug`] instead.
2469:     /// use std::path::Path;
2471:     /// let path = Path::new("/tmp/foo.rs");
2473:     /// println!("{}", path.display());
2475:     #[must_use = "this does not display the path, \
2479:         Display { path: self }
2492:     /// use std::path::Path;
2494:     /// let path = Path::new("/Minas/tirith");
2495:     /// let metadata = path.metadata().expect("metadata call failed");
2511:     /// use std::path::Path;
2513:     /// let path = Path::new("/Minas/tirith");
2514:     /// let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
2523:     /// Returns the canonical, absolute form of the path with all intermediate
2531:     /// use std::path::{Path, PathBuf};
2533:     /// let path = Path::new("/foo/test/../test/bar.rs");
2534:     /// assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
2549:     /// use std::path::Path;
2551:     /// let path = Path::new("/laputa/sky_castle.rs");
2552:     /// let path_link = path.read_link().expect("read_link call failed");
2570:     /// use std::path::Path;
2572:     /// let path = Path::new("/laputa");
2573:     /// for entry in path.read_dir().expect("read_dir call failed") {
2575:     ///         println!("{:?}", entry.path());
2585:     /// Returns `true` if the path points at an existing entity.
2599:     /// use std::path::Path;
2600:     /// assert!(!Path::new("does_not_exist.txt").exists());
2606:     /// check errors, call [`Path::try_exists`].
2616:     /// Returns `Ok(true)` if the path points at an existing entity.
2622:     /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2632:     /// use std::path::Path;
2633:     /// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"))...(1 bytes skipped)...
2634:     /// assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
2644:     /// Returns `true` if the path exists on disk and is pointing at a regular file.
2655:     /// use std::path::Path;
2656:     /// assert_eq!(Path::new("./is_a_directory/").is_file(), false);
2657:     /// assert_eq!(Path::new("a_file.txt").is_file(), true);
2677:     /// Returns `true` if the path exists on disk and is pointing at a directory.
2688:     /// use std::path::Path;
2689:     /// assert_eq!(Path::new("./is_a_directory/").is_dir(), true);
2690:     /// assert_eq!(Path::new("a_file.txt").is_dir(), false);
2704:     /// Returns `true` if the path exists on disk and is pointing at a symbolic link.
2716:     /// use std::path::Path;
2719:     /// let link_path = Path::new("link");
2720:     /// symlink("/origin_does_not_exist/", link_path).unwrap();
2721:     /// assert_eq!(link_path.is_symlink(), true);
2722:     /// assert_eq!(link_path.exists(), false);
2736:     /// Converts a [`Box<Path>`](Box) into a [`PathBuf`] without copying or
2761: /// A [`Path`] might contain non-Unicode data. This `struct` implements the
2763: /// [`display`](Path::display) method on [`Path`]. This may perform lossy
2765: /// which escapes the path please use [`Debug`] instead.
2770: /// use std::path::Path;
2772: /// let path = Path::new("/tmp/foo.rs");
2774: /// println!("{}", path.display());
2785:         fmt::Debug::fmt(&self.path, f)
2791:         self.path.inner.display(f)
2797:     fn eq(&self, other: &Path) -> bool {
2857:     fn partial_cmp(&self, other: &Path) -> Option<cmp::Ordering> {
2864:     fn cmp(&self, other: &Path) -> cmp::Ordering {
2871:     fn as_ref(&self) -> &Path {
2876: impl AsRef<Path> for OsStr {
2878:     fn as_ref(&self) -> &Path {
2879:         Path::new(self)
2883: impl AsRef<Path> for Cow<'_, OsStr> {
2885:     fn as_ref(&self) -> &Path {
2886:         Path::new(self)
2890: impl AsRef<Path> for OsString {
2892:     fn as_ref(&self) -> &Path {
2893:         Path::new(self)
2897: impl AsRef<Path> for str {
2899:     fn as_ref(&self) -> &Path {
2900:         Path::new(self)
2904: impl AsRef<Path> for String {
2906:     fn as_ref(&self) -> &Path {
2907:         Path::new(self)
2913:     fn as_ref(&self) -> &Path {
2941:                 <Path as PartialEq>::eq(self, other)
2948:                 <Path as PartialEq>::eq(self, other)
2955:                 <Path as PartialOrd>::partial_cmp(self, other)
2962:                 <Path as PartialOrd>::partial_cmp(self, other)
2968: impl_cmp!(PathBuf, Path);
2969: impl_cmp!(PathBuf, &'a Path);
2970: impl_cmp!(Cow<'a, Path>, Path);
2971: impl_cmp!(Cow<'a, Path>, &'b Path);
2972: impl_cmp!(Cow<'a, Path>, PathBuf);
2979:                 <Path as PartialEq>::eq(self, other.as_ref())
2986:                 <Path as PartialEq>::eq(self.as_ref(), other)
2993:                 <Path as PartialOrd>::partial_cmp(self, other.as_ref())
3000:                 <Path as PartialOrd>::partial_cmp(self.as_ref(), other)
3010: impl_cmp_os_str!(Path, OsStr);
3011: impl_cmp_os_str!(Path, &'a OsStr);
3012: impl_cmp_os_str!(Path, Cow<'a, OsStr>);
3013: impl_cmp_os_str!(Path, OsString);
3014: impl_cmp_os_str!(&'a Path, OsStr);
3015: impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
3016: impl_cmp_os_str!(&'a Path, OsString);
3017: impl_cmp_os_str!(Cow<'a, Path>, OsStr);
3018: impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
3019: impl_cmp_os_str!(Cow<'a, Path>, OsString);
3035: /// Makes the path absolute without accessing the filesystem.
3037: /// If the path is relative, the current directory is used as the base directory.
3040: /// resolve symlinks and may succeed even if the path does not exist.
3042: /// If the `path` is empty or getting the
3051: /// #![feature(absolute_path)]
3054: ///   use std::path::{self, Path};
3057: ///   let absolute = path::absolute("foo/./bar")?;
3061: ///   let absolute = path::absolute("/foo//test/.././bar.rs")?;
3062: ///   assert_eq!(absolute, Path::new("/foo/test/../bar.rs"));
3069: /// The path is resolved using [POSIX semantics][posix-semantics] except that
3076: /// #![feature(absolute_path)]
3079: ///   use std::path::{self, Path};
3082: ///   let absolute = path::absolute("foo/./bar")?;
3086: ///   let absolute = path::absolute(r"C:\foo//test\..\./bar.rs")?;
3088: ///   assert_eq!(absolute, Path::new(r"C:\foo\bar.rs"));
3095: /// For verbatim paths this will simply return the path as given. For other
3096: /// paths this is currently equivalent to calling [`GetFullPathNameW`][windows-path]
3100: /// [windows-path]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew
3102: pub fn absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
3103:     _absolute(path)
3106: pub(crate) fn _absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
3107:     let path = path.as_ref();
3108:     if path.as_os_str().is_empty() {
3109:         Err(io::const_io_error!(io::ErrorKind::InvalidInput, "cannot make an empty path absolute",))
3111:         sys::path::absolute(path)
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
42: //! new owned paths.
63: //! To build or modify paths, use [`PathBuf`]:
82: //! [`push`]: PathBuf::push
975:         // compare back to front since absolute paths often share long prefixes
1075: /// [`push`]: PathBuf::push
1076: /// [`set_extension`]: PathBuf::set_extension
1083: /// You can use [`push`] to build up a `PathBuf` from
1117: #[cfg_attr(not(test), rustc_diagnostic_item = "PathBuf")]
1119: // `PathBuf::as_mut_vec` current implementation relies
1120: // on `PathBuf` being layout-compatible with `Vec<u8>`.
1121: // When attribute privacy is implemented, `PathBuf` should be annotated as `#[repr(transparent)]`.
1122: // Anyway, `PathBuf` representation and layout are considered implementation detail, are
1131:         unsafe { &mut *(self as *mut PathBuf as *mut Vec<u8>) }
1134:     /// Allocates an empty `PathBuf`.
1145:     pub fn new() -> PathBuf {
1146:         PathBuf { inner: OsString::new() }
1149:     /// Creates a new `PathBuf` with a given capacity used to create the
1169:     pub fn with_capacity(capacity: usize) -> PathBuf {
1170:         PathBuf { inner: OsString::with_capacity(capacity) }
1180:     /// let p = PathBuf::from("/test");
1246:         // verbatim paths need . and .. removed
1311:     /// let mut p = PathBuf::from("/spirited/away.rs");
1338:     /// [`pop`]: PathBuf::pop
1345:     /// let mut buf = PathBuf::from("/");
1348:     /// assert!(buf == PathBuf::from("/bar"));
1351:     /// assert!(buf == PathBuf::from("/baz.txt"));
1381:     /// let mut p = PathBuf::from("/feel/the");
1416:     /// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
1423:     /// let p = PathBuf::from("/the/head");
1510:         PathBuf { inner: self.inner.clone() }
1572:     /// Converts a borrowed [`OsStr`] to a [`PathBuf`].
1574:     /// Allocates a [`PathBuf`] and copies the data into it.
1576:     fn from(s: &T) -> PathBuf {
1577:         PathBuf::from(s.as_ref().to_os_string())
1582:     /// Converts an [`OsString`] into a [`PathBuf`]
1586:     fn from(s: OsString) -> PathBuf {
1587:         PathBuf { inner: s }
1591: impl From<PathBuf> for OsString {
1592:     /// Converts a [`PathBuf`] into an [`OsString`]
1602:     /// Converts a [`String`] into a [`PathBuf`]
1606:     fn from(s: String) -> PathBuf {
1607:         PathBuf::from(OsString::from(s))
1616:         Ok(PathBuf::from(s))
1621:     fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
1622:         let mut buf = PathBuf::new();
1663:         PathBuf::new()
1680:     /// instance of [`PathBuf`].
1691:     /// [`PathBuf`].
1749:     type Owned = PathBuf;
1751:     fn to_owned(&self) -> PathBuf {
1755:     fn clone_into(&self, target: &mut PathBuf) {
1762:     fn eq(&self, other: &PathBuf) -> bool {
1777:     fn partial_cmp(&self, other: &PathBuf) -> Option<cmp::Ordering> {
1784:     fn cmp(&self, other: &PathBuf) -> cmp::Ordering {
1805: /// see [`PathBuf`].
1965:         PathBuf::from(self.inner.to_os_string())
2152:     /// let prefix = PathBuf::from("/test/");
2337:     /// Creates an owned [`PathBuf`] like `self` but with the given file name.
2339:     /// See [`PathBuf::set_file_name`] for more details.
2353:     pub fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf {
2357:     fn _with_file_name(&self, file_name: &OsStr) -> PathBuf {
2363:     /// Creates an owned [`PathBuf`] like `self` but with the given extension.
2365:     /// See [`PathBuf::set_extension`] for more details.
2380:     pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
2384:     fn _with_extension(&self, extension: &OsStr) -> PathBuf {
2459:     /// Returns an object that implements [`Display`] for safely printing paths
2538:     pub fn canonicalize(&self) -> io::Result<PathBuf> {
2556:     pub fn read_link(&self) -> io::Result<PathBuf> {
2742:         PathBuf { inner: OsString::from(inner) }
2759: /// Helper struct for safely printing paths with [`format!`] and `{}`.
3006: impl_cmp_os_str!(PathBuf, OsStr);
3007: impl_cmp_os_str!(PathBuf, &'a OsStr);
3008: impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
3009: impl_cmp_os_str!(PathBuf, OsString);
3048: /// ## Posix paths
3073: /// ## Windows paths
github.com/GNOME/gimp:app/display/gimptoolpath.c: [ mainline, ]
128:   GimpCanvasItem       *path;
222: gimp_tool_path_class_init (GimpToolPathClass *klass)
295: gimp_tool_path_init (GimpToolPath *path)
301: gimp_tool_path_constructed (GObject *object)
315: gimp_tool_path_dispose (GObject *object)
328: gimp_tool_path_set_property (GObject      *object,
355: gimp_tool_path_get_property (GObject    *object,
389: gimp_tool_path_changed (GimpToolWidget *widget)
539: gimp_tool_path_check_writable (GimpToolPath *path)
564: gimp_tool_path_button_press (GimpToolWidget      *widget,
936: gimp_tool_path_button_release (GimpToolWidget        *widget,
962: gimp_tool_path_motion (GimpToolWidget   *widget,
1072: gimp_tool_path_hit (GimpToolWidget   *widget,
1108: gimp_tool_path_hover (GimpToolWidget   *widget,
1122: gimp_tool_path_key_press (GimpToolWidget *widget,
1207: gimp_tool_path_get_cursor (GimpToolWidget     *widget,
1291: gimp_tool_path_get_popup (GimpToolWidget    *widget,
1331: gimp_tool_path_get_function (GimpToolPath     *path,
1571: gimp_tool_path_update_status (GimpToolPath    *path,
1707: gimp_tool_path_begin_change (GimpToolPath *path,
1725: gimp_tool_path_end_change (GimpToolPath *path,
1738: gimp_tool_path_vectors_visible (GimpVectors  *vectors,
1748: gimp_tool_path_vectors_freeze (GimpVectors  *vectors,
1754: gimp_tool_path_vectors_thaw (GimpVectors  *vectors,
1765: gimp_tool_path_verify_state (GimpToolPath *path)
1843: gimp_tool_path_move_selected_anchors (GimpToolPath *path,
1879: gimp_tool_path_delete_selected_anchors (GimpToolPath *path)
1931: gimp_tool_path_new (GimpDisplayShell *shell)
1941: gimp_tool_path_set_vectors (GimpToolPath *path,
1992: gimp_tool_path_get_popup_state (GimpToolPath *path,
2007: gimp_tool_path_delete_anchor (GimpToolPath *path)
2034: gimp_tool_path_shift_start (GimpToolPath *path)
2048: gimp_tool_path_insert_anchor (GimpToolPath *path)
2065: gimp_tool_path_delete_segment (GimpToolPath *path)
2087: gimp_tool_path_reverse_stroke (GimpToolPath *path)
100: struct _GimpToolPathPrivate
137: static void     gimp_tool_path_constructed     (GObject               *object);
138: static void     gimp_tool_path_dispose         (GObject               *object);
139: static void     gimp_tool_path_set_property    (GObject               *object,
143: static void     gimp_tool_path_get_property    (GObject               *object,
148: static void     gimp_tool_path_changed         (GimpToolWidget        *widget);
149: static gint     gimp_tool_path_button_press    (GimpToolWidget        *widget,
154: static void     gimp_tool_path_button_release  (GimpToolWidget        *widget,
159: static void     gimp_tool_path_motion          (GimpToolWidget        *widget,
163: static GimpHit  gimp_tool_path_hit             (GimpToolWidget        *widget,
167: static void     gimp_tool_path_hover           (GimpToolWidget        *widget,
171: static gboolean gimp_tool_path_key_press       (GimpToolWidget        *widget,
173: static gboolean gimp_tool_path_get_cursor      (GimpToolWidget        *widget,
179: static GimpUIManager * gimp_tool_path_get_popup (GimpToolWidget       *widget,
182:                                                 const gchar          **ui_path);
185:                    gimp_tool_path_get_function (GimpToolPath          *path,
189: static void     gimp_tool_path_update_status   (GimpToolPath          *path,
193: static void     gimp_tool_path_begin_change    (GimpToolPath          *path,
195: static void     gimp_tool_path_end_change      (GimpToolPath          *path,
198: static void     gimp_tool_path_vectors_visible (GimpVectors           *vectors,
199:                                                 GimpToolPath          *path);
200: static void     gimp_tool_path_vectors_freeze  (GimpVectors           *vectors,
201:                                                 GimpToolPath          *path);
202: static void     gimp_tool_path_vectors_thaw    (GimpVectors           *vectors,
203:                                                 GimpToolPath          *path);
204: static void     gimp_tool_path_verify_state    (GimpToolPath          *path);
206: static void     gimp_tool_path_move_selected_anchors
207:                                                (GimpToolPath          *path,
210: static void     gimp_tool_path_delete_selected_anchors
211:                                                (GimpToolPath          *path);
214: G_DEFINE_TYPE_WITH_PRIVATE (GimpToolPath, gimp_tool_path, GIMP_TYPE_TOOL_WIDGET)
216: #define parent_class gimp_tool_path_parent_class
218: static guint path_signals[LAST_SIGNAL] = { 0 };
227:   object_class->constructed     = gimp_tool_path_constructed;
228:   object_class->dispose         = gimp_tool_path_dispose;
229:   object_class->set_property    = gimp_tool_path_set_property;
230:   object_class->get_property    = gimp_tool_path_get_property;
232:   widget_class->changed         = gimp_tool_path_changed;
233:   widget_class->focus_changed   = gimp_tool_path_changed;
234:   widget_class->button_press    = gimp_tool_path_button_press;
235:   widget_class->button_release  = gimp_tool_path_button_release;
236:   widget_class->motion          = gimp_tool_path_motion;
237:   widget_class->hit             = gimp_tool_path_hit;
238:   widget_class->hover           = gimp_tool_path_hover;
239:   widget_class->key_press       = gimp_tool_path_key_press;
240:   widget_class->get_cursor      = gimp_tool_path_get_cursor;
241:   widget_class->get_popup       = gimp_tool_path_get_popup;
243:   path_signals[BEGIN_CHANGE] =
252:   path_signals[END_CHANGE] =
261:   path_signals[ACTIVATE] =
297:   path->private = gimp_tool_path_get_instance_private (path);
303:   GimpToolPath        *path    = GIMP_TOOL_PATH (object);
305:   GimpToolPathPrivate *private = path->private;
309:   private->path = gimp_tool_widget_add_path (widget, NULL);
311:   gimp_tool_path_changed (widget);
317:   GimpToolPath        *path    = GIMP_TOOL_PATH (object);
318:   GimpToolPathPrivate *private = path->private;
320:   gimp_tool_path_set_vectors (path, NULL);
333:   GimpToolPath        *path    = GIMP_TOOL_PATH (object);
334:   GimpToolPathPrivate *private = path->private;
339:       gimp_tool_path_set_vectors (path, g_value_get_object (value));
360:   GimpToolPath        *path    = GIMP_TOOL_PATH (object);
361:   GimpToolPathPrivate *private = path->private;
391:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
392:   GimpToolPathPrivate *private = path->private;
406:       gimp_canvas_path_set (private->path,
408:       gimp_canvas_item_set_visible (private->path,
534:       gimp_canvas_path_set (private->path, NULL);
541:   GimpToolPathPrivate *private = path->private;
542:   GimpToolWidget      *widget  = GIMP_TOOL_WIDGET (path);
548:       gimp_tool_widget_message_literal (GIMP_TOOL_WIDGET (path),
549:                                         _("The active path is locked."));
570:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
571:   GimpToolPathPrivate *private = path->private;
594:       if (gimp_canvas_item_on_vectors (private->path,
600:           gimp_tool_path_set_vectors (path, vectors);
623:       gimp_tool_path_set_vectors (path, vectors);
635:       gimp_tool_path_check_writable (path))
637:       gimp_tool_path_begin_change (path, _("Add Stroke"));
654:       gimp_tool_path_check_writable (path))
661:       gimp_tool_path_begin_change (path, _("Add Anchor"));
683:       gimp_tool_path_check_writable (path))
685:       gimp_tool_path_begin_change (path, _("Insert Anchor"));
712:       gimp_tool_path_check_writable (path))
714:       gimp_tool_path_begin_change (path, _("Drag Handle"));
727:           gimp_canvas_item_on_vectors_handle (private->path,
743:       gimp_tool_path_check_writable (path))
745:       gimp_tool_path_begin_change (path, _("Drag Anchor"));
761:       gimp_tool_path_check_writable (path))
763:       gimp_tool_path_begin_change (path, _("Drag Anchors"));
783:       gimp_tool_path_check_writable (path))
785:       gimp_tool_path_begin_change (path, _("Drag Curve"));
812:       gimp_tool_path_check_writable (path))
814:       gimp_tool_path_begin_change (path, _("Connect Strokes"));
844:       gimp_tool_path_check_writable (path))
846:       gimp_tool_path_begin_change (path, _("Drag Path"));
848:       /* Work is being done in gimp_tool_path_motion()... */
855:       gimp_tool_path_check_writable (path))
857:       gimp_tool_path_begin_change (path, _("Convert Edge"));
886:       gimp_tool_path_check_writable (path))
888:       gimp_tool_path_begin_change (path, _("Delete Anchor"));
907:       gimp_tool_path_check_writable (path))
911:       gimp_tool_path_begin_change (path, _("Delete Segment"));
942:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
943:   GimpToolPathPrivate *private = path->private;
952:           gimp_tool_path_end_change (path, FALSE);
956:           gimp_tool_path_end_change (path, TRUE);
967:   GimpToolPath        *path     = GIMP_TOOL_PATH (widget);
968:   GimpToolPathPrivate *private  = path->private;
1014:           gimp_tool_path_move_selected_anchors (path,
1031:       gimp_tool_path_move_selected_anchors (path,
1077:   GimpToolPath *path = GIMP_TOOL_PATH (widget);
1079:   switch (gimp_tool_path_get_function (path, coords, state))
1113:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
1114:   GimpToolPathPrivate *private = path->private;
1116:   private->function = gimp_tool_path_get_function (path, coords, state);
1118:   gimp_tool_path_update_status (path, state, proximity);
1125:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
1126:   GimpToolPathPrivate *private = path->private;
1147:       g_signal_emit (path, path_signals[ACTIVATE], 0,
1153:       gimp_tool_path_delete_selected_anchors (path);
1163:       gimp_tool_path_begin_change (path, _("Move Anchors"));
1169:           gimp_tool_path_move_selected_anchors (path, -xdist, 0);
1173:           gimp_tool_path_move_selected_anchors (path, xdist, 0);
1177:           gimp_tool_path_move_selected_anchors (path, 0, -ydist);
1181:           gimp_tool_path_move_selected_anchors (path, 0, ydist);
1189:       gimp_tool_path_end_change (path, TRUE);
1214:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
1215:   GimpToolPathPrivate *private = path->private;
1294:                           const gchar      **ui_path)
1296:   GimpToolPath        *path    = GIMP_TOOL_PATH (widget);
1297:   GimpToolPathPrivate *private = path->private;
1314:   /* we're using a side effects of gimp_tool_path_get_function
1316:   gimp_tool_path_get_function (path, coords, state);
1322:       *ui_path = "/vector-toolpath-popup";
1335:   GimpToolPathPrivate *private    = path->private;
1350:       on_handle = gimp_canvas_item_on_vectors_handle (private->path,
1360:         on_curve = gimp_canvas_item_on_vectors_curve (private->path,
1372:       on_vectors = gimp_canvas_item_on_vectors (private->path,
1575:   GimpToolPathPrivate *private     = path->private;
1583:       gimp_tool_widget_set_status (GIMP_TOOL_WIDGET (path), NULL);
1590:       status = _("Click to pick path to edit");
1594:       status = _("Click to create a new path");
1598:       status = _("Click to create a new component of the path");
1667:       status = _("Click-Drag to move the path around");
1672:                                          "on the path"),
1688:       status = _("Click to open up the path");
1696:       status = _("Clicking here does nothing, try clicking on path elements.");
1700:   gimp_tool_widget_set_status (GIMP_TOOL_WIDGET (path), status);
1710:   GimpToolPathPrivate *private = path->private;
1718:   g_signal_emit (path, path_signals[BEGIN_CHANGE], 0,
1728:   GimpToolPathPrivate *private = path->private;
1733:   g_signal_emit (path, path_signals[END_CHANGE], 0,
1739:                                 GimpToolPath *path)
1741:   GimpToolPathPrivate *private = path->private;
1743:   gimp_canvas_item_set_visible (private->path,
1749:                                GimpToolPath *path)
1755:                              GimpToolPath *path)
1760:   gimp_tool_path_verify_state (path);
1761:   gimp_tool_path_changed (GIMP_TOOL_WIDGET (path));
1767:   GimpToolPathPrivate *private          = path->private;
1847:   GimpToolPathPrivate *private = path->private;
1881:   GimpToolPathPrivate *private = path->private;
1904:                   gimp_tool_path_begin_change (path, _("Delete Anchors"));
1922:     gimp_tool_path_end_change (path, TRUE);
1935:   return g_object_new (GIMP_TYPE_TOOL_PATH,
1946:   g_return_if_fail (GIMP_IS_TOOL_PATH (path));
1949:   private = path->private;
1957:                                             gimp_tool_path_vectors_visible,
1958:                                             path);
1960:                                             gimp_tool_path_vectors_freeze,
1961:                                             path);
1963:                                             gimp_tool_path_vectors_thaw,
1964:                                             path);
1971:   gimp_tool_path_verify_state (path);
1978:                                G_CALLBACK (gimp_tool_path_vectors_visible),
1979:                                path, 0);
1981:                                G_CALLBACK (gimp_tool_path_vectors_freeze),
1982:                                path, 0);
1984:                                G_CALLBACK (gimp_tool_path_vectors_thaw),
1985:                                path, 0);
1988:   g_object_notify (G_OBJECT (path), "vectors");
1996:   GimpToolPathPrivate *private = path->private;
2009:   GimpToolPathPrivate *private = path->private;
2014:   gimp_tool_path_begin_change (path, _("Delete Anchors"));
2029:   gimp_tool_path_end_change (path, TRUE);
2036:   GimpToolPathPrivate *private = path->private;
2041:   gimp_tool_path_begin_change (path, _("Shift start"));
2043:   gimp_tool_path_end_change (path, TRUE);
2050:   GimpToolPathPrivate *private = path->private;
2056:   gimp_tool_path_begin_change (path, _("Insert Anchor"));
2060:   gimp_tool_path_end_change (path, TRUE);
2067:   GimpToolPathPrivate *private = path->private;
2073:   gimp_tool_path_begin_change (path, _("Delete Segment"));
2082:   gimp_tool_path_end_change (path, TRUE);
2089:   GimpToolPathPrivate *private = path->private;
2093:   gimp_tool_path_begin_change (path, _("Insert Anchor"));
2095:   gimp_tool_path_end_change (path, TRUE);
4:  * gimptoolpath.c
50: #include "gimpcanvaspath.h"
53: #include "gimptoolpath.h"
1217:   *tool_cursor = GIMP_TOOL_CURSOR_PATHS;
1233:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
1238:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
1243:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_SEGMENT;
1248:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_CONTROL;
1253:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_CONTROL;
1258:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
1263:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_SEGMENT;
1273:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_ANCHOR;
1278:       *tool_cursor = GIMP_TOOL_CURSOR_PATHS_SEGMENT;
1310:                                        "<VectorToolPath>",
247:                   G_STRUCT_OFFSET (GimpToolPathClass, begin_change),
256:                   G_STRUCT_OFFSET (GimpToolPathClass, end_change),
265:                   G_STRUCT_OFFSET (GimpToolPathClass, activate),
1944:   GimpToolPathPrivate *private;
chromium.googlesource.com/arc/arc:third_party/chromium-ppapi/third_party/blink/renderer/platform/graphics/path.cc: [ master, ]
43: Path::Path() : path_() {}
45: Path::Path(const Path& other) {
49: Path::Path(const SkPath& other) {
91: SkPath Path::StrokePath(const StrokeData& stroke_data) const {
205: static bool CalculatePointAndNormalOnPath(SkPathMeasure& measure,
348: void Path::CloseSubpath() {
512: void Path::AddPath(const Path& src, const AffineTransform& transform) {
521: bool Path::SubtractPath(const Path& other) {
525: bool Path::UnionPath(const Path& other) {
529: bool Path::IntersectPath(const Path& other) {
121: static FloatPoint* ConvertPathPoints(FloatPoint dst[],
501: void Path::AddPathForRoundedRect(const FloatRect& rect,
30: #include "third_party/blink/renderer/platform/graphics/path.h"
46:   path_ = SkPath(other.path_);
50:   path_ = other;
53: Path::~Path() = default;
55: Path& Path::operator=(const Path& other) {
56:   path_ = SkPath(other.path_);
60: Path& Path::operator=(const SkPath& other) {
61:   path_ = other;
65: bool Path::operator==(const Path& other) const {
66:   return path_ == other.path_;
69: bool Path::Contains(const FloatPoint& point) const {
72:   return path_.contains(SkScalar(point.X()), SkScalar(point.Y()));
75: bool Path::Contains(const FloatPoint& point, WindRule rule) const {
81:   if (path_.getFillType() != fill_type) {
82:     SkPath tmp(path_);
86:   return path_.contains(x, y);
99:   SkPath stroke_path;
100:   flags.getFillPath(path_, &stroke_path, nullptr, kResScale);
102:   return stroke_path;
105: bool Path::StrokeContains(const FloatPoint& point,
113: FloatRect Path::BoundingRect() const {
114:   return path_.computeTightBounds();
117: FloatRect Path::StrokeBoundingRect(const StrokeData& stroke_data) const {
131: void Path::Apply(void* info, PathApplierFunction function) const {
132:   SkPath::RawIter iter(path_);
134:   PathElement path_element;
135:   FloatPoint path_points[3];
140:         path_element.type = kPathElementMoveToPoint;
141:         path_element.points = ConvertPathPoints(path_points, &pts[0], 1);
144:         path_element.type = kPathElementAddLineToPoint;
145:         path_element.points = ConvertPathPoints(path_points, &pts[1], 1);
148:         path_element.type = kPathElementAddQuadCurveToPoint;
149:         path_element.points = ConvertPathPoints(path_points, &pts[1], 2);
152:         path_element.type = kPathElementAddCurveToPoint;
153:         path_element.points = ConvertPathPoints(path_points, &pts[1], 3);
164:         path_element.type = kPathElementAddQuadCurveToPoint;
166:           path_element.points =
167:               ConvertPathPoints(path_points, &quads[1 + 2 * i], 2);
168:           function(info, &path_element);
173:         path_element.type = kPathElementCloseSubpath;
174:         path_element.points = ConvertPathPoints(path_points, nullptr, 0);
179:     function(info, &path_element);
183: void Path::Transform(const AffineTransform& xform) {
184:   path_.transform(AffineTransformToSkMatrix(xform));
187: float Path::length() const {
189:   SkPathMeasure measure(path_, false);
198: FloatPoint Path::PointAtLength(float length) const {
230: void Path::PointAndNormalAtLength(float length,
233:   SkPathMeasure measure(path_, false);
239:   SkPoint position = path_.getPoint(0);
245: Path::PositionCalculator::PositionCalculator(const Path& path)
246:     : path_(path.GetSkPath()),
247:       path_measure_(path.GetSkPath(), false),
250: void Path::PositionCalculator::PointAndNormalAtLength(float length,
256:       // Reset path measurer to rewind (and restart from 0).
257:       path_measure_.setPath(&path_, false);
261:     if (CalculatePointAndNormalOnPath(path_measure_, accumulated_length_,
266:   SkPoint position = path_.getPoint(0);
272: void Path::Clear() {
273:   path_.reset();
276: bool Path::IsEmpty() const {
277:   return path_.isEmpty();
280: bool Path::IsClosed() const {
281:   return path_.isLastContourClosed();
284: void Path::SetIsVolatile(bool is_volatile) {
285:   path_.setIsVolatile(is_volatile);
288: bool Path::HasCurrentPoint() const {
289:   return path_.getPoints(nullptr, 0);
292: FloatPoint Path::CurrentPoint() const {
293:   if (path_.countPoints() > 0) {
295:     path_.getLastPt(&sk_result);
307: void Path::SetWindRule(const WindRule rule) {
308:   path_.setFillType(WebCoreWindRuleToSkFillType(rule));
311: void Path::MoveTo(const FloatPoint& point) {
312:   path_.moveTo(FloatPointToSkPoint(point));
315: void Path::AddLineTo(const FloatPoint& point) {
316:   path_.lineTo(FloatPointToSkPoint(point));
319: void Path::AddQuadCurveTo(const FloatPoint& cp, const FloatPoint& ep) {
320:   path_.quadTo(FloatPointToSkPoint(cp), FloatPointToSkPoint(ep));
323: void Path::AddBezierCurveTo(const FloatPoint& p1,
326:   path_.cubicTo(FloatPointToSkPoint(p1), FloatPointToSkPoint(p2),
330: void Path::AddArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) {
331:   path_.arcTo(FloatPointToSkPoint(p1), FloatPointToSkPoint(p2),
335: void Path::AddArcTo(const FloatPoint& p,
340:   path_.arcTo(WebCoreFloatToSkScalar(r.Width()),
349:   path_.close();
352: void Path::AddEllipse(const FloatPoint& p,
375:   // We can't use SkPath::addOval(), because addOval() makes a new sub-path.
384:     path_.arcTo(oval, start_degrees, s180, false);
385:     path_.arcTo(oval, start_degrees + s180, s180, false);
389:     path_.arcTo(oval, start_degrees, -s180, false);
390:     path_.arcTo(oval, start_degrees - s180, -s180, false);
394:   path_.arcTo(oval, start_degrees, sweep_degrees, false);
397: void Path::AddArc(const FloatPoint& p,
404: void Path::AddRect(const FloatRect& rect) {
406:   path_.addRect(rect, SkPath::kCW_Direction, 0);
409: void Path::AddEllipse(const FloatPoint& p,
435: void Path::AddEllipse(const FloatRect& rect) {
437:   path_.addOval(rect, SkPath::kCW_Direction, 1);
440: void Path::AddRoundedRect(const FloatRoundedRect& r) {
445: void Path::AddRoundedRect(const FloatRect& rect,
474: void Path::AddRoundedRect(const FloatRect& rect,
507:   path_.addRRect(FloatRoundedRect(rect, top_left_radius, top_right_radius,
513:   path_.addPath(src.GetSkPath(), AffineTransformToSkMatrix(transform));
516: void Path::Translate(const FloatSize& size) {
517:   path_.offset(WebCoreFloatToSkScalar(size.Width()),
522:   return Op(path_, other.path_, kDifference_SkPathOp, &path_);
526:   return Op(path_, other.path_, kUnion_SkPathOp, &path_);
530:   return Op(path_, other.path_, kIntersect_SkPathOp, &path_);
39: #include "third_party/skia/include/pathops/SkPathOps.h"
80:   SkPath::FillType fill_type = WebCoreWindRuleToSkFillType(rule);
109:   return StrokePath(stroke_data)
118:   return StrokePath(stroke_data).computeTightBounds();
139:       case SkPath::kMove_Verb:
143:       case SkPath::kLine_Verb:
147:       case SkPath::kQuad_Verb:
151:       case SkPath::kCubic_Verb:
155:       case SkPath::kConic_Verb: {
161:         SkPath::ConvertConicToQuads(pts[0], pts[1], pts[2], iter.conicWeight(),
172:       case SkPath::kClose_Verb:
176:       case SkPath::kDone_Verb:
235:   if (CalculatePointAndNormalOnPath(
343:               large_arc ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
344:               sweep ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
378:   // Use s180, not s360, because SkPath::arcTo(oval, angle, s360, false) draws
382:     // SkPath::arcTo can't handle the sweepAngle that is equal to or greater
509:                  SkPath::kCW_Direction, 0);
471:   AddPathForRoundedRect(rect, radius, radius, radius, radius);
497:   AddPathForRoundedRect(rect, top_left_radius, top_right_radius,
chromium.googlesource.com/native_client/nacl-llvm-project-v10:clang/include/clang/Analysis/PathDiagnostic.h: [ master, ] Duplicate result
android.googlesource.com/platform/external/clang_35a:include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h: [ master, ]
569:   PathPieces path;
739:   const PathPieces &path;
55: class PathDiagnosticConsumer {
86:   PathDiagnosticConsumer() : flushed(false) {}
98:   enum PathGenerationScheme { None, Minimal, Extensive, AlternateExtensive };
115: class PathDiagnosticRange : public SourceRange {
119:   PathDiagnosticRange(const SourceRange &R, bool isP = false)
122:   PathDiagnosticRange() : isPoint(false) {}
128: class PathDiagnosticLocation {
137:   PathDiagnosticLocation(SourceLocation L, const SourceManager &sm,
152:   PathDiagnosticLocation()
156:   PathDiagnosticLocation(const Stmt *s,
170:   PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
181:   PathDiagnosticLocation(SourceLocation loc, const SourceManager &sm)
301: class PathDiagnosticLocationPair {
305:   PathDiagnosticLocationPair(const PathDiagnosticLocation &start,
330: class PathDiagnosticPiece : public RefCountedBaseVPTR {
414: class PathPieces : public std::list<IntrusiveRefCntPtr<PathDiagnosticPiece> > {
429: class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
433:   PathDiagnosticSpotPiece(const PathDiagnosticLocation &pos,
495: class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
505:   PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
544: class PathDiagnosticCallPiece : public PathDiagnosticPiece {
545:   PathDiagnosticCallPiece(const Decl *callerD,
550:   PathDiagnosticCallPiece(PathPieces &oldPath, const Decl *caller)
615: class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
618:   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
625:   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
681: class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
683:   PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos)
710: class PathDiagnostic : public llvm::FoldingSetNode {
722:   PathPieces pathImpl;
723:   SmallVector<PathPieces *, 3> pathStack;
743:   PathPieces &getActivePath() {
757:   void pushActivePath(PathPieces *p) { pathStack.push_back(p); }
758:   void popActivePath() { if (!pathStack.empty()) pathStack.pop_back(); }
762:   void setEndOfPath(PathDiagnosticPiece *EndPiece) {
775:   void resetPath() {
15: #define LLVM_CLANG_PATH_DIAGNOSTIC_H
1: //===--- PathDiagnostic.h - Path-Specific Diagnostic Handling ---*- C++ -*-===//
14: #ifndef LLVM_CLANG_PATH_DIAGNOSTIC_H
50: // High-level interface for handlers of path-sensitive diagnostics.
112: // Path-sensitive diagnostics.
248:   /// of path location.
327: // Path "pieces" for path-sensitive diagnostics.
552:       NoExit(true), path(oldPath) {}
595:     for (PathPieces::iterator I = path.begin(), 
596:          E = path.end(); I != E; ++I) (*I)->flattenLocations();
707: /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive
709: ///  each which represent the pieces of the path.
719:   /// \brief Loc The location of the path diagnostic report.
741:   /// Return the path currently used by builders for constructing the 
749:   /// Return a mutable version of 'path'.
754:   /// Return the unrolled size of the path.
765:     assert(Loc.isValid() && "Invalid location for end-of-path piece");
795:   /// issue occurs along a path, this represents the "central" area
825:   /// Profiles the diagnostic, independent of the path it references.
831:   /// Profiles the diagnostic, including its path.
10: //  This file defines the PathDiagnostic-related interfaces.
53: class PathDiagnostic;
76:     void addDiagnostic(const PathDiagnostic &PD,
80:     PDFileEntry::ConsumerFiles *getFiles(const PathDiagnostic &PD);
87:   virtual ~PathDiagnosticConsumer();
91:   virtual void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
96:   void HandlePathDiagnostic(PathDiagnostic *D);
99:   virtual PathGenerationScheme getGenerationScheme() const { return Minimal; }
102:   /// Return true if the PathDiagnosticConsumer supports individual
103:   /// PathDiagnostics that span multiple files.
108:   llvm::FoldingSet<PathDiagnostic> Diags;
135:   PathDiagnosticRange Range;
147:   PathDiagnosticRange
188:   static PathDiagnosticLocation create(const Decl *D,
190:     return PathDiagnosticLocation(D, SM);
194:   static PathDiagnosticLocation createBegin(const Decl *D,
198:   static PathDiagnosticLocation createBegin(const Stmt *S,
206:   static PathDiagnosticLocation createEnd(const Stmt *S,
212:   static PathDiagnosticLocation createOperatorLoc(const BinaryOperator *BO,
214:   static PathDiagnosticLocation createConditionalColonLoc(
220:   static PathDiagnosticLocation createMemberLoc(const MemberExpr *ME,
225:   static PathDiagnosticLocation createBeginBrace(const CompoundStmt *CS,
230:   static PathDiagnosticLocation createEndBrace(const CompoundStmt *CS,
235:   static PathDiagnosticLocation createDeclBegin(const LocationContext *LC,
240:   static PathDiagnosticLocation createDeclEnd(const LocationContext *LC,
244:   static PathDiagnosticLocation create(const ProgramPoint& P,
249:   static PathDiagnosticLocation createEndOfPath(const ExplodedNode* N,
253:   static PathDiagnosticLocation createSingleLocation(
254:                                              const PathDiagnosticLocation &PDL);
256:   bool operator==(const PathDiagnosticLocation &X) const {
260:   bool operator!=(const PathDiagnosticLocation &X) const {
272:   PathDiagnosticRange asRange() const {
282:     *this = PathDiagnosticLocation();
303:   PathDiagnosticLocation Start, End;
306:                              const PathDiagnosticLocation &end)
309:   const PathDiagnosticLocation &getStart() const { return Start; }
310:   const PathDiagnosticLocation &getEnd() const { return End; }
312:   void setStart(const PathDiagnosticLocation &L) { Start = L; }
313:   void setEnd(const PathDiagnosticLocation &L) { End = L; }
344:   /// A constant string that can be used to tag the PathDiagnosticPiece,
352:   PathDiagnosticPiece() LLVM_DELETED_FUNCTION;
353:   PathDiagnosticPiece(const PathDiagnosticPiece &P) LLVM_DELETED_FUNCTION;
354:   void operator=(const PathDiagnosticPiece &P) LLVM_DELETED_FUNCTION;
357:   PathDiagnosticPiece(StringRef s, Kind k, DisplayHint hint = Below);
359:   PathDiagnosticPiece(Kind k, DisplayHint hint = Below);
362:   virtual ~PathDiagnosticPiece();
366:   /// Tag this PathDiagnosticPiece with the given C-string.
369:   /// Return the opaque tag (if any) on the PathDiagnosticPiece.
377:   ///  be displayed by the PathDiagnosticConsumer.
380:   virtual PathDiagnosticLocation getLocation() const = 0;
397:   /// Return the SourceRanges associated with this PathDiagnosticPiece.
415:   void flattenTo(PathPieces &Primary, PathPieces &Current,
418:   ~PathPieces();
420:   PathPieces flatten(bool ShouldFlattenMacros) const {
421:     PathPieces Result;
431:   PathDiagnosticLocation Pos;
435:                           PathDiagnosticPiece::Kind k,
437:   : PathDiagnosticPiece(s, k), Pos(pos) {
439:            "PathDiagnosticSpotPiece's must have a valid location.");
443:   PathDiagnosticLocation getLocation() const override { return Pos; }
448:   static bool classof(const PathDiagnosticPiece *P) {
455: /// If a PathDiagnosticEvent occurs in a different frame than the final 
508:     : PathDiagnosticSpotPiece(pos, s, Event, addPosRange),
511:   ~PathDiagnosticEventPiece();
539:   static inline bool classof(const PathDiagnosticPiece *P) {
546:                           const PathDiagnosticLocation &callReturnPos)
547:     : PathDiagnosticPiece(Call), Caller(callerD), Callee(0),
551:     : PathDiagnosticPiece(Call), Caller(caller), Callee(0),
566:   PathDiagnosticLocation callEnter;
567:   PathDiagnosticLocation callEnterWithin;
568:   PathDiagnosticLocation callReturn;  
571:   virtual ~PathDiagnosticCallPiece();
583:   PathDiagnosticLocation getLocation() const override {
587:   IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallEnterEvent() const;
588:   IntrusiveRefCntPtr<PathDiagnosticEventPiece>
590:   IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const;
599:   static PathDiagnosticCallPiece *construct(const ExplodedNode *N,
603:   static PathDiagnosticCallPiece *construct(PathPieces &pieces,
610:   static inline bool classof(const PathDiagnosticPiece *P) {
616:   std::vector<PathDiagnosticLocationPair> LPairs;
619:                                  const PathDiagnosticLocation &endPos,
621:     : PathDiagnosticPiece(s, ControlFlow) {
622:       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
626:                                  const PathDiagnosticLocation &endPos)
627:     : PathDiagnosticPiece(ControlFlow) {
628:       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
631:   ~PathDiagnosticControlFlowPiece();
633:   PathDiagnosticLocation getStartLocation() const {
635:            "PathDiagnosticControlFlowPiece needs at least one location.");
639:   PathDiagnosticLocation getEndLocation() const {
641:            "PathDiagnosticControlFlowPiece needs at least one location.");
645:   void setStartLocation(const PathDiagnosticLocation &L) {
649:   void setEndLocation(const PathDiagnosticLocation &L) {
653:   void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); }
655:   PathDiagnosticLocation getLocation() const override {
659:   typedef std::vector<PathDiagnosticLocationPair>::iterator iterator;
667:   typedef std::vector<PathDiagnosticLocationPair>::const_iterator
672:   static inline bool classof(const PathDiagnosticPiece *P) {
684:     : PathDiagnosticSpotPiece(pos, "", Macro) {}
686:   ~PathDiagnosticMacroPiece();
688:   PathPieces subPieces;
693:     PathDiagnosticSpotPiece::flattenLocations();
694:     for (PathPieces::iterator I = subPieces.begin(), 
698:   static inline bool classof(const PathDiagnosticPiece *P) {
708: ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
720:   PathDiagnosticLocation Loc;
727:   PathDiagnosticLocation UniqueingLoc;
730:   PathDiagnostic() LLVM_DELETED_FUNCTION;
732:   PathDiagnostic(StringRef CheckName, const Decl *DeclWithIssue,
734:                  StringRef category, PathDiagnosticLocation LocationToUnique,
737:   ~PathDiagnostic();
742:   /// PathDiagnostic.
744:     if (pathStack.empty())
745:       return pathImpl;
746:     return *pathStack.back();
750:   PathPieces &getMutablePieces() {
751:     return pathImpl;
760:   bool isWithinCall() const { return !pathStack.empty(); }
766:     getActivePath().push_back(EndPiece);
776:     pathStack.clear();
777:     pathImpl.clear();
778:     Loc = PathDiagnosticLocation();
804:   PathDiagnosticLocation getLocation() const {
810:   PathDiagnosticLocation getUniqueingLoc() const {
821:     for (PathPieces::iterator I = pathImpl.begin(), E = pathImpl.end(); 
828:   /// along different paths.
833:   /// Two diagnostics with the same issue along different paths will generate
android.googlesource.com/platform/external/clang:include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h: [ master, ]
575:   PathPieces path;
745:   const PathPieces &path;
55: class PathDiagnosticConsumer {
92:   PathDiagnosticConsumer() : flushed(false) {}
104:   enum PathGenerationScheme { None, Minimal, Extensive, AlternateExtensive };
121: class PathDiagnosticRange : public SourceRange {
125:   PathDiagnosticRange(SourceRange R, bool isP = false)
128:   PathDiagnosticRange() : isPoint(false) {}
134: class PathDiagnosticLocation {
143:   PathDiagnosticLocation(SourceLocation L, const SourceManager &sm,
158:   PathDiagnosticLocation()
162:   PathDiagnosticLocation(const Stmt *s,
176:   PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
187:   PathDiagnosticLocation(SourceLocation loc, const SourceManager &sm)
308: class PathDiagnosticLocationPair {
312:   PathDiagnosticLocationPair(const PathDiagnosticLocation &start,
337: class PathDiagnosticPiece : public RefCountedBaseVPTR {
421: class PathPieces : public std::list<IntrusiveRefCntPtr<PathDiagnosticPiece> > {
435: class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
439:   PathDiagnosticSpotPiece(const PathDiagnosticLocation &pos,
501: class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
511:   PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
550: class PathDiagnosticCallPiece : public PathDiagnosticPiece {
551:   PathDiagnosticCallPiece(const Decl *callerD,
556:   PathDiagnosticCallPiece(PathPieces &oldPath, const Decl *caller)
621: class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
624:   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
631:   PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos,
687: class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
689:   PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos)
716: class PathDiagnostic : public llvm::FoldingSetNode {
728:   PathPieces pathImpl;
729:   SmallVector<PathPieces *, 3> pathStack;
749:   PathPieces &getActivePath() {
763:   void pushActivePath(PathPieces *p) { pathStack.push_back(p); }
764:   void popActivePath() { if (!pathStack.empty()) pathStack.pop_back(); }
768:   void setEndOfPath(std::unique_ptr<PathDiagnosticPiece> EndPiece) {
781:   void resetPath() {
15: #define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_PATHDIAGNOSTIC_H
1: //===--- PathDiagnostic.h - Path-Specific Diagnostic Handling ---*- C++ -*-===//
50: // High-level interface for handlers of path-sensitive diagnostics.
118: // Path-sensitive diagnostics.
255:   /// of path location.
334: // Path "pieces" for path-sensitive diagnostics.
558:       NoExit(true), path(oldPath) {}
601:     for (PathPieces::iterator I = path.begin(), 
602:          E = path.end(); I != E; ++I) (*I)->flattenLocations();
713: /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive
715: ///  each which represent the pieces of the path.
725:   /// \brief Loc The location of the path diagnostic report.
747:   /// Return the path currently used by builders for constructing the 
755:   /// Return a mutable version of 'path'.
760:   /// Return the unrolled size of the path.
771:     assert(Loc.isValid() && "Invalid location for end-of-path piece");
801:   /// issue occurs along a path, this represents the "central" area
831:   /// Profiles the diagnostic, independent of the path it references.
837:   /// Profiles the diagnostic, including its path.
10: //  This file defines the PathDiagnostic-related interfaces.
14: #ifndef LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_PATHDIAGNOSTIC_H
53: class PathDiagnostic;
82:     void addDiagnostic(const PathDiagnostic &PD,
86:     PDFileEntry::ConsumerFiles *getFiles(const PathDiagnostic &PD);
93:   virtual ~PathDiagnosticConsumer();
97:   virtual void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
102:   void HandlePathDiagnostic(std::unique_ptr<PathDiagnostic> D);
105:   virtual PathGenerationScheme getGenerationScheme() const { return Minimal; }
108:   /// Return true if the PathDiagnosticConsumer supports individual
109:   /// PathDiagnostics that span multiple files.
114:   llvm::FoldingSet<PathDiagnostic> Diags;
141:   PathDiagnosticRange Range;
153:   PathDiagnosticRange genRange(
195:   static PathDiagnosticLocation create(const Decl *D,
197:     return PathDiagnosticLocation(D, SM);
201:   static PathDiagnosticLocation createBegin(const Decl *D,
205:   static PathDiagnosticLocation createBegin(const Stmt *S,
213:   static PathDiagnosticLocation createEnd(const Stmt *S,
219:   static PathDiagnosticLocation createOperatorLoc(const BinaryOperator *BO,
221:   static PathDiagnosticLocation createConditionalColonLoc(
227:   static PathDiagnosticLocation createMemberLoc(const MemberExpr *ME,
232:   static PathDiagnosticLocation createBeginBrace(const CompoundStmt *CS,
237:   static PathDiagnosticLocation createEndBrace(const CompoundStmt *CS,
242:   static PathDiagnosticLocation createDeclBegin(const LocationContext *LC,
247:   static PathDiagnosticLocation createDeclEnd(const LocationContext *LC,
251:   static PathDiagnosticLocation create(const ProgramPoint& P,
256:   static PathDiagnosticLocation createEndOfPath(const ExplodedNode* N,
260:   static PathDiagnosticLocation createSingleLocation(
261:                                              const PathDiagnosticLocation &PDL);
263:   bool operator==(const PathDiagnosticLocation &X) const {
267:   bool operator!=(const PathDiagnosticLocation &X) const {
279:   PathDiagnosticRange asRange() const {
289:     *this = PathDiagnosticLocation();
310:   PathDiagnosticLocation Start, End;
313:                              const PathDiagnosticLocation &end)
316:   const PathDiagnosticLocation &getStart() const { return Start; }
317:   const PathDiagnosticLocation &getEnd() const { return End; }
319:   void setStart(const PathDiagnosticLocation &L) { Start = L; }
320:   void setEnd(const PathDiagnosticLocation &L) { End = L; }
351:   /// A constant string that can be used to tag the PathDiagnosticPiece,
359:   PathDiagnosticPiece() = delete;
360:   PathDiagnosticPiece(const PathDiagnosticPiece &P) = delete;
361:   void operator=(const PathDiagnosticPiece &P) = delete;
364:   PathDiagnosticPiece(StringRef s, Kind k, DisplayHint hint = Below);
366:   PathDiagnosticPiece(Kind k, DisplayHint hint = Below);
369:   ~PathDiagnosticPiece() override;
373:   /// Tag this PathDiagnosticPiece with the given C-string.
376:   /// Return the opaque tag (if any) on the PathDiagnosticPiece.
384:   ///  be displayed by the PathDiagnosticConsumer.
387:   virtual PathDiagnosticLocation getLocation() const = 0;
404:   /// Return the SourceRanges associated with this PathDiagnosticPiece.
422:   void flattenTo(PathPieces &Primary, PathPieces &Current,
426:   PathPieces flatten(bool ShouldFlattenMacros) const {
427:     PathPieces Result;
437:   PathDiagnosticLocation Pos;
441:                           PathDiagnosticPiece::Kind k,
443:   : PathDiagnosticPiece(s, k), Pos(pos) {
445:            "PathDiagnosticSpotPiece's must have a valid location.");
449:   PathDiagnosticLocation getLocation() const override { return Pos; }
454:   static bool classof(const PathDiagnosticPiece *P) {
461: /// If a PathDiagnosticEvent occurs in a different frame than the final 
514:     : PathDiagnosticSpotPiece(pos, s, Event, addPosRange),
517:   ~PathDiagnosticEventPiece() override;
545:   static inline bool classof(const PathDiagnosticPiece *P) {
552:                           const PathDiagnosticLocation &callReturnPos)
553:     : PathDiagnosticPiece(Call), Caller(callerD), Callee(nullptr),
557:     : PathDiagnosticPiece(Call), Caller(caller), Callee(nullptr),
572:   PathDiagnosticLocation callEnter;
573:   PathDiagnosticLocation callEnterWithin;
574:   PathDiagnosticLocation callReturn;  
577:   ~PathDiagnosticCallPiece() override;
589:   PathDiagnosticLocation getLocation() const override {
593:   IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallEnterEvent() const;
594:   IntrusiveRefCntPtr<PathDiagnosticEventPiece>
596:   IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const;
605:   static PathDiagnosticCallPiece *construct(const ExplodedNode *N,
609:   static PathDiagnosticCallPiece *construct(PathPieces &pieces,
616:   static inline bool classof(const PathDiagnosticPiece *P) {
622:   std::vector<PathDiagnosticLocationPair> LPairs;
625:                                  const PathDiagnosticLocation &endPos,
627:     : PathDiagnosticPiece(s, ControlFlow) {
628:       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
632:                                  const PathDiagnosticLocation &endPos)
633:     : PathDiagnosticPiece(ControlFlow) {
634:       LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos));
637:     ~PathDiagnosticControlFlowPiece() override;
639:   PathDiagnosticLocation getStartLocation() const {
641:            "PathDiagnosticControlFlowPiece needs at least one location.");
645:   PathDiagnosticLocation getEndLocation() const {
647:            "PathDiagnosticControlFlowPiece needs at least one location.");
651:   void setStartLocation(const PathDiagnosticLocation &L) {
655:   void setEndLocation(const PathDiagnosticLocation &L) {
659:   void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); }
661:   PathDiagnosticLocation getLocation() const override {
665:   typedef std::vector<PathDiagnosticLocationPair>::iterator iterator;
673:   typedef std::vector<PathDiagnosticLocationPair>::const_iterator
678:   static inline bool classof(const PathDiagnosticPiece *P) {
690:     : PathDiagnosticSpotPiece(pos, "", Macro) {}
692:   ~PathDiagnosticMacroPiece() override;
694:   PathPieces subPieces;
699:     PathDiagnosticSpotPiece::flattenLocations();
700:     for (PathPieces::iterator I = subPieces.begin(), 
704:   static inline bool classof(const PathDiagnosticPiece *P) {
714: ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
726:   PathDiagnosticLocation Loc;
733:   PathDiagnosticLocation UniqueingLoc;
736:   PathDiagnostic() = delete;
738:   PathDiagnostic(StringRef CheckName, const Decl *DeclWithIssue,
740:                  StringRef category, PathDiagnosticLocation LocationToUnique,
743:   ~PathDiagnostic();
748:   /// PathDiagnostic.
750:     if (pathStack.empty())
751:       return pathImpl;
752:     return *pathStack.back();
756:   PathPieces &getMutablePieces() {
757:     return pathImpl;
766:   bool isWithinCall() const { return !pathStack.empty(); }
772:     getActivePath().push_back(EndPiece.release());
782:     pathStack.clear();
783:     pathImpl.clear();
784:     Loc = PathDiagnosticLocation();
810:   PathDiagnosticLocation getLocation() const {
816:   PathDiagnosticLocation getUniqueingLoc() const {
827:     for (PathPieces::iterator I = pathImpl.begin(), E = pathImpl.end(); 
834:   /// along different paths.
839:   /// Two diagnostics with the same issue along different paths will generate
github.com/apache/servicecomb-service-center:datasource/etcd/path/key_generator.go: [ master, ]
18: package path
chromium.googlesource.com/arc/arc:third_party/chromium-ppapi/third_party/blink/web_tests/svg/animations/script-tests/svgpath-animation-1.js: [ master, ]
5: var path = createSVGElement("path");
1: description("Test 'by' animation on path. You should see a green 100x100 path and only PASS messages");
6: path.setAttribute("id", "path");
7: path.setAttribute("d", "M 40 40 L 60 40 L 60 60 L 40 60 z");
8: path.setAttribute("fill", "green");
9: path.setAttribute("onclick", "executeTest()");
19: path.appendChild(animate);
20: rootSVGElement.appendChild(path);
24:     shouldBeEqualToString("path.getAttribute('d')", "M 40 40 L 60 40 L 60 60 L 40 60 z");
28:     shouldBeEqualToString("path.getAttribute('d')", "M 40 40 L 109.975 40 L 109.975 109.975 L 40 109.975 Z");
32:     shouldBeEqualToString("path.getAttribute('d')", "M 40 40 L 110.025 40 L 110.025 110.025 L 40 110.025 Z");
36:     shouldBeEqualToString("path.getAttribute('d')", "M 40 40 L 159.975 40 L 159.975 159.975 L 40 159.975 Z");
40:     shouldBeEqualToString("path.getAttribute('d')", "M 40 40 L 160 40 L 160 160 L 40 160 Z");
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)
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)
github.com/google/go-cmp:cmp/path.go: [ master, ]
26: type Path []PathStep
34: type PathStep interface {
153: type pathStep struct {
174: 	pathStep
213: 	pathStep
258: 	pathStep
272: 	pathStep
282: 	pathStep
292: 	pathStep
337: 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.
99: func (pa Path) String() string {
109: // GoString returns the path to a specific node using Go syntax.
114: func (pa Path) GoString() string {
331: // Path for whether px was ever encountered in the Path history of x, and
336: // 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{}
118: 		var nextStep PathStep
158: func (ps pathStep) Type() reflect.Type             { return ps.typ }
159: func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy }
160: func (ps pathStep) String() string {
310: // pointerPath represents a dual-stack of pointers encountered when
315: // The pointerPath uses a map to represent a stack; where descension into a
333: // equal if both px and py have a cycle resulting from the same PathStep.
344: func (p *pointerPath) Init() {
356: func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) {
371: func (p pointerPath) Pop(vx, vy reflect.Value) {
android.googlesource.com/platform/external/go-cmp:cmp/path.go: [ master, ] Duplicate result
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
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
103:     template<class Path> struct slash
106:     template<class Path> struct dot
109:     template<class Path> struct colon
121: # ifdef BOOST_WINDOWS_PATH
133:       template<class Path>
137:         typedef typename Path::iterator iterator;
143:     //  basic_path  ----------------------------------------------------------//
148:     // invariant: m_path valid according to the portable generic path grammar
176:       basic_path & operator=( const string_type & s )
179:         m_path.clear();
181:         m_path.erase( m_path.begin(), m_path.end() );
186:       basic_path & operator=( const value_type * s )
189:         m_path.clear();
191:         m_path.erase( m_path.begin(), m_path.end() );
198:           basic_path & assign( InputIterator first, InputIterator last )
199:             { m_path.clear(); append( first, last ); return *this; }
203:       basic_path & operator/=( const basic_path & rhs )  { return operator /=( rhs.string().c_str() ); }
204:       basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); }
205:       basic_path & operator/=( const value_type * s );
208:           basic_path & append( InputIterator first, InputIterator last );
214:         m_path.clear();
216:         m_path.erase( m_path.begin(), m_path.end() );
220:       void swap( basic_path & rhs )
222:         m_path.swap( rhs.m_path );
223: #       ifdef BOOST_CYGWIN_PATH
228:       basic_path & remove_filename();
229:       basic_path & replace_extension( const string_type & new_extension = string_type() );
232:       basic_path & remove_leaf() { return remove_filename(); }
236:       const string_type & string() const         { return m_path; }
243:       basic_path   root_path() const;
246:       basic_path   relative_path() const;
247:       basic_path   parent_path() const;
255:       bool         has_leaf() const        { return !m_path.empty(); }
259:       bool empty() const               { return m_path.empty(); } // name consistent with std containers
261:       bool has_root_path() const;
265:       bool has_filename() const        { return !m_path.empty(); }
276:         friend class boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits>;