]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - c++/cursesp.h
ncurses 6.2 - patch 20200907
[ncurses.git] / c++ / cursesp.h
index 3d8828cb84e5386d3ed83d13e919fb6933df143e..eb9111b7aedd2ae82b06e6864a96aa78b599ba07 100644 (file)
@@ -1,6 +1,7 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc.              *
+ * Copyright 2019,2020 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2014 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +35,7 @@
 #ifndef NCURSES_CURSESP_H_incl
 #define NCURSES_CURSESP_H_incl 1
 
 #ifndef NCURSES_CURSESP_H_incl
 #define NCURSES_CURSESP_H_incl 1
 
-// $Id: cursesp.h,v 1.27 2007/04/07 17:12:54 tom Exp $
+// $Id: cursesp.h,v 1.34 2020/05/24 01:40:20 anonymous.maarten Exp $
 
 #include <cursesw.h>
 
 
 #include <cursesw.h>
 
@@ -42,7 +43,7 @@ extern "C" {
 #  include <panel.h>
 }
 
 #  include <panel.h>
 }
 
-class NCURSES_IMPEXP NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesPanel
   : public NCursesWindow
 {
 protected:
   : public NCursesWindow
 {
 protected:
@@ -71,19 +72,22 @@ protected:
   void set_user(void *user)
   {
     UserHook* uptr = UserPointer();
   void set_user(void *user)
   {
     UserHook* uptr = UserPointer();
-    assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p);
-    uptr->m_user = user;
+    if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) {
+      uptr->m_user = user;
+    }
   }
   // Set the user pointer of the panel.
 
   void *get_user()
   {
     UserHook* uptr = UserPointer();
   }
   // Set the user pointer of the panel.
 
   void *get_user()
   {
     UserHook* uptr = UserPointer();
-    assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p);
-    return uptr->m_user;
+    void *result = 0;
+    if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p)
+      result = uptr->m_user;
+    return result;
   }
 
   }
 
-  void OnError (int err) const THROWS(NCursesPanelException)
+  void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
   {
     if (err==ERR)
       THROW(new NCursesPanelException (this, err));
   {
     if (err==ERR)
       THROW(new NCursesPanelException (this, err));
@@ -128,7 +132,7 @@ public:
   {
   }
 
   {
   }
 
-  virtual ~NCursesPanel();
+  virtual ~NCursesPanel() THROWS(NCursesException);
 
   // basic manipulation
   inline void hide()
 
   // basic manipulation
   inline void hide()
@@ -233,7 +237,8 @@ public:
     : NCursesPanel (nlines, ncols, begin_y, begin_x)
   {
       if (p)
     : NCursesPanel (nlines, ncols, begin_y, begin_x)
   {
       if (p)
-       set_user (const_cast<void *>(p_UserData));
+       set_user (const_cast<void *>(reinterpret_cast<const void*>
+                                    (p_UserData)));
   };
   // This creates an user panel of the requested size with associated
   // user data pointed to by p_UserData.
   };
   // This creates an user panel of the requested size with associated
   // user data pointed to by p_UserData.
@@ -241,14 +246,14 @@ public:
   NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
   {
     if (p)
   NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
   {
     if (p)
-      set_user(const_cast<void *>(p_UserData));
+      set_user(const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   };
   // This creates an user panel associated with the ::stdscr and user data
   // pointed to by p_UserData.
 
   };
   // This creates an user panel associated with the ::stdscr and user data
   // pointed to by p_UserData.
 
-  virtual ~NCursesUserPanel() {};
+  virtual ~NCursesUserPanel() THROWS(NCursesException) {};
 
 
-  T* UserData (void) const
+  T* UserData (void)
   {
     return reinterpret_cast<T*>(get_user ());
   };
   {
     return reinterpret_cast<T*>(get_user ());
   };
@@ -257,7 +262,7 @@ public:
   virtual void setUserData (const T* p_UserData)
   {
     if (p)
   virtual void setUserData (const T* p_UserData)
   {
     if (p)
-      set_user (const_cast<void *>(p_UserData));
+      set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   }
   // Associate the user panel with the user data pointed to by p_UserData.
 };
   }
   // Associate the user panel with the user data pointed to by p_UserData.
 };