Update of /cvsroot/boost/boost/libs/parameter/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20530

Modified Files:
        python.cpp python.py 
Log Message:
Added CallPolicies tests.


Index: python.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/parameter/test/python.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- python.cpp  15 Jun 2006 11:07:30 -0000      1.3
+++ python.cpp  7 Jul 2006 17:40:01 -0000       1.4
@@ -61,6 +61,19 @@
     {
         return std::string(args[x | "foo"]) + args[y | "bar"];
     }
+
+    BOOST_PARAMETER_MEMBER_FUNCTION((X&), h, tag,
+        (optional (x, *, "") (y, *, ""))
+    )
+    {
+        return *this;
+    }
+
+    template <class A0>
+    X& operator()(A0 const& a0)
+    {
+        return *this;
+    }
 };
 
 } // namespace test
@@ -83,6 +96,15 @@
     }
 };
 
+struct h_fwd
+{
+    template <class R, class T, class A0, class A1>
+    R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1)
+    {
+        return self.h(a0,a1);
+    }
+};
+
 BOOST_PYTHON_MODULE(python_parameter)
 {
     namespace mpl = boost::mpl;
@@ -115,6 +137,23 @@
                 >
             >()
         )
+        .def(
+            "h"
+          , boost::parameter::python::function<
+                h_fwd
+              , mpl::vector<
+                    X&, tag::x*(std::string), tag::y*(std::string)
+                >
+            >()
+          , return_arg<>()
+        )
+        .def(
+            boost::parameter::python::call<
+                mpl::vector<
+                    X&, tag::x(int)
+                >
+            >() [ return_arg<>() ]
+        )
         .def_readonly("value", &X::value);
 }
 

Index: python.py
===================================================================
RCS file: /cvsroot/boost/boost/libs/parameter/test/python.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- python.py   26 May 2006 10:51:58 -0000      1.2
+++ python.py   7 Jul 2006 17:40:01 -0000       1.3
@@ -19,6 +19,10 @@
 'bazbar'
 >>> x.g(y = "foo", x = "bar")
 'barfoo'
+>>> y = x.h(x = "bar", y = "foo")
+>>> assert x == y
+>>> y = x(0)
+>>> assert x == y
 '''
 
 def run(args = None):


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to