diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-13 05:02:14 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-13 05:02:14 -0400 |
commit | ea1642b3f969463a49e5a671478c92e4ef129665 (patch) | |
tree | 9eba47b8708123b4e3f539dd9d747f1f85d9d2fe /src/expr.h | |
parent | ad3b30a9641b8e09c38ea76e7011b614152d8faf (diff) | |
download | fork-ledger-ea1642b3f969463a49e5a671478c92e4ef129665.tar.gz fork-ledger-ea1642b3f969463a49e5a671478c92e4ef129665.tar.bz2 fork-ledger-ea1642b3f969463a49e5a671478c92e4ef129665.zip |
Completely reworked argument passing in expressions
Diffstat (limited to 'src/expr.h')
-rw-r--r-- | src/expr.h | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -58,7 +58,6 @@ public: class op_t; typedef intrusive_ptr<op_t> ptr_op_t; typedef intrusive_ptr<const op_t> const_ptr_op_t; - protected: ptr_op_t ptr; @@ -142,6 +141,25 @@ private: #endif // HAVE_BOOST_SERIALIZATION }; +/** + * Dealing with expr pointers tucked into value objects. + */ +inline bool is_expr(const value_t& val) { + return val.is_any() && val.as_any().type() == typeid(expr_t::ptr_op_t); +} +inline expr_t::ptr_op_t as_expr(const value_t& val) { + VERIFY(val.is_any()); + return val.as_any<expr_t::ptr_op_t>(); +} +inline void set_expr(value_t& val, expr_t::ptr_op_t op) { + val.set_any(op); +} +inline value_t expr_value(expr_t::ptr_op_t op) { + value_t temp; + temp.set_any(op); + return temp; +} + } // namespace ledger #endif // _EXPR_H |