[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 8c5be11 128/156: Use proper types for get_two
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 8c5be11 128/156: Use proper types for get_two_column_header() parameters |
Date: |
Tue, 30 Jan 2018 17:22:30 -0500 (EST) |
branch: master
commit 8c5be1166f28373c121eb56070379a52041ffe9e
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Use proper types for get_two_column_header() parameters
Don't just pass two string parameters to this function as it was too
easy to exchange their order accidentally, but use typed parameters
instead.
This makes the code slightly more verbose, but safer.
---
ledger_pdf_generator_wx.cpp | 50 ++++++++++++++++++++++++++++-----------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 6c9e460..a75d59d 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1994,13 +1994,12 @@ class page_with_basic_tabular_report : public
page_with_tabular_report
// contain {{variables}} and also can be multiline but, if so, it must have
// the same number of lines for all input arguments.
//
- // The suffix_xxx arguments can be used to construct the full name of the
- // variable appropriate for the current column pair: the short one is
- // either "Guaranteed" or "Current" while the full one also includes "Zero"
- // for the column pairs using zero interest-rate assumption.
+ // The base and interest_rate arguments can be used to construct the full
+ // name of the variable appropriate for the current column pair, with the
+ // help of base_suffix() and ir_suffix() functions.
virtual std::string get_two_column_header
- (std::string const& suffix_full
- ,std::string const& suffix_short
+ (base guar_or_cur
+ ,interest_rate zero_or_not
) const = 0;
enum
@@ -2108,10 +2107,9 @@ class page_with_basic_tabular_report : public
page_with_tabular_report
auto y = *pos_y;
auto const header = get_two_column_header
- (base_suffix(guar_or_cur) + ir_suffix(zero_or_not)
- ,base_suffix(guar_or_cur)
- )
- ;
+ (guar_or_cur
+ ,zero_or_not
+ );
table.output_super_header
(interpolate_html(header).as_html()
,begin_column
@@ -2166,17 +2164,25 @@ class nasd_basic : public page_with_basic_tabular_report
}
std::string get_two_column_header
- (std::string const& suffix_full
- ,std::string const& suffix_short
+ (base guar_or_cur
+ ,interest_rate zero_or_not
) const override
{
std::ostringstream oss;
oss
- << "{{InitAnnSepAcctGrossInt_" << suffix_full << "}} "
+ << "{{InitAnnSepAcctGrossInt_"
+ << base_suffix(guar_or_cur)
+ << ir_suffix(zero_or_not)
+ << "}} "
<< "Assumed Sep Acct\n"
<< "Gross Rate* "
- << "({{InitAnnSepAcctNetInt_" << suffix_full << "}} net)\n"
- << "{{InitAnnGenAcctInt_" << suffix_short << "}} GPA rate"
+ << "({{InitAnnSepAcctNetInt_"
+ << base_suffix(guar_or_cur)
+ << ir_suffix(zero_or_not)
+ << "}} net)\n"
+ << "{{InitAnnGenAcctInt_"
+ << base_suffix(guar_or_cur)
+ << "}} GPA rate"
;
return oss.str();
}
@@ -2390,15 +2396,21 @@ class reg_d_group_basic : public
page_with_basic_tabular_report
}
std::string get_two_column_header
- (std::string const& suffix_full
- ,std::string const& suffix_short
+ (base guar_or_cur
+ ,interest_rate zero_or_not
) const override
{
std::ostringstream oss;
oss
- << "{{InitAnnSepAcctGrossInt_" << suffix_full << "}} "
+ << "{{InitAnnSepAcctGrossInt_"
+ << base_suffix(guar_or_cur)
+ << ir_suffix(zero_or_not)
+ << "}} "
<< "Hypothetical Gross\n"
- << "Return ({{InitAnnSepAcctNetInt_" << suffix_full << "}} net)"
+ << "Return ({{InitAnnSepAcctNetInt_"
+ << base_suffix(guar_or_cur)
+ << ir_suffix(zero_or_not)
+ << "}} net)"
;
return oss.str();
}
- [lmi-commits] [lmi] master 46788b8 119/156: Start implementing individual private placement illustration kind, (continued)
- [lmi-commits] [lmi] master 46788b8 119/156: Start implementing individual private placement illustration kind, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1287474 114/156: Start private group placement illustration class implementation, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0f78daf 050/156: Compute the footer size in page_with_footer::pre_render(), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 6b3b5b2 054/156: Factor out illustration_table_generator from tabular_detail2_page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 23d26f8 055/156: Factor out reusable page_with_tabular_report class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master f484622 044/156: Only show numeric summary if not in force, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 67db94b 042/156: Implement more of numeric summary page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master dbaf3c4 048/156: Render PDF illustrations in two passes, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master de9567e 152/156: Fix misplaced commas in ledger PDF generator code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 783befa 006/156: Add separate class for representing HTML contents, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 8c5be11 128/156: Use proper types for get_two_column_header() parameters,
Greg Chicares <=
- [lmi-commits] [lmi] master 257ff4b 065/156: Add numeric summary table to PDF illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master ef38c9d 141/156: Revert the title map related changes, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b1ab0fa 126/156: Leave a gap between upper footer part and main page contents, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 940198c 059/156: Add numeric summary attachment page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b341a2a 061/156: Factor out using_illustration_table helper class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1b46585 076/156: Use MarketingNameFootnote & StateMarketingImprimatur on cover page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 234cd39 012/156: Use custom font sizes to be closer to the existing illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 956fcca 071/156: Change the second narrative summary page to use a template too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master dbe5955 015/156: Factor out html_interpolator from pdf_illustration, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 9665573 070/156: Change narrative summary page to use an external template, Greg Chicares, 2018/01/30