summaryrefslogtreecommitdiff
path: root/src/py_item.cc
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2015-06-09 00:00:04 +0200
committerJohann Klähn <kljohann@gmail.com>2015-06-09 17:51:23 +0200
commit45e74103607a77c5945615692c3a35f9ce6aadde (patch)
tree748c6d28cdb13770e0c3b0dc6f809c8bc8b17f27 /src/py_item.cc
parent46b0cad75ad7038177183b9bb6acfd7d198ad0f0 (diff)
downloadfork-ledger-45e74103607a77c5945615692c3a35f9ce6aadde.tar.gz
fork-ledger-45e74103607a77c5945615692c3a35f9ce6aadde.tar.bz2
fork-ledger-45e74103607a77c5945615692c3a35f9ce6aadde.zip
enable access to item's position in python bindings
Diffstat (limited to 'src/py_item.cc')
-rw-r--r--src/py_item.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/py_item.cc b/src/py_item.cc
index 473bbef8..4dd104c9 100644
--- a/src/py_item.cc
+++ b/src/py_item.cc
@@ -32,6 +32,7 @@
#include <system.hh>
#include "pyinterp.h"
+#include "pyutils.h"
#include "scope.h"
#include "mask.h"
#include "item.h"
@@ -64,6 +65,13 @@ namespace {
return item.get_tag(tag_mask, value_mask);
}
+ std::string py_position_pathname(position_t const& pos) {
+ return pos.pathname.native();
+ }
+ void py_position_set_pathname(position_t& pos, string const& s) {
+ pos.pathname = s;
+ }
+
} // unnamed namespace
#if 0
@@ -79,8 +87,8 @@ void export_item()
{
class_< position_t > ("Position")
.add_property("pathname",
- make_getter(&position_t::pathname),
- make_setter(&position_t::pathname))
+ make_function(py_position_pathname),
+ make_function(py_position_set_pathname))
.add_property("beg_pos",
make_getter(&position_t::beg_pos),
make_setter(&position_t::beg_pos))
@@ -169,6 +177,8 @@ void export_item()
.def("valid", &item_t::valid)
;
+
+ register_optional_to_python<position_t>();
}
} // namespace ledger