[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 31377a0 3/6: Improve documentation
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 31377a0 3/6: Improve documentation |
Date: |
Tue, 12 Jun 2018 17:50:19 -0400 (EDT) |
branch: master
commit 31377a0962b44ee7915b037f7d18a5640d59c947
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Improve documentation
Coding a couple of N+1/2-pass loops would take fewer characters than the
comment explaining why they're avoided, yet comments are highly unlikely
to introduce defects.
---
census_view.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/census_view.cpp b/census_view.cpp
index a8c6a13..f448e31 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -1789,6 +1789,16 @@ void CensusView::UponPasteCensus(wxCommandEvent&)
/// Never extract "UseDOB": it's always set by UponPasteCensus().
/// Never extract "IssueAge". If it's present, then "UseDOB" must also
/// be, and "UseDOB" preserves information that "IssueAge" loses.
+///
+/// Implementation notes
+///
+/// Output lines use '\t' as a terminator following each field, rather
+/// than as a separator between each pair of fields as might have been
+/// expected; thus, they end in "'t\n". This makes the code slightly
+/// simpler by avoiding a "loop and a half". In practice, it doesn't
+/// make any difference: gnumeric, libreoffice calc, a popular msw
+/// spreadsheet program, and lmi's own UponPasteCensus() all ignore
+/// the extra '\t'.
void CensusView::UponPasteCensusOut(wxCommandEvent&) const
{
@@ -1813,7 +1823,6 @@ void CensusView::UponPasteCensusOut(wxCommandEvent&) const
for(auto const& header : distinct_headers)
{
- // Assume that the trailing '\t' doesn't matter.
os << header << '\t';
}
os << '\n';
@@ -1829,7 +1838,6 @@ void CensusView::UponPasteCensusOut(wxCommandEvent&) const
int z = JdnToYmd(jdn_t(value_cast<int>(s))).value();
s = value_cast<std::string>(z);
}
- // Assume that the trailing '\t' doesn't matter.
os << s << '\t';
}
os << '\n';
- [lmi-commits] [lmi] master updated (a80dbb6 -> d17155c), Greg Chicares, 2018/06/12
- [lmi-commits] [lmi] master 270d295 1/6: Purge a vestige of unsignedness from a comment, Greg Chicares, 2018/06/12
- [lmi-commits] [lmi] master 31377a0 3/6: Improve documentation,
Greg Chicares <=
- [lmi-commits] [lmi] master dd0e779 2/6: Move and rename a member function, Greg Chicares, 2018/06/12
- [lmi-commits] [lmi] master d17155c 6/6: Reimplement column_value_varies_across_cells(), Greg Chicares, 2018/06/12
- [lmi-commits] [lmi] master c9d6ebc 5/6: Add UponPasteCensusOut() to event table, Greg Chicares, 2018/06/12
- [lmi-commits] [lmi] master 8fc8f97 4/6: Rename a member function, Greg Chicares, 2018/06/12