HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SdfPathPattern Class Reference

#include <pathPattern.h>

Classes

struct  Component
 

Public Member Functions

SDF_API SdfPathPattern ()
 
SDF_API SdfPathPattern (SdfPath const &prefix)
 Construct a SdfPathPattern with the prefix path. More...
 
SDF_API SdfPathPattern (SdfPath &&prefix)
 Construct a SdfPathPattern with the prefix path. More...
 
bool CanAppendChild (std::string const &text, std::string *reason=nullptr) const
 
SDF_API bool CanAppendChild (std::string const &text, SdfPredicateExpression const &predExpr, std::string *reason=nullptr) const
 
SDF_API SdfPathPatternAppendChild (std::string const &text, SdfPredicateExpression &&predExpr)
 
SDF_API SdfPathPatternAppendChild (std::string const &text, SdfPredicateExpression const &predExpr)
 
SDF_API SdfPathPatternAppendChild (std::string const &text)
 
bool CanAppendProperty (std::string const &text, std::string *reason=nullptr) const
 
SDF_API bool CanAppendProperty (std::string const &text, SdfPredicateExpression const &predExpr, std::string *reason=nullptr) const
 
SDF_API SdfPathPatternAppendProperty (std::string const &text, SdfPredicateExpression &&predExpr)
 
SDF_API SdfPathPatternAppendProperty (std::string const &text, SdfPredicateExpression const &predExpr)
 
SDF_API SdfPathPatternAppendProperty (std::string const &text)
 
SdfPath const & GetPrefix () const &
 
SdfPath GetPrefix ()&&
 
SDF_API SdfPathPatternSetPrefix (SdfPath &&p)
 
SdfPathPatternSetPrefix (SdfPath const &p)
 
SDF_API bool HasLeadingStretch () const
 
SDF_API bool HasTrailingStretch () const
 
SDF_API SdfPathPatternAppendStretchIfPossible ()
 
SDF_API SdfPathPatternRemoveTrailingStretch ()
 
SDF_API SdfPathPatternRemoveTrailingComponent ()
 
SDF_API std::string GetText () const
 Return the string representation of this pattern. More...
 
std::vector< Component > const & GetComponents () const &
 
std::vector< ComponentGetComponents ()&&
 
std::vector
< SdfPredicateExpression >
const & 
GetPredicateExprs () const &
 
std::vector
< SdfPredicateExpression
GetPredicateExprs ()&&
 
bool IsProperty () const
 
 operator bool () const
 Return true if this pattern is not empty, false if it is. More...
 

Static Public Member Functions

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

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

SDF_API SdfPathPattern::SdfPathPattern ( )

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

SDF_API SdfPathPattern::SdfPathPattern ( SdfPath const &  prefix)
explicit

Construct a SdfPathPattern with the prefix path.

SDF_API SdfPathPattern::SdfPathPattern ( SdfPath &&  prefix)
explicit

Construct a SdfPathPattern with the prefix path.

Member Function Documentation

SDF_API SdfPathPattern& 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.

SDF_API SdfPathPattern& 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.

SDF_API SdfPathPattern& 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.

SDF_API SdfPathPattern& 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.

SDF_API SdfPathPattern& 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.

SDF_API SdfPathPattern& 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.

SDF_API SdfPathPattern& 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.

bool SdfPathPattern::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.

SDF_API bool SdfPathPattern::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.

bool SdfPathPattern::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.

SDF_API bool SdfPathPattern::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.

static SDF_API SdfPathPattern const& SdfPathPattern::EveryDescendant ( )
static

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

static SDF_API SdfPathPattern const& SdfPathPattern::Everything ( )
static

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

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

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

Definition at line 220 of file pathPattern.h.

std::vector<Component> SdfPathPattern::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.

std::vector<SdfPredicateExpression> const& SdfPathPattern::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.

std::vector<SdfPredicateExpression> SdfPathPattern::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.

SdfPath const& SdfPathPattern::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.

SdfPath SdfPathPattern::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.

SDF_API std::string SdfPathPattern::GetText ( ) const

Return the string representation of this pattern.

SDF_API bool SdfPathPattern::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 SdfPathPattern::HasTrailingStretch ( ) const

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

bool SdfPathPattern::IsProperty ( ) const
inline

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

Definition at line 244 of file pathPattern.h.

static SdfPathPattern SdfPathPattern::Nothing ( )
inlinestatic

Return a default constructed SdfPathPattern that matches nothing.

Definition at line 56 of file pathPattern.h.

SdfPathPattern::operator bool ( ) const
inlineexplicit

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

Definition at line 249 of file pathPattern.h.

SDF_API SdfPathPattern& 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().

SDF_API SdfPathPattern& SdfPathPattern::RemoveTrailingStretch ( )

Remove trailing stretch from this pattern if it has trailing stretch. Otherwise do nothing. Return *this. See HasTrailingStretch().

SDF_API SdfPathPattern& SdfPathPattern::SetPrefix ( SdfPath &&  p)

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

SdfPathPattern& 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

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

Definition at line 274 of file pathPattern.h.

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

Definition at line 266 of file pathPattern.h.

void swap ( SdfPathPattern l,
SdfPathPattern r 
)
friend

Definition at line 278 of file pathPattern.h.

template<class HashState >
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: