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

#include <fixer.h>

Public Member Functions

 UsdValidationFixer (const UsdValidationFixer &)=default
 
UsdValidationFixeroperator= (const UsdValidationFixer &)=default
 
 UsdValidationFixer (UsdValidationFixer &&) noexcept=default
 
UsdValidationFixeroperator= (UsdValidationFixer &&) noexcept=default
 
USDVALIDATION_API UsdValidationFixer (const TfToken &name, const std::string &description, const FixerImplFn &fixerImplFn, const FixerCanApplyFn &canApplyFn, const TfTokenVector &keywords=TfTokenVector(), const TfToken &errorName=TfToken())
 
 ~UsdValidationFixer ()=default
 
const TfTokenGetName () const &
 Returns the name of this fixer. More...
 
TfToken GetName ()&&
 Return the name of this fixer by-value. More...
 
const std::string & GetDescription () const &
 Returns the description of this fixer. More...
 
std::string GetDescription ()&&
 Return the description of this fixer by-value. More...
 
const TfTokenGetErrorName () const &
 Returns the error name that this fixer can fix, if any. More...
 
TfToken GetErrorName ()&&
 Returns the error name that this fixer can fix, if any, by-value. More...
 
USDVALIDATION_API bool IsAssociatedWithErrorName (const TfToken &errorName) const
 Returns true if this fixer is associated with the given error name. More...
 
const TfTokenVectorGetKeywords () const &
 Returns the keywords associated with this fixer. More...
 
TfTokenVector GetKeywords ()&&
 Return the keywords associated with this fixer by-value. More...
 
USDVALIDATION_API bool HasKeyword (const TfToken &keyword) const
 Returns true if this fixer has the given keyword. More...
 
USDVALIDATION_API bool CanApplyFix (const UsdValidationError &error, const UsdEditTarget &editTarget, const UsdTimeCode &timeCode=UsdTimeCode::Default()) const
 
USDVALIDATION_API bool ApplyFix (const UsdValidationError &error, const UsdEditTarget &editTarget, const UsdTimeCode &timeCode=UsdTimeCode::Default()) const
 

Detailed Description

A UsdValidationFixer represents a fix that can be applied to fix a specific validation error.

A fixer is associated with a specific validator, and can be associated with a specific error name, or can be generic to any error associated with the corresponding validator.

A fixer has a name, description, and a set of keywords associated with it. The name must be unique among all fixers associated with a specific validator. The keywords can be used to group fixers by department, show, etc.

A fixer has two functions associated with it:

  • The FixerImplFn is the function that will be called to apply the fix for a given error.
  • The FixerCanApplyFn is the function that will be called to determine if the fixer can be applied to a given error.

Note that the Validation framework will not apply any fixers automatically. It's the responsibility of the client to pick and apply a fix for a given error, by specifically calling the ApplyFix() method on an appropriate UsdEditTarget.

Appropriate fixers can be retrieved from UsdValidationValidator or UsdValidationError itself via the GetFixers(), GetFixersWithKeyword(), GetFixerByName(), GetFixersByErrorName(), etc.

Definition at line 62 of file fixer.h.

Constructor & Destructor Documentation

UsdValidationFixer::UsdValidationFixer ( const UsdValidationFixer )
default
UsdValidationFixer::UsdValidationFixer ( UsdValidationFixer &&  )
defaultnoexcept
USDVALIDATION_API UsdValidationFixer::UsdValidationFixer ( const TfToken name,
const std::string &  description,
const FixerImplFn fixerImplFn,
const FixerCanApplyFn canApplyFn,
const TfTokenVector keywords = TfTokenVector(),
const TfToken errorName = TfToken() 
)

Construct a UsdValidationFixer with the given name and description.

The fixerImplFn is the function that will be called to apply the fix for a given error. The canApplyFn is the function that will be called to determine if the fixer can be applied to a given error. The errorName, if provided, is the error name that this fixer can fix. If not provided, the fixer can be applied to any error associated with the corresponding validator. The keywords are the keywords associated with this fixer. Clients when instantiating a fixer for a validator, can provide keywords such as studio, department, or show. Clients can later see which keywords are associated with the fixer or use the GetFixersByKeywords method to return fixers by the keywords they are associated with.

UsdValidationFixer::~UsdValidationFixer ( )
default

Member Function Documentation

USDVALIDATION_API bool UsdValidationFixer::ApplyFix ( const UsdValidationError error,
const UsdEditTarget editTarget,
const UsdTimeCode timeCode = UsdTimeCode::Default() 
) const

Applies the fix for the given error at the given time code and edit target. Returns true if the fix was applied successfully.

See Also
CanApplyFix
USDVALIDATION_API bool UsdValidationFixer::CanApplyFix ( const UsdValidationError error,
const UsdEditTarget editTarget,
const UsdTimeCode timeCode = UsdTimeCode::Default() 
) const

Returns true if this fixer can be applied to the given error and edit target; false otherwise.

A fixer can be associated with a specific error name, if so, it can only be applied to errors with the same name, otherwise, it can be applied to any error generated by the corresponding validator.

Additionally, the editTarget can be inspected to determine if the fix can be applied to the given target, etc.

See Also
ApplyFix
const std::string& UsdValidationFixer::GetDescription ( ) const
inline

Returns the description of this fixer.

Definition at line 106 of file fixer.h.

std::string UsdValidationFixer::GetDescription ( )
inline

Return the description of this fixer by-value.

Definition at line 112 of file fixer.h.

const TfToken& UsdValidationFixer::GetErrorName ( ) const
inline

Returns the error name that this fixer can fix, if any.

Definition at line 118 of file fixer.h.

TfToken UsdValidationFixer::GetErrorName ( )
inline

Returns the error name that this fixer can fix, if any, by-value.

Definition at line 124 of file fixer.h.

const TfTokenVector& UsdValidationFixer::GetKeywords ( ) const
inline

Returns the keywords associated with this fixer.

Definition at line 134 of file fixer.h.

TfTokenVector UsdValidationFixer::GetKeywords ( )
inline

Return the keywords associated with this fixer by-value.

Definition at line 140 of file fixer.h.

const TfToken& UsdValidationFixer::GetName ( ) const
inline

Returns the name of this fixer.

Definition at line 94 of file fixer.h.

TfToken UsdValidationFixer::GetName ( )
inline

Return the name of this fixer by-value.

Definition at line 100 of file fixer.h.

USDVALIDATION_API bool UsdValidationFixer::HasKeyword ( const TfToken keyword) const

Returns true if this fixer has the given keyword.

USDVALIDATION_API bool UsdValidationFixer::IsAssociatedWithErrorName ( const TfToken errorName) const

Returns true if this fixer is associated with the given error name.

UsdValidationFixer& UsdValidationFixer::operator= ( const UsdValidationFixer )
default
UsdValidationFixer& UsdValidationFixer::operator= ( UsdValidationFixer &&  )
defaultnoexcept

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