lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 990dbe2 01/13: Improve encapsulation


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 990dbe2 01/13: Improve encapsulation
Date: Sat, 12 May 2018 12:00:21 -0400 (EDT)

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

    Improve encapsulation
    
    Classes that construct a wx_table_generator already know the number of
    table columns, which is immutably determined at time of construction.
    (Otherwise, the number of values passed to output_row() would be wrong.)
    Encapsulation is improved if class wx_table_generator doesn't publish
    its column count. The removed accessor was used only in one place.
---
 ledger_pdf_generator_wx.cpp | 8 ++------
 wx_table_generator.cpp      | 5 -----
 wx_table_generator.hpp      | 3 ---
 3 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 1ef02e6..b0219d0 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1729,12 +1729,8 @@ class page_with_tabular_report
         table_gen.output_header(&pos_y, output_mode);
 
         pos_y += table_gen.get_separator_line_height();
-        table_gen.output_horz_separator
-            (0
-            ,table_gen.columns_count()
-            ,pos_y
-            ,output_mode
-            );
+        auto const ncols = get_table_columns().size();
+        table_gen.output_horz_separator(0, ncols, pos_y, output_mode);
 
         return pos_y;
     }
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 90c6f49..b9fb885 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -353,11 +353,6 @@ int wx_table_generator::do_get_cell_x(std::size_t column)
     return x;
 }
 
-std::size_t wx_table_generator::columns_count() const
-{
-    return all_columns().size();
-}
-
 int wx_table_generator::row_height() const
 {
     return row_height_;
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 22a3bc3..f3997b4 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -102,9 +102,6 @@ class wx_table_generator
         ,std::string const& value
         );
 
-    // Return the number of columns.
-    std::size_t columns_count() const;
-
     // Return the height of a single table row.
     int row_height() const;
 



reply via email to

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