lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6402] Refactor for concision


From: Greg Chicares
Subject: [lmi-commits] [6402] Refactor for concision
Date: Mon, 09 Nov 2015 14:24:32 +0000

Revision: 6402
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6402
Author:   chicares
Date:     2015-11-09 14:24:32 +0000 (Mon, 09 Nov 2015)
Log Message:
-----------
Refactor for concision

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/group_quote_pdf_gen_wx.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-11-09 14:10:18 UTC (rev 6401)
+++ lmi/trunk/ChangeLog 2015-11-09 14:24:32 UTC (rev 6402)
@@ -37481,3 +37481,14 @@
 Set composite "age" to that of youngest included cell. See:
   http://lists.nongnu.org/archive/html/lmi/2015-11/msg00008.html
 
+20151109T1410Z <address@hidden> [468]
+
+  group_quote_pdf_gen_wx.cpp
+Avoid writing <br> before empty footnotes (VZ). See:
+  http://lists.nongnu.org/archive/html/lmi/2015-11/msg00007.html
+
+20151109T1424Z <address@hidden> [468]
+
+  group_quote_pdf_gen_wx.cpp
+Refactor for concision.
+

Modified: lmi/trunk/group_quote_pdf_gen_wx.cpp
===================================================================
--- lmi/trunk/group_quote_pdf_gen_wx.cpp        2015-11-09 14:10:18 UTC (rev 
6401)
+++ lmi/trunk/group_quote_pdf_gen_wx.cpp        2015-11-09 14:24:32 UTC (rev 
6402)
@@ -110,7 +110,7 @@
 struct b;
 struct br;
 
-} // tag namespace
+} // namespace tag
 
 template<typename T>
 struct tag_info;
@@ -129,7 +129,7 @@
     static bool has_end() { return false; }
 };
 
-} // html namespace
+} // namespace html
 
 /// Wrap the given text in an HTML tag if it is not empty, otherwise just
 /// return an empty string.
@@ -144,19 +144,42 @@
     wxString result;
     if(!html.empty())
         {
-        result
-            << '<' << html::tag_info<T>::get_name() << '>'
-            << html;
+        result << '<' << html::tag_info<T>::get_name() << '>' << html;
         if(html::tag_info<T>::has_end())
             {
-            result
-                << "</" << html::tag_info<T>::get_name() << '>';
+            result << "</" << html::tag_info<T>::get_name() << '>';
             }
         }
 
     return result;
 }
 
+/// Transform 'html' -> '<br><br>html', but return empty string unchanged.
+
+wxString brbr(wxString const& html)
+{
+    return
+        wrap_if_not_empty<html::tag::br>
+            (wrap_if_not_empty<html::tag::br>
+                (escape_for_html_elem(html)
+                )
+            );
+}
+
+/// Transform 'html' -> '<br><br><b>html</b>', but return empty string 
unchanged.
+
+wxString brbrb(wxString const& html)
+{
+    return
+        wrap_if_not_empty<html::tag::br>
+            (wrap_if_not_empty<html::tag::br>
+                (wrap_if_not_empty<html::tag::b>
+                    (escape_for_html_elem(html)
+                    )
+                )
+            );
+}
+
 /// Generate HTML representation of a field name and value in an HTML table and
 /// append it to the specified string, defining the HTML.
 ///
@@ -621,51 +644,16 @@
     jdn_t eff_date    = jdn_t(static_cast<int>(invar.EffDateJdn));
     effective_date_   = ConvertDateToWx(eff_date).FormatDate().ToStdString();
     // Deliberately begin the footer with <br> tags, to separate it
-    // from the logo right above it, but don't use these tags if the footer is
-    // empty.
-    footer_           =
-          wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.GroupQuoteIsNotAnOffer)
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.GroupQuoteRidersFooter)
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.GroupQuotePolicyFormId)
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.GroupQuoteStateVariations)
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.MarketingNameFootnote)
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (wrap_if_not_empty<html::tag::b>
-                    (escape_for_html_elem(invar.GroupQuoteProspectus)
-                    )
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.GroupQuoteUnderwriter)
-                )
-            )
-        + wrap_if_not_empty<html::tag::br>
-            (wrap_if_not_empty<html::tag::br>
-                (escape_for_html_elem(invar.GroupQuoteBrokerDealer)
-                )
-            )
+    // from the logo right above it.
+    footer_ =
+          brbr (invar.GroupQuoteIsNotAnOffer)
+        + brbr (invar.GroupQuoteRidersFooter)
+        + brbr (invar.GroupQuotePolicyFormId)
+        + brbr (invar.GroupQuoteStateVariations)
+        + brbr (invar.MarketingNameFootnote)
+        + brbrb(invar.GroupQuoteProspectus)
+        + brbr (invar.GroupQuoteUnderwriter)
+        + brbr (invar.GroupQuoteBrokerDealer)
         ;
 
     assert_nonblank(company_         , "Sponsor");




reply via email to

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