8 #ifndef PXR_USD_VALIDATION_USD_VALIDATION_ERROR_H 9 #define PXR_USD_VALIDATION_USD_VALIDATION_ERROR_H 12 #include "pxr/usd/sdf/path.h" 13 #include "pxr/usd/usd/property.h" 15 #include "pxr/usdValidation/usdValidation/api.h" 19 PXR_NAMESPACE_OPEN_SCOPE
83 const SdfLayerHandle &layer = SdfLayerHandle());
96 if (!_layer || _objectPath.
IsEmpty()) {
99 return _layer->HasSpec(_objectPath);
125 return SdfPropertySpecHandle();
127 return _layer->GetPropertyAtPath(_objectPath);
138 return SdfPrimSpecHandle();
140 return _layer->GetPrimAtPath(_objectPath);
163 return _usdStage->GetPrimAtPath(_objectPath);
174 return _usdStage->GetPropertyAtPath(_objectPath);
183 return (_layer == other._layer) && (_usdStage == other._usdStage)
184 && (_objectPath == other._objectPath);
191 return !(*
this == other);
195 UsdStagePtr _usdStage;
196 SdfLayerHandle _layer;
201 using UsdValidationErrorSites = std::vector<UsdValidationErrorSite>;
252 const UsdValidationErrorSites &errorSites,
253 const std::string &errorMsg,
258 return (_name == other._name) && (_errorType == other._errorType)
259 && (_errorSites == other._errorSites)
260 && (_errorMsg == other._errorMsg)
261 && (_validator == other._validator);
266 return !(*
this == other);
278 return std::move(_name);
299 return std::move(_errorSites);
354 return _errorType == UsdValidationErrorType::None;
360 const std::vector<const UsdValidationFixer *>
GetFixers()
const;
372 const std::vector<const UsdValidationFixer *>
411 UsdValidationErrorSites _errorSites;
412 std::string _errorMsg;
417 PXR_NAMESPACE_CLOSE_SCOPE
419 #endif // PXR_USD_VALIDATION_USD_VALIDATION_ERROR_H USDVALIDATION_API const UsdValidationFixer * GetFixerByName(const TfToken &name) const
Return an immutable fixer given its name if it exists, else return nullptr.
USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixersByKeywords(const TfTokenVector &keywords) const
Return a vector of immutable fixers catering to any of the given keywords.
const std::string & GetMessage() const
Returns the message associated with this UsdValidationError.
UsdPrim GetPrim() const
Returns UsdPrim associated with this UsdValidationErrorSite, that is when UsdStage is present and obj...
bool HasNoError() const
Returns true if UsdValidationErrorType is UsdValidationErrorType::None, false otherwise.
bool IsValidSpecInLayer() const
Returns true if the objectPath and layer represent a spec in the layer; false otherwise.
const SdfLayerHandle & GetLayer() const
Returns the SdfLayerHandle associated with this UsdValidationValidatorErrorSite.
UsdValidationErrorType reflects severity of a validation error, which can then be reported appropriat...
bool IsValid() const
Returns true if UsdValidationErrorSite instance can either point to a prim or property spec in a laye...
bool operator==(const UsdValidationErrorSite &other) const
Returns true if other UsdValidationErrorSite has same valued members as this UsdValidationErrorSite,...
const SdfPrimSpecHandle GetPrimSpec() const
Returns the SdfPrimSpecHandle associated with this ValidationErrorSite's layer and objectPath.
A UsdValidationFixer represents a fix that can be applied to fix a specific validation error.
UsdValidationValidator is a class describing a single test.
const TfToken & GetName() const &
Returns the name token of the UsdValidationError.
bool IsProperty() const
Returns true if UsdValidationErrorSite represents a property on a stage, false otherwise.
UsdValidationError is an entity returned by a validation task, which is associated with a UsdValidati...
TfToken GetName() &&
Returns the name token of the UsdValidationError by-value.
Token for efficient comparison, assignment, and hashing of known strings.
USDVALIDATION_API TfToken GetIdentifier() const
An identifier for the error constructed from the validator name this error was generated from and its...
const VtValue & GetData() const
Returns the data associated with this UsdValidationError.
const UsdStagePtr & GetStage() const
Returns the UsdStage associated with this UsdValidationErrorSite; nullptr othewrise.
USDVALIDATION_API UsdValidationError()
A default constructed UsdValidationError signifies no error.
bool IsPrim() const
Returns true if UsdValidationErrorSite represents a prim on a stage, false otherwise.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
const SdfPropertySpecHandle GetPropertySpec() const
Returns the SdfPropertySpecHandle associated with this ValidationErrorSite's layer and objectPath.
std::vector< TfToken > TfTokenVector
Convenience types.
const UsdValidationErrorSites & GetSites() const &
Returns the UsdValidationErrorSite associated with this UsdValidationError.
A path value used to locate objects in layers or scenegraphs.
UsdValidationErrorType GetType() const
Returns the UsdValidationErrorType associated with this UsdValidationError.
UsdProperty GetProperty() const
Returns UsdProperty associated with this UsdValidationErrorSite, that is when UsdStage is present and...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
USDVALIDATION_API const UsdValidationFixer * GetFixerByNameAndErrorName(const TfToken &name) const
Return an immutable fixer given its name and catering to a specific error name if it exists,...
UsdValidationErrorSite is important information available from a ValidationError, which annotates the...
bool operator!=(const UsdValidationErrorSite &other) const
Returns false if other UsdValidationErrorSite has same valued members as this UsdValidationErrorSite,...
USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixers() const
Return a vector of fixers associated with this Validator.
bool IsValid() const
Return true if this is a valid object, false otherwise.
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
const UsdValidationValidator * GetValidator() const
Returns the UsdValidationValidator that reported this error.
USDVALIDATION_API std::string GetErrorAsString() const
Returns UsdValidationErrorType and ErrorMessage concatenated as a string.
UsdValidationErrorSites GetSites() &&
Returns the UsdValidationErrorSite associated with this UsdValidationError by-value.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixersByErrorName() const
Return a vector of immutable fixers catering to a specific errorName.