summaryrefslogtreecommitdiff
path: root/src/xmlparse.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-01 04:36:49 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:35 -0400
commite92bcf411d2e9a55969303ba3893a017152d7c18 (patch)
treee7b52d09751de39c86ede91f88a2fcf24facfb27 /src/xmlparse.cc
parent50a9caf302936ba6f61bbe05b4718f199d0d584c (diff)
downloadfork-ledger-e92bcf411d2e9a55969303ba3893a017152d7c18.tar.gz
fork-ledger-e92bcf411d2e9a55969303ba3893a017152d7c18.tar.bz2
fork-ledger-e92bcf411d2e9a55969303ba3893a017152d7c18.zip
Started using boost::optional<T>.
Diffstat (limited to 'src/xmlparse.cc')
-rw-r--r--src/xmlparse.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/xmlparse.cc b/src/xmlparse.cc
index 1b9e9a45..51da13f4 100644
--- a/src/xmlparse.cc
+++ b/src/xmlparse.cc
@@ -63,7 +63,7 @@ static void endElement(void *userData, const char *name)
if (curr_journal->add_entry(curr_entry)) {
count++;
} else {
- delete curr_entry;
+ checked_delete(curr_entry);
have_error = "Entry cannot be balanced";
}
}
@@ -133,7 +133,10 @@ static void endElement(void *userData, const char *name)
}
#endif
else if (std::strcmp(name, "quantity") == 0) {
- curr_entry->transactions.back()->amount.parse(data);
+ amount_t temp;
+ temp.parse(data);
+ curr_entry->transactions.back()->amount = temp;
+
if (curr_comm) {
string::size_type i = data.find('.');
if (i != string::npos) {
@@ -141,7 +144,7 @@ static void endElement(void *userData, const char *name)
if (precision > curr_comm->precision())
curr_comm->set_precision(precision);
}
- curr_entry->transactions.back()->amount.set_commodity(*curr_comm);
+ curr_entry->transactions.back()->amount->set_commodity(*curr_comm);
curr_comm = NULL;
}
}
@@ -179,10 +182,10 @@ bool xml_parser_t::test(std::istream& in) const
return true;
}
-unsigned int xml_parser_t::parse(std::istream& in,
- journal_t * journal,
- account_t * master,
- const string * original_file)
+unsigned int xml_parser_t::parse(std::istream& in,
+ journal_t * journal,
+ account_t * master,
+ const optional<path>& original)
{
char buf[BUFSIZ];