summaryrefslogtreecommitdiff
path: root/src/commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-09 09:55:37 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-09 09:55:37 -0400
commit556211e623cad88213e5087b5c9c36e754d9aa02 (patch)
tree9b4d0197448cd8587e11f5e3e65214e9dc80e3a7 /src/commodity.cc
parent14476a63f4abbdce5311ace031b7345a34af060b (diff)
parentc28fad384c28fb929fc8ea69854496141bdf306a (diff)
downloadfork-ledger-556211e623cad88213e5087b5c9c36e754d9aa02.tar.gz
fork-ledger-556211e623cad88213e5087b5c9c36e754d9aa02.tar.bz2
fork-ledger-556211e623cad88213e5087b5c9c36e754d9aa02.zip
Merge branch 'next'
Diffstat (limited to 'src/commodity.cc')
-rw-r--r--src/commodity.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/commodity.cc b/src/commodity.cc
index 9a757395..44d14c56 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -642,6 +642,17 @@ void commodity_t::parse_symbol(char *& p, string& symbol)
throw_(amount_error, _("Failed to parse commodity"));
}
+void commodity_t::print(std::ostream& out, bool elide_quotes) const
+{
+ string sym = symbol();
+ if (elide_quotes && has_flags(COMMODITY_STYLE_SEPARATED) &&
+ ! sym.empty() && sym[0] == '"' && ! std::strchr(sym.c_str(), ' ')) {
+ DEBUG("foo", "contracting " << sym << " to " << string(sym, 1, sym.length() - 2));
+ out << string(sym, 1, sym.length() - 2);
+ } else
+ out << sym;
+}
+
bool commodity_t::valid() const
{
if (symbol().empty() && this != pool().null_commodity) {