[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0d7d4d5 4/8: Simplify some special-case logic
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0d7d4d5 4/8: Simplify some special-case logic to make it easier to relocate |
Date: |
Wed, 12 Sep 2018 12:08:05 -0400 (EDT) |
branch: master
commit 0d7d4d5bf7ba87daf047d220ad58147efdb5e44c
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Simplify some special-case logic to make it easier to relocate
---
ledger_pdf_generator_wx.cpp | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index a5ba038..4beb5d5 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1420,10 +1420,17 @@ class numeric_summary_table_cell
auto const& invar = ledger.GetLedgerInvariant();
int const year_max =
pdf_context_for_html_output.ledger().GetMaxLength();
- int const age_last = 70;
+
+ int const summary_age = 70;
+ // Other rows are for given durations, but the
+ // last row is for a given age (typically 70).
+ std::ostringstream oss;
+ oss << "Age " << summary_age;
+ std::string const summary_age_string = oss.str();
+
std::array<int, 4> const summary_years =
// "- 1": 70 (e.g.) is end-of-year age.
- {{4, 9, 19, age_last - bourn_cast<int>(invar.Age) - 1}
+ {{4, 9, 19, summary_age - bourn_cast<int>(invar.Age) - 1}
};
for(auto const& year : summary_years)
{
@@ -1472,11 +1479,7 @@ class numeric_summary_table_cell
std::string output_value;
if(is_last_row && column_policy_year == j)
{
- // Other rows are for given durations, but the
- // last row is for a given age (typically 70).
- std::ostringstream oss;
- oss << "Age " << age_last;
- output_value = oss.str();
+ output_value = summary_age_string;
}
else if(columns[j].variable_name.empty())
{
- [lmi-commits] [lmi] master updated (d8aa128 -> 7bf948b), Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master 039924c 6/8: Refactor to prepare for a larger refactoring, Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master ff118b3 5/8: Assert that a refactoring will be safe, Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master 7bf948b 8/8: Refactor for clarity, Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master 0d7d4d5 4/8: Simplify some special-case logic to make it easier to relocate,
Greg Chicares <=
- [lmi-commits] [lmi] master 99930af 1/8: Declare a variable only in the scope where it's used, Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master 039c1fd 2/8: Declare a variable only in the scope where it's used, Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master a049a0d 3/8: Forestall latent off-by-one errors, Greg Chicares, 2018/09/12
- [lmi-commits] [lmi] master 1445c8d 7/8: Merge two identical blocks into a single function, Greg Chicares, 2018/09/12