From 944e580825f0d9ce060b6dcdffe8990b6c2cca20 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 1 Mar 2012 03:31:28 -0600 Subject: Refactored the notion of "the current parsing context" --- src/convert.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/convert.cc') 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(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(); -- cgit v1.2.3