[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;
- [lmi-commits] [lmi] master updated (0c90de6 -> 45b086a), Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 914ea72 02/13: Remove a "helper" lambda, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 990dbe2 01/13: Improve encapsulation,
Greg Chicares <=
- [lmi-commits] [lmi] master 0188828 07/13: Improve alignment, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master be2f05a 09/13: Improve a variable's name, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master e00fb75 05/13: Spell 'color' one way only, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master cccd64c 04/13: Remove disused header, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 111f2bd 03/13: Correct a misleading comment, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 02c6f2e 12/13: Pass column data to table generator as an aggregate parameter, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 45b086a 13/13: Simplify logic, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 5c9a0db 08/13: Improve typography, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master 8e0a46c 11/13: Regularize names, Greg Chicares, 2018/05/12
- [lmi-commits] [lmi] master e7b741f 10/13: Write 'const' after the type it modifies, Greg Chicares, 2018/05/12