summaryrefslogtreecommitdiff
path: root/python/py_parser.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-06 14:31:38 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-06 14:31:38 -0400
commit68d5bc1f32af2109a830d93a03ded305ed7061c2 (patch)
tree53835fdec1a67022c2e82488cb687283369c4c6e /python/py_parser.cc
parentff2f3d23d4edf588dd153cc71a613e596594757e (diff)
downloadfork-ledger-68d5bc1f32af2109a830d93a03ded305ed7061c2.tar.gz
fork-ledger-68d5bc1f32af2109a830d93a03ded305ed7061c2.tar.bz2
fork-ledger-68d5bc1f32af2109a830d93a03ded305ed7061c2.zip
Added #if 0'd Python stub code from 2.x days. It needs to be ported.
Diffstat (limited to 'python/py_parser.cc')
-rw-r--r--python/py_parser.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/python/py_parser.cc b/python/py_parser.cc
index 813b3f3c..fc881a0f 100644
--- a/python/py_parser.cc
+++ b/python/py_parser.cc
@@ -66,3 +66,48 @@ void export_parser()
}
} // namespace ledger
+
+#if 0
+#include "parser.h"
+
+using namespace boost::python;
+using namespace ledger;
+
+struct py_parser_t : public parser_t
+{
+ PyObject * self;
+ py_parser_t(PyObject * self_) : self(self_) {}
+
+ virtual bool test(std::istream& in) const {
+ return call_method<bool>(self, "test", in);
+ }
+
+ virtual repitem_t * parse(std::istream& in,
+ journal_t * journal,
+ account_t * master = NULL,
+ const string * original_file = NULL) {
+ return call_method<unsigned int>(self, "parse", in, journal, master,
+ original_file);
+ }
+};
+
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(parser_parse_overloads,
+ py_parser_t::parse, 2, 4)
+
+BOOST_PYTHON_FUNCTION_OVERLOADS(parse_journal_overloads, parse_journal, 2, 4)
+BOOST_PYTHON_FUNCTION_OVERLOADS(parse_journal_file_overloads,
+ parse_journal_file, 2, 4)
+
+void export_parser() {
+ class_< parser_t, py_parser_t, boost::noncopyable > ("Parser")
+ .def("test", &py_parser_t::test)
+ .def("parse", &py_parser_t::parse, parser_parse_overloads())
+ ;
+
+ def("register_parser", register_parser);
+ def("unregister_parser", unregister_parser);
+
+ def("parse_journal", parse_journal, parse_journal_overloads());
+ def("parse_journal_file", parse_journal_file, parse_journal_file_overloads());
+}
+#endif