24 #ifndef PXR_USD_SDF_ALLOWED_H
25 #define PXR_USD_SDF_ALLOWED_H
35 #include <hboost/operators.hpp>
36 #include <hboost/optional.hpp>
47 class SdfAllowed :
private hboost::equality_comparable<SdfAllowed> {
49 typedef hboost::optional<std::string> _State;
52 typedef std::pair<bool, std::string>
Pair;
64 _state(!condition, std::
string(whyNot)) { }
67 _state(!condition, whyNot) { }
79 return _state ? NULL : &SdfAllowed::_state;
85 return static_cast<bool>(_state);
103 if (whyNot && _state) {
113 return _state == other._state;
122 #endif // PXR_USD_SDF_ALLOWED_H
SdfAllowed(bool condition, const char *whyNot)
Construct in condition with annotation whyNot if false.
bool operator!() const
Returns false in a boolean context if allowed, true otherwise.
bool IsAllowed(std::string *whyNot) const
bool operator==(const SdfAllowed &other) const
std::pair< bool, std::string > Pair
SdfAllowed(bool condition, const std::string &whyNot)
Construct in condition with annotation whyNot if false.
SDF_API const std::string & GetWhyNot() const
SdfAllowed(const std::string &whyNot)
Construct false with annotation whyNot.
GLsizei const GLchar *const * string
SdfAllowed(bool x)
Construct true.
SdfAllowed(const char *whyNot)
Construct false with annotation whyNot.
SdfAllowed()
Construct true.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
SdfAllowed(const Pair &x)
Construct from bool,string pair x.
_State SdfAllowed::* UnspecifiedBoolType