[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 49ae301 3/7: Reverse sense of certain conditi
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 49ae301 3/7: Reverse sense of certain conditionals for readability |
Date: |
Sat, 19 May 2018 12:54:40 -0400 (EDT) |
branch: master
commit 49ae3018dd8477a7acd793391740e064f885f0e1
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Reverse sense of certain conditionals for readability
Renamed and reversed the sense of a function that indicates whether
the 'hidden' flag should be set.
---
ledger_pdf_generator_wx.cpp | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 6b7d10c..f02a000 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -316,8 +316,8 @@ class html_interpolator
// custom wxHtmlCell showing a table.
//
// Derived classes must provide get_table_columns() and may also override
-// should_show_column() to hide some of these columns dynamically and then can
-// use create_table_generator() to obtain the generator object that can be used
+// hide_column() to hide some of these columns dynamically and then can use
+// create_table_generator() to obtain the generator object that can be used
// to render a table with the specified columns.
class using_illustration_table
{
@@ -338,16 +338,16 @@ class using_illustration_table
// PDF !! Most overrides have exactly this function body:
// {
// // Don't show AttainedAge on a composite.
- // return !(ledger.is_composite() && column == column_end_of_year_age);
+ // return ledger.is_composite() && column == column_end_of_year_age;
// }
// However, that cannot be written here, once and only once,
// because 'column_end_of_year_age' is an enumerator whose value
// may differ in each derived class.
- virtual bool should_show_column(Ledger const& ledger, int column) const
+ virtual bool hide_column(Ledger const& ledger, int column) const
{
stifle_warning_for_unused_value(ledger);
stifle_warning_for_unused_value(column);
- return true;
+ return false;
}
// Useful helper for creating the table generator using the columns defined
@@ -365,7 +365,7 @@ class using_illustration_table
vc.push_back
({i.header
,i.widest_text
- ,!should_show_column(ledger, column++)
+ ,hide_column(ledger, column++)
});
}
@@ -1830,10 +1830,10 @@ class ill_reg_tabular_detail_page : public
page_with_tabular_report
return columns;
}
- bool should_show_column(Ledger const& ledger, int column) const override
+ bool hide_column(Ledger const& ledger, int column) const override
{
// Don't show AttainedAge on a composite.
- return !(ledger.is_composite() && column == column_end_of_year_age);
+ return ledger.is_composite() && column == column_end_of_year_age;
}
};
@@ -1870,10 +1870,10 @@ class ill_reg_tabular_detail2_page : public
page_with_tabular_report
return columns;
}
- bool should_show_column(Ledger const& ledger, int column) const override
+ bool hide_column(Ledger const& ledger, int column) const override
{
// Don't show AttainedAge on a composite.
- return !(ledger.is_composite() && column == column_end_of_year_age);
+ return ledger.is_composite() && column == column_end_of_year_age;
}
};
@@ -2172,10 +2172,10 @@ class page_with_basic_tabular_report : public
page_with_tabular_report
return columns;
}
- bool should_show_column(Ledger const& ledger, int column) const override
+ bool hide_column(Ledger const& ledger, int column) const override
{
// Don't show AttainedAge on a composite.
- return !(ledger.is_composite() && column == column_end_of_year_age);
+ return ledger.is_composite() && column == column_end_of_year_age;
}
void render_or_measure_extra_headers
@@ -2367,7 +2367,7 @@ class nasd_supplemental : public page_with_tabular_report
return columns;
}
- bool should_show_column(Ledger const& ledger, int column) const override
+ bool hide_column(Ledger const& ledger, int column) const override
{
auto const& invar = ledger.GetLedgerInvariant();
@@ -2378,20 +2378,20 @@ class nasd_supplemental : public
page_with_tabular_report
{
case column_end_of_year_age:
// This column doesn't make sense for composite ledgers.
- return !ledger.is_composite();
+ return ledger.is_composite();
case column_admin_charge:
case column_premium_tax_load:
case column_dac_tax_load:
// These columns only appear in non-split premiums case.
- return invar.SplitMinPrem == 0.0;
+ return invar.SplitMinPrem;
case column_er_gross_payment:
case column_ee_gross_payment:
case column_er_min_premium:
case column_ee_min_premium:
// While those only appear in split premiums case.
- return invar.SplitMinPrem == 1.0;
+ return !invar.SplitMinPrem;
case column_policy_year:
case column_premium_outlay:
@@ -2405,7 +2405,7 @@ class nasd_supplemental : public page_with_tabular_report
break;
}
- return true;
+ return false;
}
};
@@ -2445,7 +2445,7 @@ class nasd_assumption_detail : public
page_with_tabular_report
return columns;
}
- // Notice that there is no need to override should_show_column() in this
+ // Notice that there is no need to override hide_column() in this
// class as this page is not included in composite illustrations and hence
// all of its columns, including the "AttainedAge" one, are always shown.
};
@@ -2617,10 +2617,10 @@ class reg_d_individual_irr_base : public
page_with_tabular_report
// Must be overridden to return the base being used.
virtual base get_base() const = 0;
- bool should_show_column(Ledger const& ledger, int column) const override
+ bool hide_column(Ledger const& ledger, int column) const override
{
// Don't show AttainedAge on a composite.
- return !(ledger.is_composite() && column == column_end_of_year_age);
+ return ledger.is_composite() && column == column_end_of_year_age;
}
void render_or_measure_extra_headers
@@ -2791,10 +2791,10 @@ class reg_d_individual_curr : public
page_with_tabular_report
return columns;
}
- bool should_show_column(Ledger const& ledger, int column) const override
+ bool hide_column(Ledger const& ledger, int column) const override
{
// Don't show AttainedAge on a composite.
- return !(ledger.is_composite() && column == column_end_of_year_age);
+ return ledger.is_composite() && column == column_end_of_year_age;
}
void render_or_measure_extra_headers
- [lmi-commits] [lmi] master updated (b8170c7 -> 13f9424), Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 0b44727 2/7: Improve const correctness, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 448b5fe 6/7: Add several enumerations for column styles, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master c665c1d 4/7: Refine documentation, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master ac83c23 5/7: Spell 'center' one way only, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 49ae301 3/7: Reverse sense of certain conditionals for readability,
Greg Chicares <=
- [lmi-commits] [lmi] master 13f9424 7/7: Make column visibility enumerative rather than boolean, Greg Chicares, 2018/05/19
- [lmi-commits] [lmi] master 02fec5a 1/7: Pluralize name s/output_header/output_headers/, Greg Chicares, 2018/05/19