[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 6d64140 02/10: Rename class wx_table_generato
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 6d64140 02/10: Rename class wx_table_generator::column_info --> table_column_info |
Date: |
Fri, 27 Jul 2018 17:03:53 -0400 (EDT) |
branch: master
commit 6d64140d653c413728f89250c4071d84eda4a87d
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Rename class wx_table_generator::column_info --> table_column_info
Motivation: To unit-test compute_column_widths(). Its diagnostic
messages frequently appear, indicating either a regression such as:
https://lists.nongnu.org/archive/html/lmi/2018-07/msg00020.html
or design issues that must be grappled with, e.g.:
https://lists.nongnu.org/archive/html/lmi/2018-04/msg00100.html
and it is hoped that a rewrite can address the lingering questions
documented inline and lead to exploration of alternatives. This
planned work is much easier and safer with unit tests.
compute_column_widths() is already independent of any wx code, but it
uses the class that is here renamed and moved outside of a wx-dependent
enclosing class; soon these things will be moved into new source files.
---
wx_table_generator.cpp | 16 ++++++++--------
wx_table_generator.hpp | 8 ++++----
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 58de18e..d5e08c4 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -76,10 +76,10 @@
// - is_clipped(): A clipped column is truncated to fit its allotted
// space. Only elastic columns are clipped--vide supra.
-class wx_table_generator::column_info
+class table_column_info
{
public:
- column_info
+ table_column_info
(std::string const& header
,int width
,oenum_h_align const alignment
@@ -219,7 +219,7 @@ void wx_table_generator::output_headers
std::vector<std::string> headers_by_line(max_header_lines_ *
number_of_columns);
for(std::size_t i = 0; i < number_of_columns; ++i)
{
- column_info const& ci = all_columns().at(i);
+ table_column_info const& ci = all_columns().at(i);
if(ci.is_hidden())
{
continue;
@@ -488,7 +488,7 @@ LMI_ASSERT(std::size_t(h / lh) == 1u +
count_newlines(z.header));
}
all_columns_.push_back
- (column_info
+ (table_column_info
(z.header, width, z.alignment, z.visibility, z.elasticity)
);
}
@@ -497,8 +497,8 @@ LMI_ASSERT(std::size_t(h / lh) == 1u +
count_newlines(z.header));
//
// const total_width_ max table width (page width - page margins)
// mutable column_margin_ spacing on both left and right of column
-// mutable all_columns_ std::vector<column_info>
-// column_info::col_width_ is the only member changed
+// mutable all_columns_ std::vector<table_column_info>
+// table_column_info::col_width_ is the only member changed
//
// column_margin_ and col_width_ are modified here and nowhere else
@@ -719,7 +719,7 @@ void wx_table_generator::do_output_single_row
std::size_t const number_of_columns = all_columns().size();
for(std::size_t i = 0; i < number_of_columns; ++i)
{
- column_info const& ci = all_columns().at(i);
+ table_column_info const& ci = all_columns().at(i);
if(ci.is_hidden())
{
continue;
@@ -841,7 +841,7 @@ int wx_table_generator::column_margin() const
return column_margin_;
}
-std::vector<wx_table_generator::column_info> const&
wx_table_generator::all_columns() const
+std::vector<table_column_info> const& wx_table_generator::all_columns() const
{
return all_columns_;
}
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 99a4dc9..06b061a 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -33,6 +33,8 @@
#include <string>
#include <vector>
+class table_column_info;
+
/// Aggregate of per-column table-generator ctor arguments.
struct column_parameters
@@ -67,8 +69,6 @@ wxColor const illustration_rule_color(0x00, 0x2f, 0x6c);
class wx_table_generator
{
- class column_info;
-
public:
static int const rows_per_group = 5;
@@ -149,7 +149,7 @@ class wx_table_generator
// distinguish access from mutation.
wxDC const& dc() const;
int column_margin() const;
- std::vector<column_info> const& all_columns() const;
+ std::vector<table_column_info> const& all_columns() const;
wxDC& dc_;
@@ -161,7 +161,7 @@ class wx_table_generator
int row_height_;
int column_margin_;
- std::vector<column_info> all_columns_;
+ std::vector<table_column_info> all_columns_;
// Maximal number of lines in any column header, initially 1 but can be
// higher if multiline headers are used.
- [lmi-commits] [lmi] master updated (da8e769 -> caaecd8), Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master e30fcc9 01/10: Transplant code that adds bilateral column margins, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 1430c70 03/10: Consolidate documentation, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 521d3c4 04/10: Improve documentation, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 3b4357b 05/10: Consolidate documentation, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 6d64140 02/10: Rename class wx_table_generator::column_info --> table_column_info,
Greg Chicares <=
- [lmi-commits] [lmi] master caaecd8 10/10: Fix defect introduced 20180723T1356Z: passkey not updated, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master a525e18 08/10: Reformat a block comment, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master 74183c6 09/10: Augment unit test, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master f89e234 06/10: Replace a member with a free function, Greg Chicares, 2018/07/27
- [lmi-commits] [lmi] master f950086 07/10: Split some code into new source files, adding an inchoate unit test, Greg Chicares, 2018/07/27