[gtkmm] Change all operator void* to operator const void*.



commit 4a3529a840a73171fc601a22b8af2b72b51fd70c
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Apr 4 10:20:22 2011 +0200

    Change all operator void* to operator const void*.
    
    * gtk/gtkmm/stockid.[h|cc]:
    * gtk/src/iconinfo.[hg|ccg]:
    * gtk/src/papersize.[hg|ccg]:
    * gtk/src/recentinfo.[hg|ccg]:
    * gtk/src/textiter.[hg|ccg]:
    * gtk/src/treeiter.hg:
    * gtk/src/treepath.[hg|ccg]:
    * gtk/src/treerowreference.[hg|ccg]: Daniel Elstner suggested this.
    He also has some concern about the C-style casts, but we are talking about it.

 ChangeLog                    |   20 +++++++++++++++++---
 gtk/gtkmm/stockid.cc         |    4 ++--
 gtk/gtkmm/stockid.h          |    2 +-
 gtk/src/iconinfo.ccg         |    4 ++--
 gtk/src/iconinfo.hg          |    2 +-
 gtk/src/papersize.ccg        |    6 +++---
 gtk/src/papersize.hg         |    2 +-
 gtk/src/recentinfo.ccg       |    4 ++--
 gtk/src/recentinfo.hg        |    2 +-
 gtk/src/textiter.hg          |    6 +++---
 gtk/src/treeiter.ccg         |    8 ++++----
 gtk/src/treeiter.hg          |    6 +++---
 gtk/src/treepath.ccg         |    4 ++--
 gtk/src/treepath.hg          |    2 +-
 gtk/src/treerowreference.ccg |    4 ++--
 gtk/src/treerowreference.hg  |    2 +-
 16 files changed, 46 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da47731..df253cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-04-04  Murray Cumming  <murrayc murrayc com>
+
+	Change all operator void* to operator const void*.
+
+	* gtk/gtkmm/stockid.[h|cc]:
+	* gtk/src/iconinfo.[hg|ccg]:
+	* gtk/src/papersize.[hg|ccg]:
+	* gtk/src/recentinfo.[hg|ccg]:
+	* gtk/src/textiter.[hg|ccg]:
+	* gtk/src/treeiter.hg:
+	* gtk/src/treepath.[hg|ccg]:
+	* gtk/src/treerowreference.[hg|ccg]: Daniel Elstner suggested this.
+	He also has some concern about the C-style casts, but we are talking about it.
+
 2011-04-01  Murray Cumming  <murrayc murrayc com>
 
 	Replace all operator bool() with operator void*().
@@ -9,9 +23,9 @@
 	* gtk/src/textiter.[hg|ccg]:
 	* gtk/src/treeiter.hg:
 	* gtk/src/treepath.[hg|ccg]:
-	* gtk/src/treerowreference.[hg|ccg]: Use operator void*() instead of 
-	operator bool() because this avoids an implicit conversion to int instead of 
-	bool. This is apparently generally considered a good thing. Daniel Elstner 
+	* gtk/src/treerowreference.[hg|ccg]: Use operator void*() instead of
+	operator bool() because this avoids an implicit conversion to int instead of
+	bool. This is apparently generally considered a good thing. Daniel Elstner
 	mentioned this at some point in the last year or so too.
 
 2011-03-26  Kalev Lember  <kalev smartlink ee>
diff --git a/gtk/gtkmm/stockid.cc b/gtk/gtkmm/stockid.cc
index d2bae1c..54571ec 100644
--- a/gtk/gtkmm/stockid.cc
+++ b/gtk/gtkmm/stockid.cc
@@ -59,9 +59,9 @@ StockID& StockID::operator=(const StockID& other)
   return *this;
 }
 
-StockID::operator void*() const
+StockID::operator const void*() const
 {
-  return (void*)!(id_.empty());
+  return (const void*)!(id_.empty());
 }
   
 bool StockID::equal(const StockID& rhs) const
diff --git a/gtk/gtkmm/stockid.h b/gtk/gtkmm/stockid.h
index 4de1f64..1d46dbc 100644
--- a/gtk/gtkmm/stockid.h
+++ b/gtk/gtkmm/stockid.h
@@ -70,7 +70,7 @@ public:
 
   /** Tests whether the StockID is not empty.
    */
-  operator void*() const;
+  operator const void*() const;
 
   /** Check if two StockIDs are equal.
    * @param rhs Another StockID.
diff --git a/gtk/src/iconinfo.ccg b/gtk/src/iconinfo.ccg
index 12e1aae..70a8348 100644
--- a/gtk/src/iconinfo.ccg
+++ b/gtk/src/iconinfo.ccg
@@ -41,9 +41,9 @@ std::vector<Gdk::Point> IconInfo::get_attach_points() const
   return std::vector<Gdk::Point> ();
 }
 
-IconInfo::operator void*() const
+IconInfo::operator const void*() const
 {
-  return (void*)(gobj() != 0);
+  return (const void*)(gobj() != 0);
 }
 
 
diff --git a/gtk/src/iconinfo.hg b/gtk/src/iconinfo.hg
index ccc2129..820b8a7 100644
--- a/gtk/src/iconinfo.hg
+++ b/gtk/src/iconinfo.hg
@@ -42,7 +42,7 @@ public:
   _IGNORE(gtk_icon_info_new_for_pixbuf)
 
   ///Tests whether the IconInfo is valid.
-  operator void*() const;
+  operator const void*() const;
 
   _WRAP_METHOD(int get_base_size() const, gtk_icon_info_get_base_size)
   _WRAP_METHOD(Glib::ustring get_filename() const, gtk_icon_info_get_filename)
diff --git a/gtk/src/papersize.ccg b/gtk/src/papersize.ccg
index e61fd55..3dce4e3 100644
--- a/gtk/src/papersize.ccg
+++ b/gtk/src/papersize.ccg
@@ -49,7 +49,7 @@ PaperSize::PaperSize(const Glib::ustring& name, const Glib::ustring& display_nam
                                      GtkUnit(unit)))
 {}
 
-//TODO: Add an operator void*() so we can detect if this succeeded:
+//TODO: Add an operator const void*() so we can detect if this succeeded:
 //TODO: No, throw the error/exception instead.
 PaperSize::PaperSize(const Glib::KeyFile& key_file, const Glib::ustring& group_name)
 :
@@ -62,9 +62,9 @@ bool PaperSize::equal(const PaperSize& other) const
                                                     const_cast<GtkPaperSize*>(other.gobj()))));
 }
 
-PaperSize::operator void*() const
+PaperSize::operator const void*() const
 {
-  return (void*)(gobj() != 0);
+  return (const void*)(gobj() != 0);
 }
 
 void PaperSize::save_to_key_file(Glib::KeyFile& key_file)
diff --git a/gtk/src/papersize.hg b/gtk/src/papersize.hg
index 6021721..eff6304 100644
--- a/gtk/src/papersize.hg
+++ b/gtk/src/papersize.hg
@@ -71,7 +71,7 @@ public:
   /** Returns true if the PaperSize is a valid object.
    * @newin{2,12}
    */
-  operator void*() const;
+  operator const void*() const;
 
   #m4 _CONVERSION(`GList*', `std::vector<PaperSize>',`Glib::ListHandler<PaperSize, PaperSizeTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(static std::vector<PaperSize> get_paper_sizes(bool include_custom = true), gtk_paper_size_get_paper_sizes)
diff --git a/gtk/src/recentinfo.ccg b/gtk/src/recentinfo.ccg
index ddc8f5f..f725016 100644
--- a/gtk/src/recentinfo.ccg
+++ b/gtk/src/recentinfo.ccg
@@ -22,9 +22,9 @@
 namespace Gtk
 {
 
-RecentInfo::operator void*() const
+RecentInfo::operator const void*() const
 {
-  return (void*)(gobj() != 0);
+  return (const void*)(gobj() != 0);
 }
 
 std::vector<Glib::ustring> RecentInfo::get_applications() const
diff --git a/gtk/src/recentinfo.hg b/gtk/src/recentinfo.hg
index 8f93559..cc37ea1 100644
--- a/gtk/src/recentinfo.hg
+++ b/gtk/src/recentinfo.hg
@@ -53,7 +53,7 @@ public:
 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
 //# if (!defined(GTKMM_DISABLE_DEPRECATED) || defined(GTKMM_COMPILATION))
   /// Tests whether the RecentInfo is valid.
-  operator void*() const;
+  operator const void*() const;
 //# endif
 //#endif
 
diff --git a/gtk/src/textiter.hg b/gtk/src/textiter.hg
index 513808e..1cef6f6 100644
--- a/gtk/src/textiter.hg
+++ b/gtk/src/textiter.hg
@@ -76,7 +76,7 @@ public:
   inline value_type operator*() const;
 
   /** Alias for !is_end(). */
-  inline operator void*() const;
+  inline operator const void*() const;
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 
@@ -325,9 +325,9 @@ TextIter::value_type TextIter::operator*() const
 }
 
 inline
-TextIter::operator void*() const
+TextIter::operator const void*() const
 {
-  return (void*)!is_end();
+  return (const void*)!is_end();
 }
 
 template <class Predicate>
diff --git a/gtk/src/treeiter.ccg b/gtk/src/treeiter.ccg
index 8f9e3f8..de469b4 100644
--- a/gtk/src/treeiter.ccg
+++ b/gtk/src/treeiter.ccg
@@ -137,12 +137,12 @@ bool TreeIter::equal(const TreeIter& other) const
          (gobject_.user_data3 == other.gobject_.user_data3);
 }
 
-TreeIter::operator void*() const
+TreeIter::operator const void*() const
 {
   // Test whether the GtkTreeIter is valid and not an end iterator.  This check
   // is almost the same as the private VALID_ITER() macro in gtkliststore.c and
   // gtktreestore.c.
-  return (void*)(!is_end_ && gobject_.stamp != 0);
+  return (const void*)(!is_end_ && gobject_.stamp != 0);
 }
 
 void TreeIter::setup_end_iterator(const TreeIter& last_valid)
@@ -215,9 +215,9 @@ void TreeRow::get_value_impl(int column, Glib::ValueBase& value) const
   model_->get_value_impl(*this, column, value);
 }
 
-TreeRow::operator void*() const
+TreeRow::operator const void*() const
 {
-  return (void*)TreeIter::operator void*();
+  return TreeIter::operator const void*();
 }
 
 
diff --git a/gtk/src/treeiter.hg b/gtk/src/treeiter.hg
index 6eb096f..007291d 100644
--- a/gtk/src/treeiter.hg
+++ b/gtk/src/treeiter.hg
@@ -120,7 +120,7 @@ public:
 
   /** Discover whether the iterator is valid, and not equal to end().
    */
-  operator void*() const;
+  operator const void*() const;
 
   /** This is only useful when implementing a custom Gtk::TreeModel class.
    * Compare the iterator's stamp with your model's stamp to discover whether it is valid.
@@ -288,7 +288,7 @@ public:
 
   /** Discover whether this is a valid row.
    */
-  operator void*() const;
+  operator const void*() const;
 
   /// Provides access to the underlying C GObject.  
   GtkTreeIter*       gobj()       { return TreeIter::gobj(); }
@@ -349,7 +349,7 @@ public:
 
   size_type size() const;
   bool empty() const;
-  operator void*() const { return (void*)!empty(); }
+  operator const void*() const { return (const void*)!empty(); }
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 
diff --git a/gtk/src/treepath.ccg b/gtk/src/treepath.ccg
index 358f832..2d8f960 100644
--- a/gtk/src/treepath.ccg
+++ b/gtk/src/treepath.ccg
@@ -63,9 +63,9 @@ TreePath::size_type TreePath::size() const
   return gtk_tree_path_get_depth(gobject_);
 }
 
-TreePath::operator void*() const
+TreePath::operator const void*() const
 {
-  return (void*)!empty();
+  return (const void*)!empty();
 }
 
 bool TreePath::empty() const
diff --git a/gtk/src/treepath.hg b/gtk/src/treepath.hg
index 3c3b6a8..c9ecb7a 100644
--- a/gtk/src/treepath.hg
+++ b/gtk/src/treepath.hg
@@ -86,7 +86,7 @@ public:
   /** Checks that the path is not empty, by calling empty().
    * @newin{2,16}
    */
-  operator void*() const;
+  operator const void*() const;
 
   template <class In> inline void assign(In pbegin, In pend);
   template <class In>        void append(In pbegin, In pend);
diff --git a/gtk/src/treerowreference.ccg b/gtk/src/treerowreference.ccg
index d12c220..4167ebb 100644
--- a/gtk/src/treerowreference.ccg
+++ b/gtk/src/treerowreference.ccg
@@ -29,9 +29,9 @@ TreeRowReference::TreeRowReference(const Glib::RefPtr<TreeModel>& model, const T
   gobject_ ( gtk_tree_row_reference_new(model->gobj(), const_cast<GtkTreePath*>(path.gobj())) )
 {}
 
-TreeRowReference::operator void*() const
+TreeRowReference::operator const void*() const
 {
-  return (void*)is_valid();
+  return (const void*)is_valid();
 }
 
 } // namespace Gtk
diff --git a/gtk/src/treerowreference.hg b/gtk/src/treerowreference.hg
index 465804c..3736b3a 100644
--- a/gtk/src/treerowreference.hg
+++ b/gtk/src/treerowreference.hg
@@ -40,7 +40,7 @@ public:
   TreeRowReference(const Glib::RefPtr<TreeModel>& model, const TreeModel::Path& path);
 
   ///The same as is_valid().
-  operator void*() const;
+  operator const void*() const;
 
   _WRAP_METHOD(TreeModel::Path get_path() const,  gtk_tree_row_reference_get_path)
 



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