[gtkmm-documentation] exampletreemode: signed/unsigned correction to allow use of auto.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] exampletreemode: signed/unsigned correction to allow use of auto.
- Date: Fri, 17 Mar 2017 15:40:39 +0000 (UTC)
commit a920709ffd1dfbb68094131ef8b20f7c0e77875e
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 17 16:40:23 2017 +0100
exampletreemode: signed/unsigned correction to allow use of auto.
.../others/treemodelcustom/exampletreemodel.cc | 14 +++++++-------
examples/others/treemodelcustom/exampletreemodel.h | 6 +++---
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/examples/others/treemodelcustom/exampletreemodel.cc
b/examples/others/treemodelcustom/exampletreemodel.cc
index 7f6d1be..818697e 100644
--- a/examples/others/treemodelcustom/exampletreemodel.cc
+++ b/examples/others/treemodelcustom/exampletreemodel.cc
@@ -19,12 +19,12 @@
#include <iostream>
#include "exampletreemodel.h"
-ExampleTreeModel::GlueItem::GlueItem(int row_number)
+ExampleTreeModel::GlueItem::GlueItem(std::size_t row_number)
: m_row_number(row_number)
{
}
-int ExampleTreeModel::GlueItem::get_row_number() const
+std::size_t ExampleTreeModel::GlueItem::get_row_number() const
{
return m_row_number;
}
@@ -149,7 +149,7 @@ bool ExampleTreeModel::iter_next_vfunc(const iterator& iter, iterator& iter_next
//Get the current row:
const auto pItem = (const GlueItem*)iter.gobj()->user_data;
- typeListOfRows::size_type row_index = pItem->get_row_number();
+ auto row_index = pItem->get_row_number();
//Make the iter_next GtkTreeIter represent the next row:
row_index++;
@@ -215,7 +215,7 @@ bool ExampleTreeModel::iter_nth_root_child_vfunc(int n, iterator& iter) const
//Store the row_index in the GtkTreeIter:
//See also iter_next_vfunc()
- unsigned row_index = n;
+ const auto row_index = n;
//This will be deleted in the GlueList destructor, when old iterators are marked as invalid.
auto pItem = new GlueItem(row_index);
@@ -272,7 +272,7 @@ bool ExampleTreeModel::get_iter_vfunc(const Path& path, iterator& iter) const
//See also iter_next_vfunc()
//TODO: Store a pointer to some more complex data type such as a typeListOfRows::iterator.
- unsigned row_index = path[0];
+ const auto row_index = path[0];
auto pItem = new GlueItem(row_index);
//Store the GlueItem in the GtkTreeIter.
@@ -296,7 +296,7 @@ ExampleTreeModel::typeListOfRows::iterator ExampleTreeModel::get_data_row_iter_f
//Don't call this on an invalid iter.
const auto pItem = (const GlueItem*)iter.gobj()->user_data;
- typeListOfRows::size_type row_index = pItem->get_row_number();
+ const auto row_index = pItem->get_row_number();
if( row_index > m_rows.size() )
return m_rows.end();
else
@@ -308,7 +308,7 @@ ExampleTreeModel::typeListOfRows::const_iterator ExampleTreeModel::get_data_row_
//Don't call this on an invalid iter.
const auto pItem = (const GlueItem*)iter.gobj()->user_data;
- typeListOfRows::size_type row_index = pItem->get_row_number();
+ const auto row_index = pItem->get_row_number();
if( row_index > m_rows.size() )
return m_rows.end();
else
diff --git a/examples/others/treemodelcustom/exampletreemodel.h
b/examples/others/treemodelcustom/exampletreemodel.h
index 46f3bc3..bc250e3 100644
--- a/examples/others/treemodelcustom/exampletreemodel.h
+++ b/examples/others/treemodelcustom/exampletreemodel.h
@@ -70,11 +70,11 @@ private:
class GlueItem
{
public:
- GlueItem(int row_number);
- int get_row_number() const;
+ explicit GlueItem(std::size_t row_number);
+ std::size_t get_row_number() const;
protected:
- int m_row_number;
+ std::size_t m_row_number;
};
//Allow the GlueList inner class to access the declaration of the GlueItem inner class.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]