[gtkmm] Demos, tests: Use nullptr instead of 0



commit 2ba3bfa14ae5d6ab75ed164a3a69dfb595e54a16
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Dec 10 10:54:27 2015 +0100

    Demos, tests: Use nullptr instead of 0

 demos/gtk-demo/demos.h                   |   54 +++++++++++++++---------------
 demos/gtk-demo/demowindow.cc             |    6 ++--
 demos/gtk-demo/example_builder.cc        |    4 +-
 demos/gtk-demo/example_change_display.cc |    4 +-
 demos/gtk-demo/example_glarea.cc         |    2 +-
 demos/gtk-demo/example_menus.cc          |    2 +-
 demos/gtk-demo/textwidget.cc             |   16 ++++----
 tests/builder/main.cc                    |   10 +++---
 tests/delete_cpp_child/main.cc           |    2 +-
 tests/dialog/main.cc                     |    2 +-
 10 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/demos/gtk-demo/demos.h b/demos/gtk-demo/demos.h
index bbe1e3b..50e20a5 100644
--- a/demos/gtk-demo/demos.h
+++ b/demos/gtk-demo/demos.h
@@ -43,38 +43,38 @@ Gtk::Window* do_treeview_treestore();
 
 Demo child0[] =
 {
-  { "Editable Cells", "example_treeview_editable_cells.cc", sigc::ptr_fun(&do_treeview_editable_cells), 0 },
-  { "List Store", "example_treeview_liststore.cc", sigc::ptr_fun(&do_treeview_liststore), 0 },
-  { "Tree Store", "example_treeview_treestore.cc", sigc::ptr_fun(&do_treeview_treestore), 0 },
-  { 0, 0, type_slotDo(), 0 }
+  { "Editable Cells", "example_treeview_editable_cells.cc", sigc::ptr_fun(&do_treeview_editable_cells), 
nullptr },
+  { "List Store", "example_treeview_liststore.cc", sigc::ptr_fun(&do_treeview_liststore), nullptr },
+  { "Tree Store", "example_treeview_treestore.cc", sigc::ptr_fun(&do_treeview_treestore), nullptr },
+  { nullptr, nullptr, type_slotDo(), nullptr }
 };
 
 Demo testgtk_demos[] =
 {
-  { "Application main window", "example_appwindow.cc", sigc::ptr_fun(&do_appwindow), 0 },
-  { "Builder", "example_builder.cc", sigc::ptr_fun(&do_builder), 0 },
-  { "Button Boxes", "example_buttonbox.cc",  sigc::ptr_fun(&do_buttonbox), 0 },
-  { "Change Display", "example_change_display.cc", sigc::ptr_fun(&do_change_display), 0 },
-  { "Color Selector", "example_colorsel.cc", sigc::ptr_fun(&do_colorsel), 0 },
-  { "Dialog and Message Boxes", "example_dialog.cc", sigc::ptr_fun(&do_dialog), 0 },
-  { "Drawing Area", "example_drawingarea.cc", sigc::ptr_fun(&do_drawingarea), 0 },
-  { "Flow Box", "example_flowbox.cc",  sigc::ptr_fun(&do_flowbox), 0 },
-  { "Gestures", "example_gestures.cc",  sigc::ptr_fun(&do_gestures), 0 },
-  { "Header Bar", "example_headerbar.cc",  sigc::ptr_fun(&do_headerbar), 0 },
-  { "Icon Browser", "example_iconbrowser.cc", sigc::ptr_fun(&do_iconbrowser), 0 },
-  { "Icon View", "example_iconview.cc", sigc::ptr_fun(&do_iconview), 0 },
-  { "Images", "example_images.cc", sigc::ptr_fun(&do_images), 0 },
-  { "Menus", "example_menus.cc", sigc::ptr_fun(&do_menus), 0 },
-  { "OpenGL Area", "example_glarea.cc", sigc::ptr_fun(&do_glarea), 0 },
-  { "Overlay", "example_overlay.cc", sigc::ptr_fun(&do_overlay), 0 },
-  { "Paned Widgets", "example_panes.cc", sigc::ptr_fun(&do_panes), 0 },
-  { "Pixbufs", "example_pixbufs.cc", sigc::ptr_fun(&do_pixbufs), 0 },
-  { "Size Groups", "example_sizegroup.cc", sigc::ptr_fun(&do_sizegroup), 0 },
-  { "Stack", "example_stack.cc", sigc::ptr_fun(&do_stack), 0 },
-  { "Stack Sidebar", "example_stacksidebar.cc", sigc::ptr_fun(&do_stacksidebar), 0 },
-  { "Text Widget", "example_textview.cc", sigc::ptr_fun(&do_textview), 0 },
+  { "Application main window", "example_appwindow.cc", sigc::ptr_fun(&do_appwindow), nullptr },
+  { "Builder", "example_builder.cc", sigc::ptr_fun(&do_builder), nullptr },
+  { "Button Boxes", "example_buttonbox.cc",  sigc::ptr_fun(&do_buttonbox), nullptr },
+  { "Change Display", "example_change_display.cc", sigc::ptr_fun(&do_change_display), nullptr },
+  { "Color Selector", "example_colorsel.cc", sigc::ptr_fun(&do_colorsel), nullptr },
+  { "Dialog and Message Boxes", "example_dialog.cc", sigc::ptr_fun(&do_dialog), nullptr },
+  { "Drawing Area", "example_drawingarea.cc", sigc::ptr_fun(&do_drawingarea), nullptr },
+  { "Flow Box", "example_flowbox.cc",  sigc::ptr_fun(&do_flowbox), nullptr },
+  { "Gestures", "example_gestures.cc",  sigc::ptr_fun(&do_gestures), nullptr },
+  { "Header Bar", "example_headerbar.cc",  sigc::ptr_fun(&do_headerbar), nullptr },
+  { "Icon Browser", "example_iconbrowser.cc", sigc::ptr_fun(&do_iconbrowser), nullptr },
+  { "Icon View", "example_iconview.cc", sigc::ptr_fun(&do_iconview), nullptr },
+  { "Images", "example_images.cc", sigc::ptr_fun(&do_images), nullptr },
+  { "Menus", "example_menus.cc", sigc::ptr_fun(&do_menus), nullptr },
+  { "OpenGL Area", "example_glarea.cc", sigc::ptr_fun(&do_glarea), nullptr },
+  { "Overlay", "example_overlay.cc", sigc::ptr_fun(&do_overlay), nullptr },
+  { "Paned Widgets", "example_panes.cc", sigc::ptr_fun(&do_panes), nullptr },
+  { "Pixbufs", "example_pixbufs.cc", sigc::ptr_fun(&do_pixbufs), nullptr },
+  { "Size Groups", "example_sizegroup.cc", sigc::ptr_fun(&do_sizegroup), nullptr },
+  { "Stack", "example_stack.cc", sigc::ptr_fun(&do_stack), nullptr },
+  { "Stack Sidebar", "example_stacksidebar.cc", sigc::ptr_fun(&do_stacksidebar), nullptr },
+  { "Text Widget", "example_textview.cc", sigc::ptr_fun(&do_textview), nullptr },
   { "Tree View", "", type_slotDo(), child0 },
-  { 0, 0, type_slotDo(), 0 }
+  { nullptr, nullptr, type_slotDo(), nullptr }
 };
 
 #endif //_DEMOS_H
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index b88a159..4da2ecf 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -161,7 +161,7 @@ DemoWindow::~DemoWindow()
 
 void DemoWindow::on_run_button_clicked()
 {
-  if(m_pWindow_Example == 0) //Don't open a second window.
+  if(m_pWindow_Example == nullptr) //Don't open a second window.
   {
     if(const Gtk::TreeModel::iterator iter = m_refTreeSelection->get_selected())
     {
@@ -176,7 +176,7 @@ void DemoWindow::on_treeview_row_activated(const Gtk::TreeModel::Path& path, Gtk
 {
   m_TreePath = path;
 
-  if(m_pWindow_Example == 0) //Don't open a second window.
+  if(m_pWindow_Example == nullptr) //Don't open a second window.
   {
     if(const Gtk::TreeModel::iterator iter = m_TreeView.get_model()->get_iter(m_TreePath))
     {
@@ -411,7 +411,7 @@ void DemoWindow::add_data_tabs(const std::string& filename)
       }
       gsize data_size = 0;
       const char* data = static_cast<const char*>(bytes->get_data(data_size));
-      if (g_utf8_validate(data, data_size, 0))
+      if (g_utf8_validate(data, data_size, nullptr))
       {
         // Looks like it parses as text. Dump it into a TextWidget then!
         TextWidget* textwidget = new TextWidget(false);
diff --git a/demos/gtk-demo/example_builder.cc b/demos/gtk-demo/example_builder.cc
index 1b68be6..6609ace 100644
--- a/demos/gtk-demo/example_builder.cc
+++ b/demos/gtk-demo/example_builder.cc
@@ -34,7 +34,7 @@ Gtk::Window* do_builder()
   catch (const Glib::Error& error)
   {
     std::cout << "Error loading example_builder.ui: " << error.what() << std::endl;
-    return 0;
+    return nullptr;
   }
 
   // Get the GtkBuilder-instantiated window:
@@ -43,7 +43,7 @@ Gtk::Window* do_builder()
   if (!pWindow)
   {
     std::cout << "Could not get 'window1' from the builder." << std::endl;
-    return 0;
+    return nullptr;
   }
   return pWindow;
 }
diff --git a/demos/gtk-demo/example_change_display.cc b/demos/gtk-demo/example_change_display.cc
index 0cd506b..100c480 100644
--- a/demos/gtk-demo/example_change_display.cc
+++ b/demos/gtk-demo/example_change_display.cc
@@ -104,7 +104,7 @@ Example_ChangeDisplay::Example_ChangeDisplay()
   m_Frame_Display("Display"),
   m_ButtonBox_Display(Gtk::ORIENTATION_VERTICAL, 5),
   m_Button_Display_Open("_Open...", true), m_Button_Display_Close("_Close...", true),
-  m_pPopup(0),
+  m_pPopup(nullptr),
   m_popup_clicked(false)
 {
   add_button("_Close", Gtk::RESPONSE_CLOSE);
@@ -359,7 +359,7 @@ Gtk::Widget* Example_ChangeDisplay::find_toplevel_at_pointer(const Glib::RefPtr<
   }
   */
 
-  return 0;
+  return nullptr;
 }
 
 
diff --git a/demos/gtk-demo/example_glarea.cc b/demos/gtk-demo/example_glarea.cc
index 4baf3ff..53626fd 100644
--- a/demos/gtk-demo/example_glarea.cc
+++ b/demos/gtk-demo/example_glarea.cc
@@ -382,7 +382,7 @@ void Example_GLArea::draw_triangle()
 
   glBindBuffer(GL_ARRAY_BUFFER, m_Vao);
   glEnableVertexAttribArray(0);
-  glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
+  glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, nullptr);
 
   glDrawArrays(GL_TRIANGLES, 0, 3);
 
diff --git a/demos/gtk-demo/example_menus.cc b/demos/gtk-demo/example_menus.cc
index d19f1e5..04a49a5 100644
--- a/demos/gtk-demo/example_menus.cc
+++ b/demos/gtk-demo/example_menus.cc
@@ -134,7 +134,7 @@ Example_Menus::~Example_Menus()
 Gtk::Menu* Example_Menus::create_menu(gint depth)
 {
   if (depth < 1)
-    return 0;
+    return nullptr;
 
   Gtk::Menu* pMenu = Gtk::manage(new Gtk::Menu());
 
diff --git a/demos/gtk-demo/textwidget.cc b/demos/gtk-demo/textwidget.cc
index 089860a..cf80cb5 100644
--- a/demos/gtk-demo/textwidget.cc
+++ b/demos/gtk-demo/textwidget.cc
@@ -116,7 +116,7 @@ static const char* tokens[] =
 {
   "/*",
   "\"",
-  NULL
+  nullptr
 };
 
 static const char* types[] =
@@ -164,7 +164,7 @@ static const char* types[] =
   "GdkPixbuf ",
   "GError",
   "size_t",
-  0
+  nullptr
 };
 
 static const char* control[] =
@@ -178,7 +178,7 @@ static const char* control[] =
   ":",
   "return ",
   "goto ",
-  0
+  nullptr
 };
 
 typedef const char* constpch;
@@ -244,7 +244,7 @@ parse_chars (constpch text,
   }
   
   /* check for types */
-  for (i = 0; types[i] != 0; i++)
+  for (i = 0; types[i] != nullptr; i++)
     if (!strncmp (text, types[i], strlen (types[i])))
     {
       *end_ptr = text + strlen (types[i]);
@@ -253,7 +253,7 @@ parse_chars (constpch text,
     }
 
   /* check for control */
-  for (i = 0; control[i] != 0; i++)
+  for (i = 0; control[i] != nullptr; i++)
     if (!strncmp (text, control[i], strlen (control[i])))
     {
       *end_ptr = text + strlen (control[i]);
@@ -287,7 +287,7 @@ parse_chars (constpch text,
   }
 
   /* not at the start of a tag.  Find the next one. */
-  for (i = 0; tokens[i] != 0; i++)
+  for (i = 0; tokens[i] != nullptr; i++)
   {
     next_token = strstr (text, tokens[i]);
     if (next_token)
@@ -299,7 +299,7 @@ parse_chars (constpch text,
     }
   }
 
-  for (i = 0; types[i] != 0; i++)
+  for (i = 0; types[i] != nullptr; i++)
   {
     next_token = strstr (text, types[i]);
     if (next_token)
@@ -311,7 +311,7 @@ parse_chars (constpch text,
     }
   }
 
-  for (i = 0; control[i] != 0; i++)
+  for (i = 0; control[i] != nullptr; i++)
   {
     next_token = strstr (text, control[i]);
     if (next_token)
diff --git a/tests/builder/main.cc b/tests/builder/main.cc
index c9c1ac1..f3c7f8a 100644
--- a/tests/builder/main.cc
+++ b/tests/builder/main.cc
@@ -79,13 +79,13 @@ const char gladefile[] =
 void* on_managed_button_deleted(void* /* data */)
 {
   std::cout << "Gtk::Button in window deleted" << std::endl;
-  return 0;
+  return nullptr;
 }
 
 void* on_orphaned_button_deleted(void* /* data */)
 {
   std::cout << "Orphaned Gtk::Button deleted" << std::endl;
-  return 0;
+  return nullptr;
 }
 
 class DerivedButton : public Gtk::Button
@@ -107,7 +107,7 @@ class MainWindow : public Gtk::Window
 {
 public:
   MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refBuilder)
-  : Gtk::Window(cobject), m_pDerivedButton(0), m_pStandardButton(0)
+  : Gtk::Window(cobject), m_pDerivedButton(nullptr), m_pStandardButton(nullptr)
   {
     std::cout << "MainWindow::ctor" << std::endl;
 
@@ -117,7 +117,7 @@ public:
     refBuilder->get_widget("standard_button", m_pStandardButton);
     refBuilder->get_widget("standard_button", m_pStandardButton);
 
-    m_pStandardButton->add_destroy_notify_callback(0, on_managed_button_deleted);
+    m_pStandardButton->add_destroy_notify_callback(nullptr, on_managed_button_deleted);
   }
 
   virtual ~MainWindow()
@@ -157,7 +157,7 @@ int main(int argc, char* argv[])
 
   Gtk::Button* orph_button = nullptr;
   builder->get_widget("orphaned_button", orph_button);
-  orph_button->add_destroy_notify_callback(0, on_orphaned_button_deleted);
+  orph_button->add_destroy_notify_callback(nullptr, on_orphaned_button_deleted);
 
   const GObject* const window = (GObject*)main_win->gobj();
   const GObject* const orphaned_button = (GObject*)orph_button->gobj();
diff --git a/tests/delete_cpp_child/main.cc b/tests/delete_cpp_child/main.cc
index bd507b6..c2e0eb1 100644
--- a/tests/delete_cpp_child/main.cc
+++ b/tests/delete_cpp_child/main.cc
@@ -17,7 +17,7 @@ private:
 };
 
 AppWindow::AppWindow()
-    : m_label (0)
+    : m_label (nullptr)
 {
     Gtk::Box* vbox = Gtk::manage(new Gtk::Box (Gtk::ORIENTATION_VERTICAL, 5));
     add(*vbox);
diff --git a/tests/dialog/main.cc b/tests/dialog/main.cc
index 44e4e90..2f5b999 100644
--- a/tests/dialog/main.cc
+++ b/tests/dialog/main.cc
@@ -17,7 +17,7 @@ private:
 };
 
 AppWindow::AppWindow()
-    : m_label (NULL)
+    : m_label (nullptr)
 {
     Gtk::Box* vbox = manage (new Gtk::Box (Gtk::ORIENTATION_VERTICAL, 5));
     add(*vbox);


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