lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 2c95260 07/12: Prefer 'switch' to 'if' for a


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2c95260 07/12: Prefer 'switch' to 'if' for a two-valued enum
Date: Tue, 22 May 2018 17:09:22 -0400 (EDT)

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

    Prefer 'switch' to 'if' for a two-valued enum
---
 wx_table_generator.cpp | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 487feb0..df54d40 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -322,14 +322,22 @@ LMI_ASSERT(std::size_t(h / lh) == 1u + 
count_newlines(z.header));
         // output_headers() uses it to write all headers as a block.
         increase_to_if_smaller(max_header_lines_, std::size_t(h / lh));
 
-        // Also increase the column width to be sufficiently wide to fit
-        // this header line if it is inelastic.
-        if(oe_inelastic == z.elasticity)
+        switch(z.elasticity)
             {
+            case oe_inelastic:
+                {
 // Temporarily assert that this does the same as the code it replaced:
 LMI_ASSERT(w == dc_.GetMultiLineTextExtent(z.header).x);
-            increase_to_if_smaller(width, w);
-            width += 2 * column_margin();
+                // Also increase the column width to be sufficiently wide to 
fit
+                // this header line if it is inelastic.
+                increase_to_if_smaller(width, w);
+                width += 2 * column_margin();
+                }
+                break;
+            case oe_elastic:
+                {
+                }
+                break;
             }
         }
 



reply via email to

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