summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/amount.cc b/amount.cc
index 4489db5f..37c5b887 100644
--- a/amount.cc
+++ b/amount.cc
@@ -1107,6 +1107,17 @@ bool amount_t::valid() const
}
+void commodity_t::set_symbol(const std::string& sym)
+{
+ *(const_cast<std::string *>(&symbol)) = sym;
+ quote = false;
+ for (const char * p = symbol.c_str(); *p; p++)
+ if (std::isspace(*p) || std::isdigit(*p) || *p == '-' || *p == '.') {
+ quote = true;
+ return;
+ }
+}
+
void commodity_t::add_price(const std::time_t date, const amount_t& price)
{
if (! history)