Loading...
Searching...
No Matches
SdfPathPattern Class Reference

Objects of this class represent SdfPath matching patterns, consisting of an SdfPath prefix followed by a sequence of components, which may contain wildcards and optional embedded predicate expressions (see SdfPredicateExpression). More...

#include <pathPattern.h>

Classes

struct  Component
 A component represents a pattern matching component past the initial SdfPath prefix. More...
 

Public Member Functions

SDF_API SdfPathPattern ()
 Construct the empty pattern whose bool-conversion operator returns false.
 
SDF_API SdfPathPattern (SdfPath const &prefix)
 Construct a SdfPathPattern with the prefix path.
 
SDF_API SdfPathPattern (SdfPath &&prefix)
 Construct a SdfPathPattern with the prefix path.
 
bool CanAppendChild (std::string const &text, std::string *reason=nullptr) const
 Return true if it is valid to append the child element text to this pattern.
 
SDF_API bool CanAppendChild (std::string const &text, SdfPredicateExpression const &predExpr, std::string *reason=nullptr) const
 Return true if it is valid to append the child element text and predExpr to this pattern.
 
SDF_API SdfPathPatternAppendChild (std::string const &text, SdfPredicateExpression &&predExpr)
 Append a prim child component to this pattern, with optional predicate expression predExpr.
 
SDF_API SdfPathPatternAppendChild (std::string const &text, SdfPredicateExpression const &predExpr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SDF_API SdfPathPatternAppendChild (std::string const &text)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool CanAppendProperty (std::string const &text, std::string *reason=nullptr) const
 Return true if it is valid to append the property element text to this pattern.
 
SDF_API bool CanAppendProperty (std::string const &text, SdfPredicateExpression const &predExpr, std::string *reason=nullptr) const
 Return true if it is valid to append the property element text and predExpr to this pattern.
 
SDF_API SdfPathPatternAppendProperty (std::string const &text, SdfPredicateExpression &&predExpr)
 Append a prim property component to this pattern, with optional predicate expression predExpr.
 
SDF_API SdfPathPatternAppendProperty (std::string const &text, SdfPredicateExpression const &predExpr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SDF_API SdfPathPatternAppendProperty (std::string const &text)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SdfPath const & GetPrefix () const &
 Return this pattern's non-speculative prefix (leading path components with no wildcards and no predicates).
 
SdfPath GetPrefix () &&
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SDF_API SdfPathPatternSetPrefix (SdfPath &&p)
 Set this pattern's non-speculative prefix (leading path components with no wildcards and no predicates).
 
SdfPathPatternSetPrefix (SdfPath const &p)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SDF_API bool HasLeadingStretch () const
 Return true if this pattern's prefix is the absolute root path and and its first component is a stretch component – that is, the pattern starts with //, false otherwise.
 
SDF_API bool HasTrailingStretch () const
 Return true if this pattern ends with a stretch component: //, false otherwise.
 
SDF_API SdfPathPatternAppendStretchIfPossible ()
 Append a stretch component (i.e.
 
SDF_API SdfPathPatternRemoveTrailingStretch ()
 Remove trailing stretch from this pattern if it has trailing stretch.
 
SDF_API SdfPathPatternRemoveTrailingComponent ()
 If this pattern has components, remove the final component.
 
SDF_API std::string GetText () const
 Return the string representation of this pattern.
 
std::vector< Component > const & GetComponents () const &
 Return this pattern's components that follow its non-speculative prefix path.
 
std::vector< ComponentGetComponents () &&
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< SdfPredicateExpression > const & GetPredicateExprs () const &
 Return the predicate expressions used by this pattern.
 
std::vector< SdfPredicateExpressionGetPredicateExprs () &&
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool IsProperty () const
 Return true if this pattern identifies properties exclusively, false otherwise.
 
 operator bool () const
 Return true if this pattern is not empty, false if it is.
 

Static Public Member Functions

static SDF_API SdfPathPattern const & Everything ()
 Return the pattern "//" which matches all paths.
 
static SDF_API SdfPathPattern const & EveryDescendant ()
 Return the pattern ".//" which matches all paths descendant to an anchor path.
 
static SdfPathPattern Nothing ()
 Return a default constructed SdfPathPattern that matches nothing.
 

Friends

template<class HashState >
void TfHashAppend (HashState &h, SdfPathPattern const &pat)
 
bool operator== (SdfPathPattern const &l, SdfPathPattern const &r)
 
bool operator!= (SdfPathPattern const &l, SdfPathPattern const &r)
 
void swap (SdfPathPattern &l, SdfPathPattern &r)
 

Detailed Description

Objects of this class represent SdfPath matching patterns, consisting of an SdfPath prefix followed by a sequence of components, which may contain wildcards and optional embedded predicate expressions (see SdfPredicateExpression).

Definition at line 30 of file pathPattern.h.

Constructor & Destructor Documentation

◆ SdfPathPattern() [1/3]

SDF_API SdfPathPattern ( )

Construct the empty pattern whose bool-conversion operator returns false.

◆ SdfPathPattern() [2/3]

SDF_API SdfPathPattern ( SdfPath const &  prefix)
explicit

Construct a SdfPathPattern with the prefix path.

◆ SdfPathPattern() [3/3]

SDF_API SdfPathPattern ( SdfPath &&  prefix)
explicit

Construct a SdfPathPattern with the prefix path.

Member Function Documentation

◆ AppendChild() [1/3]

SDF_API SdfPathPattern & AppendChild ( std::string const &  text)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ AppendChild() [2/3]

SDF_API SdfPathPattern & AppendChild ( std::string const &  text,
SdfPredicateExpression &&  predExpr 
)

Append a prim child component to this pattern, with optional predicate expression predExpr.

If this pattern does not yet contain any wildcards or components with predicate expressions, and the input text does not contain wildcards, and predExpr is empty, then append a child component to this pattern's prefix path (see GetPrefix()). Otherwise append this component to the sequence of components. Return *this.

◆ AppendChild() [3/3]

SDF_API SdfPathPattern & AppendChild ( std::string const &  text,
SdfPredicateExpression const &  predExpr 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ AppendProperty() [1/3]

SDF_API SdfPathPattern & AppendProperty ( std::string const &  text)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ AppendProperty() [2/3]

SDF_API SdfPathPattern & AppendProperty ( std::string const &  text,
SdfPredicateExpression &&  predExpr 
)

Append a prim property component to this pattern, with optional predicate expression predExpr.

If this pattern does not yet contain any wildcards or components with predicate expressions, and the input text does not contain wildcards, and predExpr is empty, then append a property component to this pattern's prefix path (see GetPrefix()). Otherwise append this component to the sequence of components. Return *this.

◆ AppendProperty() [3/3]

SDF_API SdfPathPattern & AppendProperty ( std::string const &  text,
SdfPredicateExpression const &  predExpr 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ AppendStretchIfPossible()

SDF_API SdfPathPattern & AppendStretchIfPossible ( )

Append a stretch component (i.e.

//) to this pattern if it's possible to do so. Otherwise do nothing. It is not possible to append a stretch component to a pattern that already ends in a stretch component, or a pattern that identifies a property. Return *this.

◆ CanAppendChild() [1/2]

SDF_API bool CanAppendChild ( std::string const &  text,
SdfPredicateExpression const &  predExpr,
std::string *  reason = nullptr 
) const

Return true if it is valid to append the child element text and predExpr to this pattern.

If not, and reason is not nullptr, set it to an explanatory reason why not.

◆ CanAppendChild() [2/2]

bool CanAppendChild ( std::string const &  text,
std::string *  reason = nullptr 
) const
inline

Return true if it is valid to append the child element text to this pattern.

If not, and reason is not nullptr, set it to an explanatory reason why not.

Definition at line 99 of file pathPattern.h.

◆ CanAppendProperty() [1/2]

SDF_API bool CanAppendProperty ( std::string const &  text,
SdfPredicateExpression const &  predExpr,
std::string *  reason = nullptr 
) const

Return true if it is valid to append the property element text and predExpr to this pattern.

If not, and reason is not nullptr, set it to an explanatory reason why not.

◆ CanAppendProperty() [2/2]

bool CanAppendProperty ( std::string const &  text,
std::string *  reason = nullptr 
) const
inline

Return true if it is valid to append the property element text to this pattern.

If not, and reason is not nullptr, set it to an explanatory reason why not.

Definition at line 133 of file pathPattern.h.

◆ EveryDescendant()

static SDF_API SdfPathPattern const & EveryDescendant ( )
static

Return the pattern ".//" which matches all paths descendant to an anchor path.

◆ Everything()

static SDF_API SdfPathPattern const & Everything ( )
static

Return the pattern "//" which matches all paths.

◆ GetComponents() [1/2]

std::vector< Component > GetComponents ( ) &&
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 225 of file pathPattern.h.

◆ GetComponents() [2/2]

std::vector< Component > const & GetComponents ( ) const &
inline

Return this pattern's components that follow its non-speculative prefix path.

Definition at line 220 of file pathPattern.h.

◆ GetPredicateExprs() [1/2]

std::vector< SdfPredicateExpression > GetPredicateExprs ( ) &&
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 238 of file pathPattern.h.

◆ GetPredicateExprs() [2/2]

std::vector< SdfPredicateExpression > const & GetPredicateExprs ( ) const &
inline

Return the predicate expressions used by this pattern.

These are indexed by a Component's predicateIndex member, if it is not -1.

Definition at line 232 of file pathPattern.h.

◆ GetPrefix() [1/2]

SdfPath GetPrefix ( ) &&
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 171 of file pathPattern.h.

◆ GetPrefix() [2/2]

SdfPath const & GetPrefix ( ) const &
inline

Return this pattern's non-speculative prefix (leading path components with no wildcards and no predicates).

Definition at line 166 of file pathPattern.h.

◆ GetText()

SDF_API std::string GetText ( ) const

Return the string representation of this pattern.

◆ HasLeadingStretch()

SDF_API bool HasLeadingStretch ( ) const

Return true if this pattern's prefix is the absolute root path and and its first component is a stretch component – that is, the pattern starts with //, false otherwise.

◆ HasTrailingStretch()

SDF_API bool HasTrailingStretch ( ) const

Return true if this pattern ends with a stretch component: //, false otherwise.

◆ IsProperty()

bool IsProperty ( ) const
inline

Return true if this pattern identifies properties exclusively, false otherwise.

Definition at line 244 of file pathPattern.h.

◆ Nothing()

static SdfPathPattern Nothing ( )
inlinestatic

Return a default constructed SdfPathPattern that matches nothing.

Definition at line 56 of file pathPattern.h.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Return true if this pattern is not empty, false if it is.

Definition at line 249 of file pathPattern.h.

◆ RemoveTrailingComponent()

SDF_API SdfPathPattern & RemoveTrailingComponent ( )

If this pattern has components, remove the final component.

Otherwise do nothing. Return *this. To inspect and modify the prefix path, use GetPrefix(), SetPrefix().

◆ RemoveTrailingStretch()

SDF_API SdfPathPattern & RemoveTrailingStretch ( )

Remove trailing stretch from this pattern if it has trailing stretch.

Otherwise do nothing. Return *this. See HasTrailingStretch().

◆ SetPrefix() [1/2]

SDF_API SdfPathPattern & SetPrefix ( SdfPath &&  p)

Set this pattern's non-speculative prefix (leading path components with no wildcards and no predicates).

Return *this.

◆ SetPrefix() [2/2]

SdfPathPattern & SetPrefix ( SdfPath const &  p)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 181 of file pathPattern.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( SdfPathPattern const &  l,
SdfPathPattern const &  r 
)
friend

Definition at line 274 of file pathPattern.h.

◆ operator==

bool operator== ( SdfPathPattern const &  l,
SdfPathPattern const &  r 
)
friend

Definition at line 266 of file pathPattern.h.

◆ swap

void swap ( SdfPathPattern l,
SdfPathPattern r 
)
friend

Definition at line 278 of file pathPattern.h.

◆ TfHashAppend

void TfHashAppend ( HashState &  h,
SdfPathPattern const &  pat 
)
friend

Definition at line 260 of file pathPattern.h.


The documentation for this class was generated from the following file: