summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-06-23 00:08:08 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:12 -0400
commitf85164234727ef62f3d5650f12b3573bccc92c24 (patch)
treef969c58393118c6a50ab690e8044474629672b5b
parent529604b204a75f4aec22a9a57805f741dff7fe06 (diff)
downloadfork-ledger-f85164234727ef62f3d5650f12b3573bccc92c24.tar.gz
fork-ledger-f85164234727ef62f3d5650f12b3573bccc92c24.tar.bz2
fork-ledger-f85164234727ef62f3d5650f12b3573bccc92c24.zip
(parse_elements): The format codes %b and %e can be used to display
the beginning and ending line numbers of an entry. (format): Output beginning and ending line for BEG_LINE and END_LINE types.
-rw-r--r--format.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/format.cc b/format.cc
index bfe20998..e3a24225 100644
--- a/format.cc
+++ b/format.cc
@@ -213,7 +213,9 @@ element_t * format_t::parse_elements(const std::string& fmt)
case 'S': current->type = element_t::SOURCE; break;
case 'B': current->type = element_t::BEG_POS; break;
+ case 'b': current->type = element_t::BEG_LINE; break;
case 'E': current->type = element_t::END_POS; break;
+ case 'e': current->type = element_t::END_LINE; break;
case 'X': current->type = element_t::CLEARED; break;
case 'C': current->type = element_t::CODE; break;
case 'P': current->type = element_t::PAYEE; break;
@@ -379,11 +381,21 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
out << (unsigned long)details.entry->beg_pos;
break;
+ case element_t::BEG_LINE:
+ if (details.entry)
+ out << details.entry->beg_line;
+ break;
+
case element_t::END_POS:
if (details.entry)
out << (unsigned long)details.entry->end_pos;
break;
+ case element_t::END_LINE:
+ if (details.entry)
+ out << details.entry->end_line;
+ break;
+
case element_t::DATE_STRING:
if (details.entry && details.entry->date) {
char buf[256];