summaryrefslogtreecommitdiff
path: root/src/py_commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-05 17:50:17 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-05 17:50:17 -0600
commit97dbf379d5e44c80c748483a688502b1cec8f075 (patch)
tree262c54e08cd86cbcdcf9f87de261fc1c56305980 /src/py_commodity.cc
parentff9cf572fe5054f2e5c5d7ab4e68d63011e4a38a (diff)
downloadfork-ledger-97dbf379d5e44c80c748483a688502b1cec8f075.tar.gz
fork-ledger-97dbf379d5e44c80c748483a688502b1cec8f075.tar.bz2
fork-ledger-97dbf379d5e44c80c748483a688502b1cec8f075.zip
Rewrote the way annotated commodities are managed
The new scheme should be much more efficient, and allows for future growth of what annotations may appear on a commodity.
Diffstat (limited to 'src/py_commodity.cc')
-rw-r--r--src/py_commodity.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/py_commodity.cc b/src/py_commodity.cc
index b5230850..25e5b918 100644
--- a/src/py_commodity.cc
+++ b/src/py_commodity.cc
@@ -115,7 +115,7 @@ namespace {
(string("Could not find commodity ") + symbol).c_str());
throw_error_already_set();
}
- return (*i).second;
+ return (*i).second.get();
}
python::list py_pool_keys(commodity_pool_t& pool) {
@@ -168,13 +168,15 @@ namespace {
py_pool_commodities_values_begin(commodity_pool_t& pool) {
return make_transform_iterator
(pool.commodities.begin(),
- bind(&commodity_pool_t::commodities_map::value_type::second, _1));
+ bind(&shared_ptr<commodity_t>::get,
+ bind(&commodity_pool_t::commodities_map::value_type::second, _1)));
}
commodities_map_seconds_iterator
py_pool_commodities_values_end(commodity_pool_t& pool) {
return make_transform_iterator
(pool.commodities.end(),
- bind(&commodity_pool_t::commodities_map::value_type::second, _1));
+ bind(&shared_ptr<commodity_t>::get,
+ bind(&commodity_pool_t::commodities_map::value_type::second, _1)));
}
void py_add_price_2(commodity_t& commodity,
@@ -267,8 +269,6 @@ void export_commodity()
make_getter(&commodity_pool_t::get_commodity_quote),
make_setter(&commodity_pool_t::get_commodity_quote))
- .def("make_qualified_name", &commodity_pool_t::make_qualified_name)
-
.def("create", py_create_1, return_internal_reference<>())
.def("create", py_create_2, return_internal_reference<>())
@@ -359,7 +359,6 @@ void export_commodity()
.add_property("base_symbol", &commodity_t::base_symbol)
.add_property("symbol", &commodity_t::symbol)
- .add_property("mapping_key", &commodity_t::mapping_key)
.add_property("name", &commodity_t::name, &commodity_t::set_name)
.add_property("note", &commodity_t::note, &commodity_t::set_note)