(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.
This commit is contained in:
parent
529604b204
commit
f851642347
1 changed files with 12 additions and 0 deletions
12
format.cc
12
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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue