lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master d270b21 7/8: Generally avoid regex /, $/


From: Greg Chicares
Subject: [lmi-commits] [lmi] master d270b21 7/8: Generally avoid regex /, $/
Date: Thu, 17 May 2018 19:07:10 -0400 (EDT)

branch: master
commit d270b21cb120a0c56810024680ae97887f520989
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Generally avoid regex /,$/
    
    Exceptions: comments, imported legacy C-style code, and
      {arrays, like, this, with,
       comma, after, last, item,
      }; // because the extra comma at the end is legal
    
    Rationale: rearranging a
      list,
      this, // oops, out of order
      like;
    to obtain a
      list,
      like; // oops, syntax error
      this, // oops, syntax error
    requires too much attention. Adding an element at the end: ditto.
---
 basic_values.hpp           |  7 +++----
 group_quote_pdf_gen_wx.cpp |  4 ++--
 input_sequence_entry.cpp   | 27 +++++++++++++--------------
 interest_rates.cpp         | 18 ++++++++++++------
 interpolate_string.hpp     |  9 ++++-----
 main_wx_test.cpp           |  8 ++++----
 rate_table.cpp             | 44 +++++++++++++++++++++++---------------------
 7 files changed, 61 insertions(+), 56 deletions(-)

diff --git a/basic_values.hpp b/basic_values.hpp
index b7563e5..b632790 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -72,10 +72,9 @@ class stratified_charges;
 // that case, we're better off not creating a blended table because
 // NAIC has published blended tables.
 enum EBlend
-    {
-    CannotBlend,
-    CanBlend,
-    MustBlend
+    {CannotBlend
+    ,CanBlend
+    ,MustBlend
     };
 
 class LMI_SO BasicValues
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index da00dbf..562dc22 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -893,8 +893,8 @@ void group_quote_pdf_generator_wx::output_image_header
     pdf_dc.DrawLabel
         (image_text
         ,wxRect
-            (wxPoint(pdf_writer.get_horz_margin(), (pos_top + *pos_y) / 2),
-             pdf_dc.GetMultiLineTextExtent(image_text)
+            (wxPoint(pdf_writer.get_horz_margin(), (pos_top + *pos_y) / 2)
+            ,pdf_dc.GetMultiLineTextExtent(image_text)
             )
         ,wxALIGN_CENTER_HORIZONTAL
         );
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index e1a7427..5b84299 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -82,7 +82,7 @@ choice_value const duration_mode_choice_values[] =
     {e_attained_age,     "until age"},
     {e_duration,         "until duration"},
     {e_number_of_years,  "for a period of"},
-    {e_maturity,         "until maturity"}    // e_maturity must be last
+    {e_maturity,         "until maturity"},    // e_maturity must be last
   };
 
 unsigned int const duration_mode_choices = sizeof(duration_mode_choice_values) 
/ sizeof(choice_value);
@@ -265,16 +265,15 @@ class InputSequenceEditor
     wxString format_from_text(int row);
 
     enum Col
-    {
-        Col_Value,
-        Col_From,
-        Col_DurationMode,
-        Col_DurationNum,
-        Col_Then,
-        Col_Remove,
-        Col_Add,
-        Col_Max
-    };
+        {Col_Value
+        ,Col_From
+        ,Col_DurationMode
+        ,Col_DurationNum
+        ,Col_Then
+        ,Col_Remove
+        ,Col_Add
+        ,Col_Max
+        };
 
     wxTextEntry& value_field(int row)
     {
@@ -977,9 +976,9 @@ wxString InputSequenceEditor::format_from_text(int row)
                 i--;
                 }
             return wxString::Format
-                ("%s + %d years",
-                format_from_text(i + 1).c_str(),
-                yrs
+                ("%s + %d years"
+                ,format_from_text(i + 1).c_str()
+                ,yrs
                 );
             }
         case e_maturity:
diff --git a/interest_rates.cpp b/interest_rates.cpp
index 9159ba4..a3ab03c 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -1130,12 +1130,18 @@ void InterestRates::Initialize7702Rates()
 
     // ET !! Mly7702ig = -1.0 + 1.0 / DBDiscountRate;
     Mly7702ig = DBDiscountRate;
-    std::transform(Mly7702ig.begin(), Mly7702ig.end(), Mly7702ig.begin(),
-          std::bind1st(std::divides<double>(), 1.0)
-          );
-    std::transform(Mly7702ig.begin(), Mly7702ig.end(), Mly7702ig.begin(),
-          std::bind2nd(std::minus<double>(), 1.0)
-          );
+    std::transform
+        (Mly7702ig.begin()
+        ,Mly7702ig.end()
+        ,Mly7702ig.begin()
+        ,std::bind1st(std::divides<double>(), 1.0)
+        );
+    std::transform
+        (Mly7702ig.begin()
+        ,Mly7702ig.end()
+        ,Mly7702ig.begin()
+        ,std::bind2nd(std::minus<double>(), 1.0)
+        );
 }
 #endif // 0
 
diff --git a/interpolate_string.hpp b/interpolate_string.hpp
index 2b6914a..9eb6d9a 100644
--- a/interpolate_string.hpp
+++ b/interpolate_string.hpp
@@ -30,11 +30,10 @@
 #include <string>
 
 enum class interpolate_lookup_kind
-{
-    variable,
-    section,
-    partial
-};
+    {variable
+    ,section
+    ,partial
+    };
 
 using lookup_function
     = std::function<std::string (std::string const&, interpolate_lookup_kind)>;
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index ef657d8..4f735f9 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -135,10 +135,10 @@ struct TestsResults
 
     // The sum of passed, skipped and failed is the same as total (except when
     // a test is in process of execution and its result is yet unknown).
-    int total,
-        passed,
-        skipped,
-        failed;
+    int total;
+    int passed;
+    int skipped;
+    int failed;
 };
 
 /// Run the tests.
diff --git a/rate_table.cpp b/rate_table.cpp
index 67c9f47..81fb9f9 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -330,11 +330,10 @@ static soa_field const soa_fields[] =
 };
 
 enum class table_type : std::uint8_t
-{
-    aggregate = 'A',
-    duration  = 'D',
-    select    = 'S',
-};
+    {aggregate = 'A'
+    ,duration  = 'D'
+    ,select    = 'S'
+    };
 
 char const* table_type_as_string(table_type tt)
 {
@@ -997,26 +996,29 @@ class table_impl final
     std::vector<double> values_;
 
     std::optional<std::string>
-        name_,
-        contributor_,
-        data_source_,
-        data_volume_,
-        obs_period_,
-        unit_of_obs_,
-        construction_method_,
-        published_reference_,
-        comments_;
+         name_
+        ,contributor_
+        ,data_source_
+        ,data_volume_
+        ,obs_period_
+        ,unit_of_obs_
+        ,construction_method_
+        ,published_reference_
+        ,comments_
+        ;
 
     std::optional<std::uint32_t>
-        number_,
-        hash_value_;
+         number_
+        ,hash_value_
+        ;
 
     std::optional<std::uint16_t>
-        num_decimals_,
-        min_age_,
-        max_age_,
-        select_period_,
-        max_select_age_;
+         num_decimals_
+        ,min_age_
+        ,max_age_
+        ,select_period_
+        ,max_select_age_
+        ;
 
     std::optional<table_type>
         type_;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]