[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] (no subject)
From: |
Greg Chicares |
Subject: |
[lmi-commits] (no subject) |
Date: |
Thu, 2 Jun 2016 22:12:46 +0000 (UTC) |
branch: master
commit b5004c3ab7d24a8b1b450adbfd0243a7437aafe5
Author: Gregory W. Chicares <address@hidden>
Date: Thu Jun 2 22:09:23 2016 +0000
Resolve marked defect: empty columns are not "magical" [448]
There is nothing defective or magical about a const string in an
unnamed namespace.
---
preferences_model.cpp | 22 +++++-----------------
wx_test_calculation_summary.cpp | 10 +++++-----
2 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/preferences_model.cpp b/preferences_model.cpp
index 9ec619d..f14ce6e 100644
--- a/preferences_model.cpp
+++ b/preferences_model.cpp
@@ -37,23 +37,11 @@
namespace
{
-// TODO ?? CALCULATION_SUMMARY Evgeniy has asked:
-// what is the proper way to retrieve the magic "[none]" value?
-//
-// Answer: I guess I'd clone some similar code, like
-// configuration_filename() in 'configurable_settings.cpp', just for
-// consistency; and then, what is most important, search for every use
-// of that string in every other module and replace them all with
-// calls to a function like that--which therefore might belong in some
-// other module.
-//
-// However, it would be even better to reimplement this class to
-// configure every data member in class configurable_settings, and
+// Empty columns: it would be even better to reimplement this class to
// store the twelve instances of mce_report_column here the same way
-// that class 'Input' stores its twelve in its xml file. Then the
-// whole issue would vanish.
+// that class 'Input' stores its twelve in its xml file.
-std::string magic_null_column_name("[none]");
+std::string const empty_column_name("[none]");
/// Does a member name nominate a calculation-summary column?
@@ -235,7 +223,7 @@ void PreferencesModel::Load()
}
if(columns.size() <= i)
{
- operator[](name) = magic_null_column_name;
+ operator[](name) = empty_column_name;
}
else
{
@@ -262,7 +250,7 @@ std::string PreferencesModel::string_of_column_names() const
continue;
}
std::string const column = operator[](*i).str();
- if(column != magic_null_column_name)
+ if(column != empty_column_name)
{
oss << column << " ";
}
diff --git a/wx_test_calculation_summary.cpp b/wx_test_calculation_summary.cpp
index be253ef..d13e654 100644
--- a/wx_test_calculation_summary.cpp
+++ b/wx_test_calculation_summary.cpp
@@ -75,7 +75,7 @@ std::size_t const number_of_custom_columns
// Special name used when the column is not used at all. This is the same
// string used in preferences_model.cpp, but we duplicate it here as we don't
// have access to it.
-char const* const magic_null_column_name = "[none]";
+char const* const empty_column_name = "[none]";
// Total number of configurable summary columns. This, again, duplicates the
// number [implicitly] used in preferences_model.cpp.
@@ -323,7 +323,7 @@ LMI_WX_TEST_CASE(calculation_summary)
}
else
{
- LMI_ASSERT_EQUAL(column, magic_null_column_name);
+ LMI_ASSERT_EQUAL(column, empty_column_name);
}
}
@@ -347,7 +347,7 @@ LMI_WX_TEST_CASE(calculation_summary)
for(unsigned n = 0; n < total_number_of_columns; ++n)
{
focus_column_combobox(n);
- ui.Select(n == 2 ? "NewCashLoan" : magic_null_column_name);
+ ui.Select(n == 2 ? "NewCashLoan" : empty_column_name);
}
return wxID_OK;
@@ -379,7 +379,7 @@ LMI_WX_TEST_CASE(calculation_summary)
{
LMI_ASSERT_EQUAL
(focus_column_combobox(n)->GetValue()
- ,magic_null_column_name
+ ,empty_column_name
);
}
@@ -414,7 +414,7 @@ LMI_WX_TEST_CASE(calculation_summary)
{
LMI_ASSERT_EQUAL
(focus_column_combobox(n)->GetValue()
- ,magic_null_column_name
+ ,empty_column_name
);
}