[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 43dcd1b 5/6: Make all table_column_info data
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 43dcd1b 5/6: Make all table_column_info data members private and non-const |
Date: |
Thu, 23 Aug 2018 19:59:30 -0400 (EDT) |
branch: master
commit 43dcd1b788a27f55c67de39c07e62d6fce781ca2
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Make all table_column_info data members private and non-const
It is impossible to change members' values after construction, so there
is no longer any need for them to be const; and their constness was a
problem because it made the class nonassignable.
---
report_table.hpp | 14 ++++----------
wx_table_generator.cpp | 14 ++++++++++++--
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/report_table.hpp b/report_table.hpp
index 9739e2f..e425427 100644
--- a/report_table.hpp
+++ b/report_table.hpp
@@ -88,16 +88,10 @@ class LMI_SO table_column_info
bool is_clipped() const {return is_elastic();}
private:
- std::string const col_header_;
-
- public:
- // PDF !! Modified directly by set_column_widths(), hence neither
- // private nor const.
- int col_width_;
-
- private:
- oenum_h_align const alignment_;
- bool const is_elastic_;
+ std::string col_header_;
+ int col_width_;
+ oenum_h_align alignment_;
+ bool is_elastic_;
};
std::vector<int> LMI_SO apportion(std::vector<int> const& votes, int seats);
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index ac9a20c..75fe8d6 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -68,7 +68,12 @@ wx_table_generator::wx_table_generator
);
for(int j = 0; j < lmi::ssize(all_columns()); ++j)
{
- all_columns_[j].col_width_ = w[j];
+ all_columns_[j] = table_column_info
+ (all_columns_[j].col_header()
+ ,w [j]
+ ,all_columns_[j].alignment()
+ ,all_columns_[j].is_elastic() ? oe_elastic : oe_inelastic
+ );
}
// Set a pen with zero width to make grid lines thin,
@@ -111,7 +116,12 @@ wx_table_generator::wx_table_generator
);
for(int j = 0; j < lmi::ssize(all_columns()); ++j)
{
- all_columns_[j].col_width_ = w[j];
+ all_columns_[j] = table_column_info
+ (all_columns_[j].col_header()
+ ,w [j]
+ ,all_columns_[j].alignment()
+ ,all_columns_[j].is_elastic() ? oe_elastic : oe_inelastic
+ );
}
dc_.SetPen(illustration_rule_color);
- [lmi-commits] [lmi] master updated (4da8dbb -> b00dae4), Greg Chicares, 2018/08/23
- [lmi-commits] [lmi] master 686d9df 1/6: Tighten an assertion that was too lax, Greg Chicares, 2018/08/23
- [lmi-commits] [lmi] master e6271b3 4/6: Move a couple lines of documentation, Greg Chicares, 2018/08/23
- [lmi-commits] [lmi] master 43dcd1b 5/6: Make all table_column_info data members private and non-const,
Greg Chicares <=
- [lmi-commits] [lmi] master b00dae4 6/6: Use braces in ctor-initializers, Greg Chicares, 2018/08/23
- [lmi-commits] [lmi] master 212d81a 3/6: Pass the bulky argument of set_column_widths() by const reference, Greg Chicares, 2018/08/23
- [lmi-commits] [lmi] master 8fad1e6 2/6: Return a vector from set_column_widths(), Greg Chicares, 2018/08/23