lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ca3a040 1/3: Remove needless 'unsigned' where


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ca3a040 1/3: Remove needless 'unsigned' where possible
Date: Fri, 8 Jun 2018 19:18:11 -0400 (EDT)

branch: master
commit ca3a040e266be0e0986850dfa7bbc30f42b9789c
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Remove needless 'unsigned' where possible
    
    wxDataView* overriders cannot change unsigned arguments to signed.
---
 census_view.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/census_view.cpp b/census_view.cpp
index 03eb885..7f1e60d 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -736,7 +736,8 @@ renderer_type_converter const& 
renderer_type_converter::get_impl()
 class CensusViewDataViewModel : public wxDataViewIndexListModel
 {
   public:
-    static unsigned int const Col_CellNum = 0;
+    // Cell serial number: always shown in first column.
+    static int const Col_CellNum = 0;
 
     CensusViewDataViewModel(CensusView& view)
         :view_(view)
@@ -750,9 +751,9 @@ class CensusViewDataViewModel : public 
wxDataViewIndexListModel
 
     wxString GetColumnType(unsigned int col) const override;
 
-    std::string const& col_name(unsigned int col) const;
-    any_member<Input>& cell_at(unsigned int row, unsigned int col);
-    any_member<Input> const& cell_at(unsigned int row, unsigned int col) const;
+    std::string const& col_name(int col) const;
+    any_member<Input>& cell_at(int row, int col);
+    any_member<Input> const& cell_at(int row, int col) const;
 
   private:
     std::vector<std::string> const& all_headers() const;
@@ -803,6 +804,7 @@ bool CensusViewDataViewModel::SetValueByRow(wxVariant 
const& variant, unsigned i
 
 unsigned int CensusViewDataViewModel::GetColumnCount() const
 {
+    // "+ 1" for cell serial number in first column.
     return all_headers().size() + 1;
 }
 
@@ -821,18 +823,19 @@ wxString CensusViewDataViewModel::GetColumnType(unsigned 
int col) const
         }
 }
 
-std::string const& CensusViewDataViewModel::col_name(unsigned int col) const
+std::string const& CensusViewDataViewModel::col_name(int col) const
 {
     LMI_ASSERT(0 < col);
+    // "- 1" because first column is cell serial number.
     return all_headers()[col - 1];
 }
 
-inline any_member<Input>& CensusViewDataViewModel::cell_at(unsigned int row, 
unsigned int col)
+inline any_member<Input>& CensusViewDataViewModel::cell_at(int row, int col)
 {
     return view_.cell_parms()[row][col_name(col)];
 }
 
-inline any_member<Input> const& CensusViewDataViewModel::cell_at(unsigned int 
row, unsigned int col) const
+inline any_member<Input> const& CensusViewDataViewModel::cell_at(int row, int 
col) const
 {
     return view_.cell_parms()[row][col_name(col)];
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]