]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxStaticCast, moved wxConstCast from wx/object.h to wx/defs.h for consistency
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Feb 2004 22:11:14 +0000 (22:11 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Feb 2004 22:11:14 +0000 (22:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/defs.h
include/wx/object.h

index 8231ab2b64e4e7871a02fffbbe10ae6848d080a1..8d58b43bfae28c0727144676a028cb03495cbe7e 100644 (file)
@@ -266,8 +266,8 @@ typedef int wxWindowID;
     #define wxEXPLICIT
 #endif /*  HAVE_EXPLICIT/!HAVE_EXPLICIT */
 
-/*  check for static/const/reinterpret_cast<>() */
-#ifndef HAVE_STATIC_CAST
+/* check for static/const_cast<>() (we don't use the other ones for now) */
+#ifndef HAVE_CXX_CASTS
     #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
         /*  VC++ 6.0 and 5.0 have C++ casts (what about earlier versions?) */
         #define HAVE_CXX_CASTS
@@ -276,14 +276,29 @@ typedef int wxWindowID;
         /*  GCC 2.95 has C++ casts, what about earlier versions? */
         #define HAVE_CXX_CASTS
     #endif
-#endif /*  HAVE_STATIC_CAST */
+#endif /*  !HAVE_CXX_CASTS */
 
 #ifdef HAVE_CXX_CASTS
     #ifndef HAVE_CONST_CAST
         #define HAVE_CONST_CAST
     #endif
+    #ifndef HAVE_STATIC_CAST
+        #define HAVE_STATIC_CAST
+    #endif
 #endif /*  HAVE_CXX_CASTS */
 
+#ifdef HAVE_CONST_CAST
+    #define wxConstCast(obj, className) const_cast<className *>(obj)
+#else
+    #define wxConstCast(obj, className) ((className *)(obj))
+#endif
+
+#ifdef HAVE_STATIC_CAST
+    #define wxStaticCast(val, type) static_cast<type>(val)
+#else
+    #define wxStaticCast(val, type) ((type)(val))
+#endif
+
 #ifndef HAVE_STD_WSTRING
     #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
         /*  VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */
index bc0824541b64f78cb6a1086aba691180bd72ecac..acf4956d168f8eca866e1b9e261a264cc32b4542 100644 (file)
@@ -340,13 +340,6 @@ name##PluginSentinel  m_pluginsentinel;
 #define wxDynamicCastThis(className) \
  (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0)
 
-#ifdef HAVE_CONST_CAST
-#define wxConstCast(obj, className) const_cast<className *>(obj)
-#else
-#define wxConstCast(obj, className) ((className *)(obj))
-#endif
-
-
 #ifdef __WXDEBUG__
 inline void* wxCheckCast(void *ptr)
 {