summaryrefslogtreecommitdiff
path: root/src/py_account.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/py_account.cc')
-rw-r--r--src/py_account.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/py_account.cc b/src/py_account.cc
index 7fa30d0a..8310f5ec 100644
--- a/src/py_account.cc
+++ b/src/py_account.cc
@@ -142,9 +142,10 @@ void export_account()
class_< account_t::xdata_t > ("AccountXData")
#if 1
- .def("flags", &supports_flags<uint_least16_t>::flags)
+ .add_property("flags",
+ &supports_flags<uint_least16_t>::flags,
+ &supports_flags<uint_least16_t>::set_flags)
.def("has_flags", &supports_flags<uint_least16_t>::has_flags)
- .def("set_flags", &supports_flags<uint_least16_t>::set_flags)
.def("clear_flags", &supports_flags<uint_least16_t>::clear_flags)
.def("add_flags", &supports_flags<uint_least16_t>::add_flags)
.def("drop_flags", &supports_flags<uint_least16_t>::drop_flags)
@@ -162,9 +163,10 @@ void export_account()
class_< account_t > ("Account")
#if 1
- .def("flags", &supports_flags<>::flags)
+ .add_property("flags",
+ &supports_flags<>::flags,
+ &supports_flags<>::set_flags)
.def("has_flags", &supports_flags<>::has_flags)
- .def("set_flags", &supports_flags<>::set_flags)
.def("clear_flags", &supports_flags<>::clear_flags)
.def("add_flags", &supports_flags<>::add_flags)
.def("drop_flags", &supports_flags<>::drop_flags)
@@ -172,13 +174,11 @@ void export_account()
.add_property("parent",
make_getter(&account_t::parent,
- return_value_policy<reference_existing_object>()))
+ return_internal_reference<>()))
.def_readwrite("name", &account_t::name)
.def_readwrite("note", &account_t::note)
.def_readonly("depth", &account_t::depth)
- .def_readonly("accounts", &account_t::accounts)
- .def_readonly("posts", &account_t::posts)
.def(self_ns::str(self))
@@ -199,7 +199,14 @@ void export_account()
.def("valid", &account_t::valid)
.def("__len__", accounts_len)
- .def("__getitem__", accounts_getitem, return_internal_reference<1>())
+ .def("__getitem__", accounts_getitem, return_internal_reference<>())
+
+ .def("__iter__", range<return_internal_reference<> >
+ (&account_t::accounts_begin, &account_t::accounts_end))
+ .def("accounts", range<return_internal_reference<> >
+ (&account_t::accounts_begin, &account_t::accounts_end))
+ .def("posts", range<return_internal_reference<> >
+ (&account_t::posts_begin, &account_t::posts_end))
.def("has_xdata", &account_t::has_xdata)
.def("clear_xdata", &account_t::clear_xdata)