diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-20 02:14:53 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:28 -0400 |
commit | b84f676946941df6f7e8476d77d1db0cbe7736c5 (patch) | |
tree | 9ee7c7a2d3b7496b38ad127519210adfeced2241 /py_eval.h | |
parent | 539370ff1b37772e9f11439f652ffd3583beeedb (diff) | |
download | fork-ledger-b84f676946941df6f7e8476d77d1db0cbe7736c5.tar.gz fork-ledger-b84f676946941df6f7e8476d77d1db0cbe7736c5.tar.bz2 fork-ledger-b84f676946941df6f7e8476d77d1db0cbe7736c5.zip |
Did some optimization and memory cleanup
Diffstat (limited to 'py_eval.h')
-rw-r--r-- | py_eval.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -29,7 +29,7 @@ class python_interpreter_t : public xml::xpath_t::scope_t Py_Finalize(); } - object import(const std::string& name); + object import(const string& name); enum py_eval_mode_t { PY_EVAL_EXPR, @@ -38,9 +38,9 @@ class python_interpreter_t : public xml::xpath_t::scope_t }; object eval(std::istream& in, py_eval_mode_t mode = PY_EVAL_EXPR); - object eval(const std::string& str, py_eval_mode_t mode = PY_EVAL_EXPR); + object eval(const string& str, py_eval_mode_t mode = PY_EVAL_EXPR); object eval(const char * c_str, py_eval_mode_t mode = PY_EVAL_EXPR) { - std::string str(c_str); + string str(c_str); return eval(str, mode); } @@ -48,18 +48,18 @@ class python_interpreter_t : public xml::xpath_t::scope_t protected: object func; public: - functor_t(const std::string& name, object _func) + functor_t(const string& name, object _func) : xml::xpath_t::functor_t(name), func(_func) {} virtual void operator()(value_t& result, xml::xpath_t::scope_t * locals); }; - virtual void define(const std::string& name, xml::xpath_t::op_t * def) { + virtual void define(const string& name, xml::xpath_t::op_t * def) { // Pass any definitions up to our parent parent->define(name, def); } - virtual xml::xpath_t::op_t * lookup(const std::string& name) { + virtual xml::xpath_t::op_t * lookup(const string& name) { object func = eval(name); if (! func) return parent ? parent->lookup(name) : NULL; |