From cec0f5ec4932e31aa9a0a09af63b9f4f0bca1d85 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 2 Nov 2009 16:58:10 -0500 Subject: Moved make_qualified_name into commodity_pool_t --- src/pool.cc | 28 +++++++++++++--------------- src/pool.h | 3 +++ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/pool.cc b/src/pool.cc index 68ba3ed7..06a4706c 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -108,25 +108,23 @@ commodity_pool_t::create(const string& symbol, const annotation_t& details) return new_comm; } -namespace { - string make_qualified_name(const commodity_t& comm, - const annotation_t& details) - { - assert(details); +string commodity_pool_t::make_qualified_name(const commodity_t& comm, + const annotation_t& details) +{ + assert(details); - if (details.price && details.price->sign() < 0) - throw_(amount_error, _("A commodity's price may not be negative")); + if (details.price && details.price->sign() < 0) + throw_(amount_error, _("A commodity's price may not be negative")); - std::ostringstream name; - comm.print(name); - details.print(name, comm.parent().keep_base); + std::ostringstream name; + comm.print(name); + details.print(name, comm.parent().keep_base); - DEBUG("amounts.commodities", "make_qualified_name for " - << *comm.qualified_symbol << std::endl << details); - DEBUG("amounts.commodities", "qualified_name is " << name.str()); + DEBUG("amounts.commodities", "make_qualified_name for " + << *comm.qualified_symbol << std::endl << details); + DEBUG("amounts.commodities", "qualified_name is " << name.str()); - return name.str(); - } + return name.str(); } commodity_t * diff --git a/src/pool.h b/src/pool.h index 6fce0c59..7e54e595 100644 --- a/src/pool.h +++ b/src/pool.h @@ -98,6 +98,9 @@ public: checked_delete(pair.second); } + string make_qualified_name(const commodity_t& comm, + const annotation_t& details); + commodity_t * create(const string& symbol); commodity_t * find(const string& name); commodity_t * find_or_create(const string& symbol); -- cgit v1.2.3