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"
19PXR_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;
201using UsdValidationErrorSites = std::vector<UsdValidationErrorSite>;
248 const UsdValidationErrorSites &errorSites,
249 const std::string &errorMsg,
254 return (_name == other._name) && (_errorType == other._errorType)
255 && (_errorSites == other._errorSites)
256 && (_errorMsg == other._errorMsg)
257 && (_validator == other._validator);
262 return !(*
this == other);
274 return std::move(_name);
295 return std::move(_errorSites);
350 return _errorType == UsdValidationErrorType::None;
356 const std::vector<const UsdValidationFixer *>
GetFixers()
const;
368 const std::vector<const UsdValidationFixer *>
407 UsdValidationErrorSites _errorSites;
408 std::string _errorMsg;
413PXR_NAMESPACE_CLOSE_SCOPE
A path value used to locate objects in layers or scenegraphs.
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
Token for efficient comparison, assignment, and hashing of known strings.
bool IsValid() const
Return true if this is a valid object, false otherwise.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
UsdValidationError is an entity returned by a validation task, which is associated with a UsdValidati...
USDVALIDATION_API UsdValidationError(const TfToken &name, const UsdValidationErrorType &errorType, const UsdValidationErrorSites &errorSites, const std::string &errorMsg, const VtValue &metadata=VtValue())
Instantiate a ValidationError by providing its name, errorType, errorSites and an errorMsg.
USDVALIDATION_API UsdValidationError()
A default constructed UsdValidationError signifies no error.
TfToken GetName() &&
Returns the name token of the UsdValidationError by-value.
USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixersByErrorName() const
Return a vector of immutable fixers catering to a specific errorName.
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 * > GetFixers() const
Return a vector of fixers associated with this Validator.
const UsdValidationErrorSites & GetSites() const &
Returns the UsdValidationErrorSite associated with this UsdValidationError.
UsdValidationErrorType GetType() const
Returns the UsdValidationErrorType associated with this UsdValidationError.
const TfToken & GetName() const &
Returns the name token of the UsdValidationError.
const std::string & GetMessage() const
Returns the message associated with this UsdValidationError.
bool HasNoError() const
Returns true if UsdValidationErrorType is UsdValidationErrorType::None, false otherwise.
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.
UsdValidationErrorSites GetSites() &&
Returns the UsdValidationErrorSite associated with this UsdValidationError by-value.
const UsdValidationValidator * GetValidator() const
Returns the UsdValidationValidator that reported this error.
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,...
USDVALIDATION_API TfToken GetIdentifier() const
An identifier for the error constructed from the validator name this error was generated from and its...
const VtValue & GetMetadata() const
Returns the metadata associated with this UsdValidationError.
USDVALIDATION_API std::string GetErrorAsString() const
Returns UsdValidationErrorType and ErrorMessage concatenated as a string.
UsdValidationErrorType reflects severity of a validation error, which can then be reported appropriat...
A UsdValidationFixer represents a fix that can be applied to fix a specific validation error.
UsdValidationValidator is a class describing a single test.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
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,...
bool IsProperty() const
Returns true if UsdValidationErrorSite represents a property on a stage, false otherwise.
USDVALIDATION_API UsdValidationErrorSite(const UsdStagePtr &usdStage, const SdfPath &objectPath, const SdfLayerHandle &layer=SdfLayerHandle())
Initialize an UsdValidationErrorSite using a usdStage and an objectPath.
bool IsValidSpecInLayer() const
Returns true if the objectPath and layer represent a spec in the layer; false otherwise.
UsdProperty GetProperty() const
Returns UsdProperty associated with this UsdValidationErrorSite, that is when UsdStage is present and...
bool IsPrim() const
Returns true if UsdValidationErrorSite represents a prim on a stage, false otherwise.
USDVALIDATION_API UsdValidationErrorSite(const SdfLayerHandle &layer, const SdfPath &objectPath)
Initialize an UsdValidationErrorSite using a layer and an objectPath.
UsdPrim GetPrim() const
Returns UsdPrim associated with this UsdValidationErrorSite, that is when UsdStage is present and obj...
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.
const UsdStagePtr & GetStage() const
Returns the UsdStage associated with this UsdValidationErrorSite; nullptr othewrise.
bool IsValid() const
Returns true if UsdValidationErrorSite instance can either point to a prim or property spec in a laye...
const SdfLayerHandle & GetLayer() const
Returns the SdfLayerHandle associated with this UsdValidationValidatorErrorSite.
const SdfPropertySpecHandle GetPropertySpec() const
Returns the SdfPropertySpecHandle associated with this ValidationErrorSite's layer and objectPath.
std::vector< TfToken > TfTokenVector
Convenience types.