[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f1a98e0 5/7: Improve concinnity
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f1a98e0 5/7: Improve concinnity |
Date: |
Wed, 23 May 2018 21:18:25 -0400 (EDT) |
branch: master
commit f1a98e01e11cd711ca83e3de22b3a4326ff98fa8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Improve concinnity
Reserve 'n_'- prefix for cardinality.
---
custom_io_0.cpp | 74 +++++++++++++++++++++++-----------------------
ihs_avdebug.cpp | 3 +-
multiple_cell_document.cpp | 12 ++++----
name_value_pairs_test.cpp | 44 +++++++++++++--------------
value_cast_test.cpp | 6 ++--
5 files changed, 69 insertions(+), 70 deletions(-)
diff --git a/custom_io_0.cpp b/custom_io_0.cpp
index a5ff1e2..5c87221 100644
--- a/custom_io_0.cpp
+++ b/custom_io_0.cpp
@@ -214,29 +214,29 @@ bool custom_io_0_read(Input& z, std::string const&
filename)
;
}
- name_value_pairs n_v_pairs(actual_filename);
+ name_value_pairs nv_pairs(actual_filename);
// The list is not complete; other items may be required eventually.
- z["InforceYear"] =
n_v_pairs.string_numeric_value("InforceYear");
- z["InforceMonth"] =
n_v_pairs.string_numeric_value("InforceMonth");
- z["InforceGeneralAccountValue"] =
n_v_pairs.string_numeric_value("InforceAVGenAcct");
- z["InforceSeparateAccountValue"] =
n_v_pairs.string_numeric_value("InforceAVSepAcct");
- z["InforceRegularLoanValue"] =
n_v_pairs.string_numeric_value("InforceAVRegLn");
- z["InforcePreferredLoanValue"] =
n_v_pairs.string_numeric_value("InforceAVPrfLn");
- z["InforceCumulativeNoLapsePremium"] =
n_v_pairs.string_numeric_value("InforceCumNoLapsePrem");
- z["InforceCumulativeNoLapsePayments"]=
n_v_pairs.string_numeric_value("InforceCumPmts");
+ z["InforceYear"] =
nv_pairs.string_numeric_value("InforceYear");
+ z["InforceMonth"] =
nv_pairs.string_numeric_value("InforceMonth");
+ z["InforceGeneralAccountValue"] =
nv_pairs.string_numeric_value("InforceAVGenAcct");
+ z["InforceSeparateAccountValue"] =
nv_pairs.string_numeric_value("InforceAVSepAcct");
+ z["InforceRegularLoanValue"] =
nv_pairs.string_numeric_value("InforceAVRegLn");
+ z["InforcePreferredLoanValue"] =
nv_pairs.string_numeric_value("InforceAVPrfLn");
+ z["InforceCumulativeNoLapsePremium"] =
nv_pairs.string_numeric_value("InforceCumNoLapsePrem");
+ z["InforceCumulativeNoLapsePayments"]=
nv_pairs.string_numeric_value("InforceCumPmts");
// TRICKY !! Other input methods distinguish the insured's first, middle,
// and last names. This method uses a single field to meet customer
// requirements. Combining that single field with the middle and last
// names works as long as we initialize the others to a nonempty string.
- z["InsuredName"] = n_v_pairs.string_value("ApplicantName");
+ z["InsuredName"] = nv_pairs.string_value("ApplicantName");
// Not yet used, but might be wanted someday:
-// n_v_pairs.string_value("ApplicantDOB"); // ApplicantDOB=01/01/1968
- z["IssueAge"] =
n_v_pairs.string_numeric_value("ApplicantIssueAge");
+// nv_pairs.string_value("ApplicantDOB"); // ApplicantDOB=01/01/1968
+ z["IssueAge"] =
nv_pairs.string_numeric_value("ApplicantIssueAge");
z["RetirementAge"] = "100";
- std::string gender = n_v_pairs.string_value("ApplicantGender");
+ std::string gender = nv_pairs.string_value("ApplicantGender");
if("F" == gender)
{
z["Gender"] = "Female";
@@ -259,7 +259,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
;
}
- std::string tobacco = n_v_pairs.string_value("ApplicantTobacco");
+ std::string tobacco = nv_pairs.string_value("ApplicantTobacco");
if("Y" == tobacco)
{
z["Smoking"] = "Smoker";
@@ -282,13 +282,13 @@ bool custom_io_0_read(Input& z, std::string const&
filename)
;
}
- z["StateOfJurisdiction"] = n_v_pairs.string_value("ApplicantState");
- z["PremiumTaxState"] = n_v_pairs.string_value("ApplicantState");
+ z["StateOfJurisdiction"] = nv_pairs.string_value("ApplicantState");
+ z["PremiumTaxState"] = nv_pairs.string_value("ApplicantState");
// Not yet used, but might be wanted someday:
// PaymentsPerYear=1
- z["ProductName"] = n_v_pairs.string_value("ProductCode");
+ z["ProductName"] = nv_pairs.string_value("ProductCode");
if("Standard" != z["UnderwritingClass"].str())
{
@@ -298,7 +298,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
;
}
- std::string undw = n_v_pairs.string_value("ProductOption");
+ std::string undw = nv_pairs.string_value("ProductOption");
if("P" == undw)
{
z["UnderwritingClass"] = "Preferred";
@@ -326,7 +326,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
;
}
- std::string dbopt = n_v_pairs.string_value("DeathBenefitOption");
+ std::string dbopt = nv_pairs.string_value("DeathBenefitOption");
if("L" == dbopt)
{
z["DeathBenefitOption"] = "a";
@@ -352,7 +352,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
// For single-premium cases, the specified amount would normally
// be calculated by using a "corridor" specified-amount strategy,
// but the customer wants to enter the specified amount explicitly.
- z["SpecifiedAmount"] = n_v_pairs.string_value("FaceAmt");
+ z["SpecifiedAmount"] = nv_pairs.string_value("FaceAmt");
// Zero out any default er premium.
z["CorporationPayment"] = "0";
@@ -360,7 +360,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
// treat it, contrary to fact, as paid by the insured; reason:
// consistency with GUI--see ChangeLog for 20050825T0122Z .
// SOMEDAY !! Revisit this later.
- z["Payment"] = n_v_pairs.string_value("PremiumAmt") +
";0";
+ z["Payment"] = nv_pairs.string_value("PremiumAmt") +
";0";
// Not yet used, but might be wanted someday:
//ExchangeAmt=0
@@ -371,11 +371,11 @@ bool custom_io_0_read(Input& z, std::string const&
filename)
// Table ratings: not yet used, but might be wanted someday:
// ApplicantRating=
// ApplicantThruAge=
- z["SubstandardTable"] = n_v_pairs.string_value("ApplicantRating");
+ z["SubstandardTable"] = nv_pairs.string_value("ApplicantRating");
- double permanent_flat =
n_v_pairs.numeric_value("PermFlatExtraAmt");
- double temporary_flat =
n_v_pairs.numeric_value("TempFlatExtraAmt");
- double temporary_flat_max_age =
n_v_pairs.numeric_value("TempFlatExtraThruAge");
+ double permanent_flat = nv_pairs.numeric_value("PermFlatExtraAmt");
+ double temporary_flat = nv_pairs.numeric_value("TempFlatExtraAmt");
+ double temporary_flat_max_age =
nv_pairs.numeric_value("TempFlatExtraThruAge");
if(z.issue_age() < temporary_flat_max_age)
{
z["FlatExtra"] =
@@ -401,11 +401,11 @@ bool custom_io_0_read(Input& z, std::string const&
filename)
double first_year_general_account_rate =
0.01
- * n_v_pairs.numeric_value("InterestRateFirstYr")
+ * nv_pairs.numeric_value("InterestRateFirstYr")
;
double renewal_year_general_account_rate =
0.01
- * n_v_pairs.numeric_value("InterestRateOngoing")
+ * nv_pairs.numeric_value("InterestRateOngoing")
;
std::vector<double> declared_rate;
@@ -426,20 +426,20 @@ bool custom_io_0_read(Input& z, std::string const&
filename)
// names works only as long as we initialize the latter to a nonempty
// string, which we do as a temporary workaround elsewhere; when that's
// resolved, revisit this.
- z["AgentName"] = n_v_pairs.string_value("AgentName");
- z["AgentAddress"] = n_v_pairs.string_value("AgentAddress");
- z["AgentCity"] = n_v_pairs.string_value("AgentCity");
- z["AgentState"] = n_v_pairs.string_value("AgentState");
- z["AgentZipCode"] = n_v_pairs.string_value("AgentZip");
- z["AgentPhone"] = n_v_pairs.string_value("AgentPhone");
- z["AgentId"] = n_v_pairs.string_value("AgentLicense");
+ z["AgentName"] = nv_pairs.string_value("AgentName");
+ z["AgentAddress"] = nv_pairs.string_value("AgentAddress");
+ z["AgentCity"] = nv_pairs.string_value("AgentCity");
+ z["AgentState"] = nv_pairs.string_value("AgentState");
+ z["AgentZipCode"] = nv_pairs.string_value("AgentZip");
+ z["AgentPhone"] = nv_pairs.string_value("AgentPhone");
+ z["AgentId"] = nv_pairs.string_value("AgentLicense");
// Not yet used, but might be wanted someday:
// AgentCompanyName
// AgentLicense
double separate_account_rate =
0.01
- * n_v_pairs.numeric_value("InterestRateSepAcctFirstYr")
+ * nv_pairs.numeric_value("InterestRateSepAcctFirstYr")
;
z["SeparateAccountRate"] =
value_cast<std::string>(separate_account_rate);
@@ -448,7 +448,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
// it should be ignored, and must not be incorrectly converted to
// zero. Yet one might actually wish to set the multiplier to zero;
// that would be indicated by non-empty input evaluating to zero.
- std::string coi_mult = n_v_pairs.string_value("COIMult");
+ std::string coi_mult = nv_pairs.string_value("COIMult");
if(!coi_mult.empty())
{
z["OverrideCoiMultiplier"] = "Yes";
@@ -460,7 +460,7 @@ bool custom_io_0_read(Input& z, std::string const& filename)
// if "Y", then exit;
// else, leave the GUI active.
// Ignored for command-line regression testing.
- return "Y" == n_v_pairs.string_value("AutoClose");
+ return "Y" == nv_pairs.string_value("AutoClose");
}
/// Write custom output for a particular customer.
diff --git a/ihs_avdebug.cpp b/ihs_avdebug.cpp
index e93d792..f0fbfbc 100644
--- a/ihs_avdebug.cpp
+++ b/ihs_avdebug.cpp
@@ -42,8 +42,7 @@ namespace
{
inline std::string const& not_applicable()
{
- static char const* n_a = "---";
- static std::string const s(n_a);
+ static std::string const s{"---"};
return s;
}
diff --git a/multiple_cell_document.cpp b/multiple_cell_document.cpp
index 9590014..17e82e1 100644
--- a/multiple_cell_document.cpp
+++ b/multiple_cell_document.cpp
@@ -252,9 +252,9 @@ void multiple_cell_document::parse_v0(xml_lmi::dom_parser
const& parser)
<< LMI_FLUSH
;
}
- std::string const n_classes = xml_lmi::get_content(*i);
- LMI_ASSERT(!n_classes.empty());
- unsigned int number_of_classes = value_cast<unsigned int>(n_classes);
+ std::string const str_n_classes = xml_lmi::get_content(*i);
+ LMI_ASSERT(!str_n_classes.empty());
+ unsigned int number_of_classes = value_cast<unsigned int>(str_n_classes);
// Parameters for each class.
class_parms_.clear();
@@ -324,9 +324,9 @@ void multiple_cell_document::parse_v0(xml_lmi::dom_parser
const& parser)
<< LMI_FLUSH
;
}
- std::string const n_cells = xml_lmi::get_content(*i);
- LMI_ASSERT(!n_cells.empty());
- unsigned int number_of_cells = value_cast<unsigned int>(n_cells);
+ std::string const str_n_cells = xml_lmi::get_content(*i);
+ LMI_ASSERT(!str_n_cells.empty());
+ unsigned int number_of_cells = value_cast<unsigned int>(str_n_cells);
// Parameters for each cell.
cell_parms_.clear();
diff --git a/name_value_pairs_test.cpp b/name_value_pairs_test.cpp
index a5b913c..0d5ea2f 100644
--- a/name_value_pairs_test.cpp
+++ b/name_value_pairs_test.cpp
@@ -64,43 +64,43 @@ int test_main(int, char*[])
;
}
- name_value_pairs n_v_pairs_0(filename0);
- std::map<std::string, std::string> m0 = n_v_pairs_0.map();
+ name_value_pairs nv_pairs_0(filename0);
+ std::map<std::string, std::string> m0 = nv_pairs_0.map();
BOOST_TEST(0 == std::remove(filename0.c_str()));
BOOST_TEST_EQUAL(15, m0.size());
// Test string_value().
- BOOST_TEST_EQUAL("a" , n_v_pairs_0.string_value("a"));
- BOOST_TEST_EQUAL("b" , n_v_pairs_0.string_value("b"));
- BOOST_TEST_EQUAL("" , n_v_pairs_0.string_value("c"));
- BOOST_TEST_EQUAL("=" , n_v_pairs_0.string_value("d"));
- BOOST_TEST_EQUAL("1=." , n_v_pairs_0.string_value("e"));
+ BOOST_TEST_EQUAL("a" , nv_pairs_0.string_value("a"));
+ BOOST_TEST_EQUAL("b" , nv_pairs_0.string_value("b"));
+ BOOST_TEST_EQUAL("" , nv_pairs_0.string_value("c"));
+ BOOST_TEST_EQUAL("=" , nv_pairs_0.string_value("d"));
+ BOOST_TEST_EQUAL("1=." , nv_pairs_0.string_value("e"));
#if !defined LMI_MSW
- BOOST_TEST_EQUAL(" f \r" , n_v_pairs_0.string_value("f"));
+ BOOST_TEST_EQUAL(" f \r" , nv_pairs_0.string_value("f"));
#else // defined LMI_MSW
- BOOST_TEST_EQUAL(" f " , n_v_pairs_0.string_value("f"));
+ BOOST_TEST_EQUAL(" f " , nv_pairs_0.string_value("f"));
#endif // defined LMI_MSW
- BOOST_TEST_EQUAL("a test", n_v_pairs_0.string_value("this"));
+ BOOST_TEST_EQUAL("a test", nv_pairs_0.string_value("this"));
// Test numeric_value().
- BOOST_TEST_EQUAL( 2.0 , n_v_pairs_0.numeric_value("z"));
- BOOST_TEST_EQUAL(-3.142 , n_v_pairs_0.numeric_value("y"));
- BOOST_TEST_EQUAL( 2.718 , n_v_pairs_0.numeric_value("x"));
- BOOST_TEST_EQUAL( 2.718 , n_v_pairs_0.numeric_value("w"));
- BOOST_TEST_EQUAL( 2.718 , n_v_pairs_0.numeric_value("v"));
- BOOST_TEST_EQUAL( 0.0 , n_v_pairs_0.numeric_value("u"));
- BOOST_TEST_EQUAL( 0.0 , n_v_pairs_0.numeric_value("t"));
- BOOST_TEST_EQUAL( 0.0 , n_v_pairs_0.numeric_value("s"));
+ BOOST_TEST_EQUAL( 2.0 , nv_pairs_0.numeric_value("z"));
+ BOOST_TEST_EQUAL(-3.142 , nv_pairs_0.numeric_value("y"));
+ BOOST_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("x"));
+ BOOST_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("w"));
+ BOOST_TEST_EQUAL( 2.718 , nv_pairs_0.numeric_value("v"));
+ BOOST_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("u"));
+ BOOST_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("t"));
+ BOOST_TEST_EQUAL( 0.0 , nv_pairs_0.numeric_value("s"));
- BOOST_TEST_EQUAL("2.718" , n_v_pairs_0.string_numeric_value("v"));
- BOOST_TEST_EQUAL("0" , n_v_pairs_0.string_numeric_value("s"));
+ BOOST_TEST_EQUAL("2.718" , nv_pairs_0.string_numeric_value("v"));
+ BOOST_TEST_EQUAL("0" , nv_pairs_0.string_numeric_value("s"));
std::string filename1("/tmp/nonexistent_name_value_pairs_test_file");
- name_value_pairs n_v_pairs_1(filename1);
- std::map<std::string, std::string> m1 = n_v_pairs_1.map();
+ name_value_pairs nv_pairs_1(filename1);
+ std::map<std::string, std::string> m1 = nv_pairs_1.map();
BOOST_TEST_EQUAL(0, m1.size());
return EXIT_SUCCESS;
diff --git a/value_cast_test.cpp b/value_cast_test.cpp
index 9376a50..57d199a 100644
--- a/value_cast_test.cpp
+++ b/value_cast_test.cpp
@@ -80,7 +80,7 @@ int test_main(int, char*[])
double d(1.23456);
std::string s("test");
X x;
- NotDefaultConstructible n_d_c(std::cin);
+ NotDefaultConstructible ndc(std::cin);
// Test which conversion is used for type double.
@@ -123,8 +123,8 @@ int test_main(int, char*[])
BOOST_TEST_EQUAL(e_stream ,method( (char volatile*)nullptr, s));
- n_d_c = value_cast<NotDefaultConstructible>(n_d_c);
- n_d_c = value_cast(n_d_c, n_d_c);
+ ndc = value_cast<NotDefaultConstructible>(ndc);
+ ndc = value_cast(ndc, ndc);
// Forbidden conversions to pointer, detected at compile time.
// cp = value_cast(d, cp);
- [lmi-commits] [lmi] master updated (716c729 -> 9f0eebc), Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master 15f8f62 1/7: Rename some local variables for concinnity, Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master 21260f8 3/7: Rename a member function, Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master 149a288 6/7: Improve a local variable's name, Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master e4ec715 4/7: Rewrite documentation, Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master 151a1ea 2/7: Add missing period at end of sentence, Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master 9f0eebc 7/7: Rename certain local variables, Greg Chicares, 2018/05/23
- [lmi-commits] [lmi] master f1a98e0 5/7: Improve concinnity,
Greg Chicares <=