summaryrefslogtreecommitdiff
path: root/src/convert.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-01 03:31:28 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-01 03:31:28 -0600
commit944e580825f0d9ce060b6dcdffe8990b6c2cca20 (patch)
treee2651b0df622d9b8d3831f35743e7dbd31c16897 /src/convert.cc
parente2afc783db0dff1927b00dc506390353d9e3bbd2 (diff)
downloadfork-ledger-944e580825f0d9ce060b6dcdffe8990b6c2cca20.tar.gz
fork-ledger-944e580825f0d9ce060b6dcdffe8990b6c2cca20.tar.bz2
fork-ledger-944e580825f0d9ce060b6dcdffe8990b6c2cca20.zip
Refactored the notion of "the current parsing context"
Diffstat (limited to 'src/convert.cc')
-rw-r--r--src/convert.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/convert.cc b/src/convert.cc
index 1b1bf814..e8ca241e 100644
--- a/src/convert.cc
+++ b/src/convert.cc
@@ -63,12 +63,16 @@ value_t convert_command(call_scope_t& args)
print_xacts formatter(report);
path csv_file_path(args.get<string>(0));
- ifstream data(csv_file_path);
- csv_reader reader(data, csv_file_path);
+
+ report.session.parsing_context.push(csv_file_path);
+ parse_context_t& context(report.session.parsing_context.get_current());
+ context.journal = &journal;
+ context.master = bucket;
+
+ csv_reader reader(context);
try {
- while (xact_t * xact = reader.read_xact(journal, bucket,
- report.HANDLED(rich_data))) {
+ while (xact_t * xact = reader.read_xact(report.HANDLED(rich_data))) {
if (report.HANDLED(invert)) {
foreach (post_t * post, xact->posts)
post->amount.in_place_negate();