From 3328087de1e0e10cc6c3dfc293e3ffcabb401e51 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 10 May 2002 15:41:44 +0000 Subject: [PATCH] Added missing add_property chaining [SVN r13806] --- include/boost/python/class.hpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 8e921780..ae1705f6 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -172,8 +172,13 @@ class class_ : public objects::class_base return *this; } + // Property creation + self& add_property(char const* name, ref const& fget); + self& add_property(char const* name, ref const& fget, ref const& fset); + + // return the underlying object -// ref object() const; +// ref object() const; (implemented in base class) private: // types typedef objects::class_id class_id; @@ -236,6 +241,21 @@ inline class_::class_(char const* name) , this->object()); } + +template +inline class_& class_::add_property(char const* name, ref const& fget) +{ + class_base::add_property(name, fget); + return *this; +} + +template +inline class_& class_::add_property(char const* name, ref const& fget, ref const& fset) +{ + class_base::add_property(name, fget, fset); + return *this; +} + namespace detail { // This is an mpl BinaryMetaFunction object with a runtime behavior,