24 #ifndef PXR_BASE_TF_PY_ANNOTATED_BOOL_RESULT_H
25 #define PXR_BASE_TF_PY_ANNOTATED_BOOL_RESULT_H
32 #include <hboost/operators.hpp>
33 #include <hboost/python/class.hpp>
34 #include <hboost/python/operators.hpp>
35 #include <hboost/python/return_by_value.hpp>
41 template <
class Annotation>
43 hboost::equality_comparable<TfPyAnnotatedBoolResult<Annotation>, bool>
48 _val(val), _annotation(annotation) {}
68 template <
class Derived>
69 static hboost::python::class_<Derived>
70 Wrap(
char const *
name,
char const *annotationName) {
72 using namespace hboost::python;
74 return class_<Derived>(
name, init<bool, Annotation>())
75 .def(
"__bool__", &Derived::GetValue)
76 .def(
"__repr__", &Derived::GetRepr)
96 .add_property(annotationName, &This::_GetAnnotation<Derived>)
97 .def(
"__getitem__", &This::_GetItem<Derived>)
105 template <
class Derived>
106 static Annotation _GetAnnotation(
const Derived&
x)
108 return x.GetAnnotation();
111 template <
class Derived>
121 PyErr_SetString(PyExc_IndexError,
"Index must be 0 or 1.");
122 hboost::python::throw_error_already_set();
129 Annotation _annotation;
134 template <
class Annotation>
141 template <
class Annotation>
149 #endif // PXR_BASE_TF_PY_ANNOTATED_BOOL_RESULT_H
Annotation const & GetAnnotation() const
GLsizei const GLchar *const * string
TfPyAnnotatedBoolResult()
std::string TfPyRepr(T const &t)
TfPyAnnotatedBoolResult(bool val, Annotation const &annotation)
bool operator!=(bool lhs, TfPyAnnotatedBoolResult< Annotation > &rhs)
Returns false if the result of lhs is the same as rhs.
GLuint const GLchar * name
static hboost::python::class_< Derived > Wrap(char const *name, char const *annotationName)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Annotation AnnotationType
#define PXR_NAMESPACE_CLOSE_SCOPE
bool operator==(bool rhs) const
Returns true if the result is the same as rhs.
std::string GetRepr() const