diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-14 11:09:54 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:50 -0400 |
commit | f83705b847c59a8197f5098cb7dc2d484704e24d (patch) | |
tree | 1b314d07bb9f50a75781d703ec6c778056e74684 /src/pyinterp.h | |
parent | 65af1688382331d91153fb2366026e94feb5afe2 (diff) | |
download | ledger-f83705b847c59a8197f5098cb7dc2d484704e24d.tar.gz ledger-f83705b847c59a8197f5098cb7dc2d484704e24d.tar.bz2 ledger-f83705b847c59a8197f5098cb7dc2d484704e24d.zip |
Changed xpath to use intrusive_ptr; got the xml command working
Diffstat (limited to 'src/pyinterp.h')
-rw-r--r-- | src/pyinterp.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/pyinterp.h b/src/pyinterp.h index 1cfbd8d9..aee002f9 100644 --- a/src/pyinterp.h +++ b/src/pyinterp.h @@ -70,26 +70,24 @@ class python_interpreter_t : public xml::xpath_t::scope_t return eval(str, mode); } - class functor_t : public xml::xpath_t::functor_t { + class functor_t { protected: boost::python::object func; public: - functor_t(const string& name, boost::python::object _func) - : xml::xpath_t::functor_t(name), func(_func) {} - + functor_t(const string& name, boost::python::object _func) : func(_func) {} virtual void operator()(value_t& result, xml::xpath_t::scope_t * locals); }; - virtual void define(const string& name, xml::xpath_t::op_t * def) { + virtual void define(const string& name, xml::xpath_t::ptr_op_t def) { // Pass any definitions up to our parent parent->define(name, def); } - virtual xml::xpath_t::op_t * lookup(const string& name) { - boost::python::object func = eval(name); - if (! func) + virtual xml::xpath_t::ptr_op_t lookup(const string& name) { + if (boost::python::object func = eval(name)) + return xml::xpath_t::wrap_functor(functor_t(name, func)); + else return parent ? parent->lookup(name) : NULL; - return xml::xpath_t::wrap_functor(new functor_t(name, func)); } class lambda_t : public functor_t { |