Moved make_qualified_name into commodity_pool_t
This commit is contained in:
parent
3f8c126c79
commit
cec0f5ec49
2 changed files with 16 additions and 15 deletions
28
src/pool.cc
28
src/pool.cc
|
|
@ -108,25 +108,23 @@ commodity_pool_t::create(const string& symbol, const annotation_t& details)
|
||||||
return new_comm;
|
return new_comm;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
string commodity_pool_t::make_qualified_name(const commodity_t& comm,
|
||||||
string make_qualified_name(const commodity_t& comm,
|
const annotation_t& details)
|
||||||
const annotation_t& details)
|
{
|
||||||
{
|
assert(details);
|
||||||
assert(details);
|
|
||||||
|
|
||||||
if (details.price && details.price->sign() < 0)
|
if (details.price && details.price->sign() < 0)
|
||||||
throw_(amount_error, _("A commodity's price may not be negative"));
|
throw_(amount_error, _("A commodity's price may not be negative"));
|
||||||
|
|
||||||
std::ostringstream name;
|
std::ostringstream name;
|
||||||
comm.print(name);
|
comm.print(name);
|
||||||
details.print(name, comm.parent().keep_base);
|
details.print(name, comm.parent().keep_base);
|
||||||
|
|
||||||
DEBUG("amounts.commodities", "make_qualified_name for "
|
DEBUG("amounts.commodities", "make_qualified_name for "
|
||||||
<< *comm.qualified_symbol << std::endl << details);
|
<< *comm.qualified_symbol << std::endl << details);
|
||||||
DEBUG("amounts.commodities", "qualified_name is " << name.str());
|
DEBUG("amounts.commodities", "qualified_name is " << name.str());
|
||||||
|
|
||||||
return name.str();
|
return name.str();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commodity_t *
|
commodity_t *
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,9 @@ public:
|
||||||
checked_delete(pair.second);
|
checked_delete(pair.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string make_qualified_name(const commodity_t& comm,
|
||||||
|
const annotation_t& details);
|
||||||
|
|
||||||
commodity_t * create(const string& symbol);
|
commodity_t * create(const string& symbol);
|
||||||
commodity_t * find(const string& name);
|
commodity_t * find(const string& name);
|
||||||
commodity_t * find_or_create(const string& symbol);
|
commodity_t * find_or_create(const string& symbol);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue