diff options
author | John Wiegley <johnw@newartisans.com> | 2018-01-01 12:47:42 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2018-01-01 12:48:16 -0800 |
commit | e3bcb8e87e4f89b7fc694c2c444f602aa9ee2bab (patch) | |
tree | 068b4de75d4c632f193de7b2d30012cfbc26f8d3 /src | |
parent | a44947b87026af35a365bd1d100b24a453d351f4 (diff) | |
download | fork-ledger-e3bcb8e87e4f89b7fc694c2c444f602aa9ee2bab.tar.gz fork-ledger-e3bcb8e87e4f89b7fc694c2c444f602aa9ee2bab.tar.bz2 fork-ledger-e3bcb8e87e4f89b7fc694c2c444f602aa9ee2bab.zip |
The "format" directive for commodities now disables "style observation"
Diffstat (limited to 'src')
-rw-r--r-- | src/amount.cc | 4 | ||||
-rw-r--r-- | src/commodity.h | 1 | ||||
-rw-r--r-- | src/textual.cc | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/src/amount.cc b/src/amount.cc index 0244de66..f7b976a0 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -1090,6 +1090,8 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags) bool no_more_commas = false; bool no_more_periods = false; + bool no_migrate_style + = commodity().has_flags(COMMODITY_STYLE_NO_MIGRATE); bool decimal_comma_style = (commodity_t::decimal_comma_by_default || commodity().has_flags(COMMODITY_STYLE_DECIMAL_COMMA)); @@ -1173,7 +1175,7 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags) // is non-NULL. new_quantity->add_flags(BIGINT_KEEP_PREC); } - else if (commodity_) { + else if (commodity_ && ! no_migrate_style) { commodity().add_flags(comm_flags); if (new_quantity->prec > commodity().precision()) diff --git a/src/commodity.h b/src/commodity.h index fd09ea46..8e30d56a 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -95,6 +95,7 @@ protected: #define COMMODITY_SAW_ANN_PRICE_FLOAT 0x400 #define COMMODITY_SAW_ANN_PRICE_FIXATED 0x800 #define COMMODITY_STYLE_TIME_COLON 0x1000 +#define COMMODITY_STYLE_NO_MIGRATE 0x2000 string symbol; optional<std::size_t> graph_index; diff --git a/src/textual.cc b/src/textual.cc index 7ad98809..5abe40b6 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1128,6 +1128,7 @@ void instance_t::commodity_format_directive(commodity_t&, string format) trim(format); amount_t amt; amt.parse(format); + amt.commodity().add_flags(COMMODITY_STYLE_NO_MIGRATE); VERIFY(amt.valid()); } |