summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-08 18:30:35 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-08 18:30:35 -0500
commit523d4243e8c347cb7cbd1f68b03a5098ceb73b70 (patch)
tree28dbee12b03b7265d564e571ae2de28de0e6c6b3 /src
parent394c7bd8dfbe12e09b7fdee8d5c4072f4336d545 (diff)
downloadfork-ledger-523d4243e8c347cb7cbd1f68b03a5098ceb73b70.tar.gz
fork-ledger-523d4243e8c347cb7cbd1f68b03a5098ceb73b70.tar.bz2
fork-ledger-523d4243e8c347cb7cbd1f68b03a5098ceb73b70.zip
Made --european more pervasive in its effect
Diffstat (limited to 'src')
-rw-r--r--src/amount.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/amount.cc b/src/amount.cc
index e9b971f8..8c78a86c 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -669,7 +669,8 @@ namespace {
for (const char * p = buf; *p; p++) {
if (*p == '.') {
- if (comm && comm->has_flags(COMMODITY_STYLE_EUROPEAN))
+ if (commodity_t::european_by_default ||
+ (comm && comm->has_flags(COMMODITY_STYLE_EUROPEAN)))
out << ',';
else
out << *p;
@@ -682,7 +683,8 @@ namespace {
out << *p;
if (integer_digits > 3 && --integer_digits % 3 == 0) {
- if (comm && comm->has_flags(COMMODITY_STYLE_EUROPEAN))
+ if (commodity_t::european_by_default ||
+ (comm && comm->has_flags(COMMODITY_STYLE_EUROPEAN)))
out << '.';
else
out << ',';
@@ -977,12 +979,14 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags)
}
}
else if (last_comma != string::npos &&
- commodity().has_flags(COMMODITY_STYLE_EUROPEAN)) {
+ (commodity_t::european_by_default ||
+ commodity().has_flags(COMMODITY_STYLE_EUROPEAN))) {
comm_flags |= COMMODITY_STYLE_EUROPEAN;
quantity->prec = static_cast<precision_t>(quant.length() - last_comma - 1);
}
else if (last_period != string::npos &&
- ! (commodity().has_flags(COMMODITY_STYLE_EUROPEAN))) {
+ ! (commodity_t::european_by_default ||
+ commodity().has_flags(COMMODITY_STYLE_EUROPEAN))) {
quantity->prec = static_cast<precision_t>(quant.length() - last_period - 1);
}
else {