8 #ifndef PXR_USD_USD_ATTRIBUTE_LIMITS_H
9 #define PXR_USD_USD_ATTRIBUTE_LIMITS_H
22 #define USD_LIMITS_KEYS \
25 ((Minimum, "minimum")) \
26 ((Maximum, "maximum"))
220 return _invalidValuesDict;
232 return _conformedSubDict;
244 explicit operator bool()
const {
250 return _success == rhs._success &&
251 _invalidValuesDict == rhs._invalidValuesDict &&
252 _conformedSubDict == rhs._conformedSubDict &&
253 _attrPath == rhs._attrPath &&
254 _attrTypeName == rhs._attrTypeName;
259 return !(*
this == rhs);
263 friend class UsdAttributeLimits;
269 const std::string& attrTypeName)
271 _invalidValuesDict(invalidValuesDict),
272 _conformedSubDict(conformedSubDict),
274 _attrTypeName(attrTypeName) {}
277 bool _success =
false;
281 std::string _attrTypeName;
294 ValidationResult*
result =
nullptr)
const;
316 template <
typename T>
317 std::optional<T>
Get(
const TfToken& key)
const;
322 template <
typename T>
327 template <
typename T>
333 template <
typename T>
339 template <
typename T>
346 template <
typename T>
352 template <
typename T>
358 template <
typename T>
365 template <
typename T>
405 explicit operator bool()
const {
411 return _attr == rhs._attr && _subDictKey == rhs._subDictKey;
416 return !(*
this == rhs);
428 template <
typename T>
429 inline std::optional<T>
438 SdfFieldKeys->Limits,
439 _MakeKeyPath(_subDictKey, key),
446 template <
typename T>
450 const T& defaultValue)
const
458 SdfFieldKeys->Limits,
459 _MakeKeyPath(_subDictKey, key),
466 template <
typename T>
475 template <
typename T>
476 inline std::optional<T>
479 return Get<T>(UsdLimitsKeys->Minimum);
482 template <
typename T>
486 return GetOr<T>(UsdLimitsKeys->Minimum, defaultValue);
489 template <
typename T>
493 return Set(UsdLimitsKeys->Minimum, value);
496 template <
typename T>
497 inline std::optional<T>
500 return Get<T>(UsdLimitsKeys->Maximum);
503 template <
typename T>
507 return GetOr<T>(UsdLimitsKeys->Maximum, defaultValue);
510 template <
typename T>
514 return Set(UsdLimitsKeys->Maximum, value);
bool SetMinimum(const T &value)
std::optional< T > Get(const TfToken &key) const
#define PXR_NAMESPACE_OPEN_SCOPE
GLsizei const GLfloat * value
USD_API UsdAttribute GetAttribute() const
Return the limits object's attribute.
**But if you need a result
bool operator!=(const ValidationResult &rhs) const
Inequality operator.
USD_API bool HasAuthored() const
ValidationResult()=default
Construct an empty result.
bool GetMetadataByDictKey(const TfToken &key, const TfToken &keyPath, T *value) const
USD_API std::string GetErrorString() const
bool operator==(const ValidationResult &rhs) const
Equality operator.
USD_API TfToken GetSubDictKey() const
Return the sub-dictionary key the limits object is using.
USD_API bool HasAuthoredMaximum() const
bool Success() const
Return whether validation was successful.
std::optional< T > GetMaximum() const
bool SetMaximum(const T &value)
USD_API bool HasAuthoredMinimum() const
UsdAttributeLimits()=default
USD_API bool IsValid() const
USD_API bool Set(const VtDictionary &subDict)
T GetMaximumOr(const T &defaultValue) const
USD_API bool ClearMaximum()
bool operator!=(const UsdAttributeLimits &rhs) const
Inequality operator.
USD_API bool Validate(const VtDictionary &subDict, ValidationResult *result=nullptr) const
bool operator==(const UsdAttributeLimits &rhs) const
Equality operator.
#define PXR_NAMESPACE_CLOSE_SCOPE
T GetOr(const TfToken &key, const T &defaultValue) const
const VtDictionary & GetConformedSubDict() const
const VtDictionary & GetInvalidValuesDict() const
std::optional< T > GetMinimum() const
USD_API bool ClearMinimum()
TF_DECLARE_PUBLIC_TOKENS(UsdLimitsKeys, USD_API, USD_LIMITS_KEYS)
T GetMinimumOr(const T &defaultValue) const
bool IsEmpty() const
Returns true iff this token contains the empty string "".