summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-02-15 10:28:28 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:01 -0400
commit6b50c85f0133f89c581a4c3041f9653a71ebace5 (patch)
treea225060db7708fc60af96c526601af1f2f1ce70b
parent7dea4f2c80d910c29683b4699d2e02ea7d0629b9 (diff)
downloadfork-ledger-6b50c85f0133f89c581a4c3041f9653a71ebace5.tar.gz
fork-ledger-6b50c85f0133f89c581a4c3041f9653a71ebace5.tar.bz2
fork-ledger-6b50c85f0133f89c581a4c3041f9653a71ebace5.zip
Expose FormatEmacsTransactions to Python.
-rw-r--r--emacs.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/emacs.cc b/emacs.cc
index 8a4d7f84..27b44de6 100644
--- a/emacs.cc
+++ b/emacs.cc
@@ -57,3 +57,26 @@ void format_emacs_transactions::operator()(transaction_t& xact)
}
} // namespace ledger
+
+#ifdef USE_BOOST_PYTHON
+
+#include <boost/python.hpp>
+
+using namespace boost::python;
+using namespace ledger;
+
+void export_emacs()
+{
+ typedef
+ pystream_handler_wrap<format_emacs_transactions, transaction_t>
+ format_emacs_transactions_wrap;
+
+ class_< format_emacs_transactions_wrap, bases<item_handler<transaction_t> > >
+ ("FormatEmacsTransactions",
+ init<PyObject *>()[with_custodian_and_ward<1, 2>()])
+ .def("flush", &format_emacs_transactions_wrap::flush)
+ .def("__call__", &format_emacs_transactions_wrap::operator())
+ ;
+}
+
+#endif // USE_BOOST_PYTHON